$(document).ready(function(){
	ieHover(".lang-nav","lang-nav-hover");
	ieHover(".side-form .submit","submit-hover");
	ieHover(".some-form .submit","submit-hover");
})


// input type file
function initCustomFile()
{
	var inputs = document.getElementsByTagName("input");
	for (var i= 0; i < inputs.length; i++)
	{
		if(inputs[i].className.indexOf("file-input-area") != -1)
		{
			inputs[i].file = inputs[i].parentNode.getElementsByTagName("input").item(1);
			inputs[i].file.readOnly = true;
			inputs[i].onchange = function()
			{
				this.file.value = this.value;
			}
			inputs[i].onmouseover = function()
			{
				this.parentNode.className += " hover";
			}
			inputs[i].onmouseout = function()
			{
				this.parentNode.className = this.parentNode.className.replace(" hover", "");
			}
		}
	}
}
if (window.addEventListener)
	window.addEventListener("load", initCustomFile, false);
else if (window.attachEvent)
	window.attachEvent("onload", initCustomFile);


// inputs
//function hideFormText() {
//	var _inputs = document.getElementsByTagName('input');
//	var _txt = document.getElementsByTagName('textarea');
//	var _value = [];
//
//	if (_inputs) {
//		for(var i=0; i<_inputs.length; i++) {
//			if (_inputs[i].type == 'text' || _inputs[i].type == 'password') {
//
//				_inputs[i].index = i;
//				_value[i] = _inputs[i].value;
//
//				_inputs[i].onfocus = function(){
//					if (this.value == _value[this.index])
//						this.value = '';
//				}
//				_inputs[i].onblur = function(){
//					if (this.value == '')
//						this.value = _value[this.index];
//				}
//			}
//		}
//	}
//	if (_txt) {
//		for(var i=0; i<_txt.length; i++) {
//			_txt[i].index = i;
//			_value['txt'+i] = _txt[i].value;
//
//			_txt[i].onfocus = function(){
//				if (this.value == _value['txt'+this.index])
//					this.value = '';
//			}
//			_txt[i].onblur = function(){
//				if (this.value == '')
//					this.value = _value['txt'+this.index];
//			}
//		}
//	}
//}
//if (window.addEventListener)
//	window.addEventListener("load", hideFormText, false);
//else if (window.attachEvent)
//	window.attachEvent("onload", hideFormText);

// IE6 hover
function ieHover(h_list, h_class){
	if($.browser.msie && $.browser.version < 7){
		if(!h_class) var h_class = 'hover';
		$(h_list).mouseenter(function(){
			$(this).addClass(h_class);
		}).mouseleave(function(){
			$(this).removeClass(h_class);
		});
	}
}

//ie img png fix
var transparentImage = "images/none.gif";

function fixTrans()
{
	if (typeof document.body.style.maxHeight == 'undefined') {

	var imgs = document.getElementsByTagName("img");

	for (i = 0; i < imgs.length; i++)
	{
		if (imgs[i].src.indexOf(transparentImage) != -1)
		{
			return;
		}

		if (imgs[i].src.indexOf(".png") != -1)
			{
				var src = imgs[i].src;
				imgs[i].src = transparentImage;
				imgs[i].runtimeStyle.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + src + "',sizingMethod='scale')";
				imgs[i].style.display = "block";
			}
		}
	}
}

if (document.all && !window.opera)
	attachEvent("onload", fixTrans);

