function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}

function regLogin(){
	if(document.getElementById("signUpLogin")){
		var btn = document.getElementById("loginBtn");
		var login = document.getElementById("signUpLogin");
		var closeBtn = document.getElementById("close");
		login.style.display = "none";
		btn.onfocus = function(){
			this.blur();
		}
		btn.onclick = function(){
			login.style.display = "block";
			return false;
		}
		closeBtn.onclick = function(){
			login.style.display = "none";
		}
	}
}
function getElementsByClassName(tagname,classname){
var _arr = new Array;
var _a = document.getElementsByTagName(tagname);
for(i=0; i<_a.length; i++){
	if(_a[i].className == classname){
		_arr.push(_a[i]);
	}
}
return _arr;
}
function tableTab(){
	var _ar = getElementsByClassName("ul","tabA");
	var _ar2 = getElementsByClassName("div","tabConA");
	
	if(_ar.length>0){
		var lis = _ar[0].getElementsByTagName("li");
		for(j=0; j<_ar2.length; j++){
			lis[j].className = "";
			_ar2[j].style.display = "none";
		}
		lis[0].className = "on";
		_ar2[0].style.display = "block";
		
		
		for(i=0; i<lis.length; i++){
			lis[i]._i = i;
			lis[i].onclick = function(){
				for(j=0; j<_ar2.length; j++){
					lis[j].className = "";
					_ar2[j].style.display = "none";
				}
					lis[this._i].className = "on";
					_ar2[this._i].style.display = "block";
			}
		}
	}
}

$(function(){
	var timerID;
	$("#mainNav li").each(function(){
		var _self = $(this);
		if(_self.children("ul").length){
			_self.addClass("hasChild");
		}
		_self.mouseenter(function(){
			timerID = setTimeout(function(){_self.children("ul").fadeIn()},100);
		});
		_self.mouseleave(function(){
			clearTimeout(timerID);
			timerID = setTimeout(function(){_self.children("ul").fadeOut()},300);
		});
	});
	$("li.mn6").mouseover(function(){
		$("#jumpMenu").css({"visibility":"hidden"});
	});
	$("li.mn6").mouseout(function(){
		setTimeout(function(){$("#jumpMenu").css({"visibility":"visible"});},500);
	});
});


$(function(){
	if($("#cooper").length){
		$("#cooper ul").hide().eq(0).show();
		$("#cooper h2.styE").each(function(i){
			$(this).click(function(){
				$("#cooper ul").slideUp();
				$("#cooper ul").eq(i).slideDown();
				console.log(i);
			});
		});
	}
});
if(window.attachEvent){
	window.attachEvent("onload",regLogin);
	window.attachEvent("onload",tableTab);
}else if(window.addEventListener){
	window.addEventListener("load",regLogin,false);
	window.addEventListener("load",tableTab,false);
}
