$(document).ready(function() {
	//页面加载时 ’商标‘上面的图片的状态
	$("#tu_brand").css('background',"url(res/imgs/tu11.gif) no-repeat  center 0");
	
	$(".s1").bind('click',function(){
		$("#sb").click();
	})
	$(".s2").bind('click',function(){
		$("#zl").click();
	});
	$(".s3").bind('click',function(){
		$("#zx").click();
	});
	$(".s6").bind('click',function(){
		$("#sjzx").click();
	});
	var divcss = {"color":"#000000","text-decoration":"none","font-weight":"bold"};
	var divcss1 = {"text-decoration":"underline","color":"#0000FF","font-weight":"bold"};
	$("#sb").click(function(){
		$(this).parent().children('a').css(divcss1);
		$(this).css(divcss);
		$("#controller").val("search");
		$("#action").val("brand_list");
		$("#tu_brand").css('background',"url(res/imgs/tu11.gif) no-repeat  center 0");
		$("#tu_patent").css('background',"url(res/imgs/tu2.gif) no-repeat  center 0");
		$("#tu_zixun").css('background',"url(res/imgs/tu3.gif) no-repeat  center 0");
	})
	$("#zl").click(function(){
		$(this).parent().children('a').css(divcss1);
		$(this).css(divcss);
		$("#controller").val("search");
		$("#action").val("patent_list");   
		$("#tu_patent").css('background',"url(res/imgs/tu22.gif) no-repeat  center 0");
		$("#tu_brand").css('background',"url(res/imgs/tu1.gif) no-repeat  center 0");
		$("#tu_zixun").css('background',"url(res/imgs/tu3.gif) no-repeat  center 0");
	})
	$("#zx").click(function(){
		$(this).parent().children('a').css(divcss1);
		$(this).css(divcss);
		$("#controller").val("search");
		$("#action").val("news_list");
		$("#tu_zixun").css('background',"url(res/imgs/tu33.gif) no-repeat  center 0");
		$("#tu_patent").css('background',"url(res/imgs/tu2.gif) no-repeat  center 0");
		$("#tu_brand").css('background',"url(res/imgs/tu1.gif) no-repeat  center 0");
	})
	$("#sjzx").click(function(){
		$(this).parent().children('a').css(divcss1);
		$(this).css(divcss);
		$("#controller").val("search");
		$("#action").val("des_list");
	})

	//列表 和 内容页 搜索表头字体的js（字体的变化跟首页不一样）
	var cssdiv={"text-decoration":"underline","color":"#0000FF","font-weight":"normal"};
	var thisdivcss = {"color":"#000000","text-decoration":"none","font-weight":"bold"};
	$("#sb_").click(function(){
		$(this).parent().children('a').css(cssdiv);
		$(this).css(thisdivcss);
	})
	$("#zl_").click(function(){
		$(this).parent().children('a').css(cssdiv);
		$(this).css(thisdivcss);
	})
	$("#zx_").click(function(){
		$(this).parent().children('a').css(cssdiv);
		$(this).css(thisdivcss);
	})
	//如果为空改变action 让其还在首页
	$("#submit_").click(function(){
		var content = $("#key").val();
		if(content == ''){
			$("#search_frm").attr("action","http://www.ciprun.cn");
		}
	})

	//添加更多工具事件
	$("#ok").click(function(){
		if(($("input[name='y']:checked").length)<=0){
			alert('请选择您想要添加的工具！');
		}else{
			var obj1 =$("input[name='y']");
			$.each(obj1,function(i,val){
				if($(this).is(":checked")) {
					$(".menu_more").eq(i).show();
				} else {
					$(".menu_more").eq(i).hide();
				}
			});
		}
	});

	//工具div的展开与合拢
	$(".menu_head").click(function(){
		$(this).next(".menu_body").slideToggle(300).siblings(".menu_body").slideUp("slow");
	});
	
	//专利快速检索
	$("#pfind").bind("click",function(){
		var key = $("#ky").val();
		var con = $("#controller").val();
		var act = $("#action").val();
		var checkval = $("#patent_s").val();
		var search_k = $("#search_key").val();
		location.href="?c="+con +"&a=" +act + "&keywords=" + key + "&indexer="+checkval+"&search_key="+search_k;
	});
});
/**
*
* 列表 和 内容页的工具里的翻译js 调用谷歌翻译的jsapi
*
*/
google.load("language", "1");
function initialize() {
	var text = document.getElementById("txtInput").value;
	var pair = document.getElementById("langpair").options[document.getElementById("langpair").selectedIndex].value;
	google.language.detect(text, function(result) {
		if (!result.error && result.language) {
			google.language.translate(text, result.language,pair,
				function(result) {
					var translated = document.getElementById("lblTransResult");
					if (result.translation) {
						translated.innerHTML = result.translation;
					}
				});
		}
	});
}

//专利内容页的文字大小 大 中 小的css变幻js
function gb(x) {
	document.getElementById("zi").style.fontSize=x;
}
/*
 *
 * * 设为首页
 *
 */
function set_page_index(a){
	a.style.behavior='url(#default#homepage)';
	a.setHomePage('http://www.ciprun.cn');
}

//商标图片翻转 商标列表和内容页
function Vturn()//内容页垂直翻转
{
document.getElementById(image22).style.filter = document.getElementById(image22).style.filter =="flipV"?"":"flipV";
	
}
function turnV()//列表页垂直翻转
{
	var len = document.getElementsByName('bbb');
	var lent = len.length;
	for(i=0;i<=lent;i++){
		document.getElementsByName('bbb')[i].style.filter = document.getElementsByName('bbb')[i].style.filter =="flipV"?"":"flipV";
	}
}

function addLoadListener(fn)
{
	if (typeof window.addEventListener != 'undefined')
	{
		window.addEventListener('load',fn,false);
	}
	else if (typeof document.addEventListener != 'undefined')
	{
		document.addEventListener('load',fn,false);
	}
	else if (typeof window.attachEvent != 'undefined')
	{
		window.attachEvent('onload',fn);
	}
	else
	{
		var oldfn = window.onload;
		if (typeof window.onload != 'function')
		{
			window.onload = fn;
		}
		else
		{
			window.onload = function() {
				lodfn();
				fn();
			};
		}
	}
}
addLoadListener(Vturn);
addLoadListener(turnV);


