// JavaScript Document
window.onload = tabEffect;
function tabEffect()
{
	var allElements = document.getElementsByTagName('*');
	for (var i=0; i<allElements.length; i++)
	{
		if (allElements[i].className.indexOf('tabOption') >= 0)
		{
			allElements[i].onclick = onclick;
		}
	}
}
function onclick()
{
    //tabList = this.parentNode;
    tabOptions = document.getElementsByTagName("li");
	for (var i=0; i<tabOptions.length; i++)
	{
	    if (tabOptions[i].className.indexOf('tabOption') >= 0)
		{
		    tabOptions[i].className = "tabOption";
		}
	}
	this.className += " current";
}
function show(objectid){
   var objdiv=document.getElementById(objectid);
   objdiv.className = "current inside box";
}
function hide(objectid){
	var objdiv = document.getElementById(objectid);
	objdiv.className = "inside box";
}
function show2(objectid){
   var objdiv=document.getElementById(objectid);
   objdiv.className = "current";
}
function hide2(objectid){
	var objdiv = document.getElementById(objectid);
	objdiv.className = "";
}
function show3(objectid){
	var objdiv = document.getElementById(objectid);
	objdiv.style.display = "block";
}
function hide3(objectid){
	var objdiv = document.getElementById(objectid);
	objdiv.style.display = "none";
}
function addfavorite()
{
   if (document.all)
   {
      window.external.addFavorite('http://www.ykpass.com/','医学考试在线');
   }
   else if (window.sidebar)
   {
      window.sidebar.addPanel('医学考试在线','http://www.ykpass.com/',"");
   }
}
function leftMarquee(tab,tab1,tab2){
	var speed=20,
		tab=document.getElementById(tab),
		tab1=document.getElementById(tab1),
		tab2=document.getElementById(tab2);
	tab2.innerHTML=tab1.innerHTML;
	function Marquee(){
		if(tab2.offsetWidth-tab.scrollLeft<=0){
			tab.scrollLeft-=tab1.offsetWidth;
		}else{
			tab.scrollLeft++;
		}
	}
	var Mymar=setInterval(Marquee,speed);
	tab.onmouseover=function(){
		clearInterval(Mymar);
	};
	tab.onmouseout=function(){
		Mymar=setInterval(Marquee,speed);
	};
}
$(function(){
	//搜索
	$("li.my,li.my>ul").mouseover(function(){
		$(this).children("ul").show();
		$(this).children("a").css("background","url(/web/images/icon_up.gif) no-repeat 44px 8px #fff").addClass("hover");
	}).mouseout(function(){
		$(this).children("ul").hide();
		$(this).children("a").css("background","url(/web/images/icon_down.gif) no-repeat 44px 8px #eee").removeClass("hover");
	});
	$("#select li").click(function(){
		var value=$(this).attr("title");
		$(this).addClass("current").siblings().removeClass("current");
		$("#type").val(value);
	});
	$("#query").focus(function(){
		$(this).css("background","#fff");
	}).blur(function(){
		if(!this.value){
			$(this).css("background","url(/web/images/icon_search.gif) no-repeat 5px center #fff");
		}
	});
	//导航
	$(".mn_con li").hover(function(){
		$(this).addClass("current");
	},function(){
		$(this).removeClass("current");
	});
});
