$(function(){
    tabs_1();
	tabs_2();
	menu();
})
var onflag=false;
function menu(){
	$("body").click(function(){
		$(".submenu").hide();
	});
	$(".submenu").mouseover(function(){
		onflag=true;
		});
	$(".submenu").mouseout(function(){
					onflag=false;
		setTimeout('if(!onflag){'+'$(".submenu").hide();}',500);
	});
	try{
		$(".menu").hover(
			function(){
				$(".submenu").show();	
			}
		);
	}catch(e){
		var ss=1;
		}
}
function tabs_1(){
		$(".tabs-1 .tabs-nav .item a").click(function(){
			var id=$(".tabs-1 .tabs-nav .item").children().index(this);
			$(".tabs-1 .tabs-nav .item a ").removeClass('on');
			$(this).addClass('on');
			$(".tabs-1 .tabs-content .box").removeClass('on');
			$(".tabs-1 .tabs-content").children().eq(id).addClass('on');
			return false;
		})
}
function tabs_2(){
		$(".tabs-2 .tabs-nav .item a").click(function(){
			var id=$(".tabs-2 .tabs-nav .item").children().index(this);
			$(".tabs-2 .tabs-nav .item a ").removeClass('on');
			$(this).addClass('on');
			$(".tabs-2 .tabs-content .box").removeClass('on');
			$(".tabs-2 .tabs-content").children().eq(id).addClass('on');
			return false;
		})
}


function test(obj) {
if(obj=='login_form_youhua')
{
document.getElementById('yhname').value=document.getElementById('bbsname').value
document.getElementById('yhpwd').value=document.getElementById('bbspwd').value
document.getElementById('login_form_youhua').style.display="block";
document.getElementById('radiod').checked="checked";
document.getElementById('login_form_bbs').style.display="none";
}
else if(obj=='login_form_bbs')
{
document.getElementById('bbsname').value=document.getElementById('yhname').value
document.getElementById('bbspwd').value=document.getElementById('yhpwd').value
document.getElementById('login_form_youhua').style.display="none";
document.getElementById('login_form_bbs').style.display="block";
document.getElementById('radioa').checked="checked";
}
}


serchtype=2
	function dosearch(){
		formojb=document.getElementById('dmei');
		$word=encodeURI(document.getElementById('word').value);
		switch(serchtype){			
			case "1":
				url = 'http://www.youhua.com/baike/search/index?wd='+$word;
				break;
			case "3":
				url = 'http://www.youhua.com/product/driver/search?wd='+$word;
				break;
			default:
				url = 'http://www.youhua.com/zhidao/search/index/wd/'+$word+'/';
				break;
		}
		//window.location=url;
		formojb.action=url;
	}
	
	var mouflag={anoucemarquee:false,yqlj:false};
		
	function doscroll(dom){
		if(mouflag[dom]){
			setTimeout('doscroll("'+dom+'");',1000);
		}else{
			var obj=document.getElementById(dom);
			var height=obj.scrollHeight;
			var aviheight=parseInt(obj.style.height);
			if(height-aviheight<=obj.scrollTop){
				obj.scrollTop=0;
				setTimeout('doscroll("'+dom+'");',8000);
			}else{
				if(dom=='anoucemarquee'||dom=='yqlj'){
					scrollSlowly(dom,aviheight);
				}else{
					obj.scrollTop+=aviheight;
					setTimeout('doscroll("'+dom+'");',8000);
				}
			}
			
		}
	}
	function scrollSlowly(dom,dis){
		var obj=document.getElementById(dom);
		obj.scrollTop+=1;
		if(dis>0){
			setTimeout('scrollSlowly("'+dom+'",'+(dis-1)+')',10);
		}else{
			setTimeout('doscroll("'+dom+'");',8000);
		}
	}

function MM_jumpMenu(targ,selObj,restore){
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}
