// JavaScript Document
var j = jQuery.noConflict(); 

function switchLiCnt(obja,objb){
	
	j('#' + obja).children().mouseover(function(){
		if(j(this).attr("class") != "on"){
			j('#' + obja).children().removeClass('on');
			j(this).addClass("on");
			key = j('#' + obja).children().index(j(this));
			j('#' + objb).children().removeClass('on');
			j('#' + objb).children().eq(key).addClass("on");
		}
	})
}
function switchLiClass(obja){
	j('#' + obja + "> li").mouseover(function(){
		if(j(this).attr("class") != "on"){
			j('#' + obja +'> li').removeClass();
			j(this).addClass("on");
		}
	})
}
function switchClass(obja){
	j(obja).mouseover(function(){
		if(j(this).attr("class") != "on"){
			j(this).addClass("on");
		}
	}).mouseout(function(){
		j(this).removeClass("on");
	})
}
function switchClassHover(obja){
	j(obja).mouseover(function(){
		j(this).addClass("hover");
	}).mouseout(function(){
		j(this).removeClass("hover");
	})
}

function formType(obj){
	j("#"+obj+" dd").mouseover(function(){
		j(this).addClass("hover");
	}).mouseout(function(){
		j(this).removeClass("hover");
	}).click(function(){
		j(this).parent().removeClass("on");
		j("#input_type").val(j(this).html());
		j("#input_type_show").html(j(this).html());
		
		j("#thesearchtype").val(j("#"+obj+" dd").index(j(this)));
	})
	j("#"+obj+" dt").click(function(){
		j(this).parent().toggleClass("on");
	})
	j("#"+obj).bind("mouseleave",function(){
		j(this).removeClass("on");
	})
}
function submit_searchForm(obj){
	var keywords=j("#header_keywords").val();
	var type=j("#thesearchtype").val();
	if (type=='1'){
		window.location.href="http://www.petyoo.com/bbs/search.php?searchsubmit=true&srchtxt="+encodeURIComponent(keywords);	//bbs
	}else if (type=='2'){
		window.location.href="http://www.petyoo.com/news/batch.search.php?searchname=subject&searchkey="+encodeURIComponent(keywords);	 //news
	}else if( type=='3') {
		window.location.href="http://www.petyoo.com/home/network.php?ac=blog&searchmode=1&key="+encodeURIComponent(keywords);	 //home
	}else if( type=='4') {
		window.location.href="http://zhidao.petyoo.com/search.php?word="+encodeURIComponent(keywords)+"&search=";	 //zhidao	
	
	}else{
		window.location.href="http://shop.petyoo.com/search.php?keywords="+encodeURIComponent(keywords);	 //news	
	}
}
