// JavaScript Document
window.onerror = killErrors;
function killErrors(){
	//return true;
}
function isJSP() {
	if (window.location.href.indexOf(".html") != -1 || window.location.href.indexOf(".htm") != -1) {
		return false;
	}else {
		return true;
		
	}
}

function popSearch(k){
	var ns=window.open("/carsclub2007/public/popsearch.jsp?keyword="+k,"search","width=1003,height=600,top=0,left=0,scrollbars=1 resizable=1");
	ns.focus();
}
function openwin(catid,id){
	var link=isJSP() ? "/public/news.jsp?catid="+catid+"&id="+id : "/public/news_jsp_catid_"+catid+"_id_"+id+".html";
	var nw=window.open(link);
	nw.focus();
}


function fontZoom(size) {
	var ob=document.getElementById("arContent");
	ob.style.fontSize=size+'px'; 
	Cookie.addCookie("fontSizeSelected",size,10);
}	


//Cookie相关
var Cookie = {
	addCookie:function(name,value,expireHours){
		var cookieString=name+"="+escape(value);
		//判断是否设置过期时间
		if(expireHours>0){
			var date=new Date();
			date.setTime(date.getTime()+expireHours*3600*1000);
			cookieString=cookieString+"; expire="+date.toGMTString();
		}
		document.cookie=cookieString;
	},
	getCookie:function(name){
		var strCookie=document.cookie;
		var arrCookie=strCookie.split("; ");
		var value = "";
		for(var i=0;i<arrCookie.length;i++){
			var arr=arrCookie[i].split("=");
			if(arr[0]==name)value = unescape(arr[1]);
		}
		return value;
	},
	deleteCookie:function(name){
		var date=new Date();
		date.setTime(date.getTime()-10000);
		document.cookie=name+"=v; expire="+date.toGMTString();
	}
}


function closeWindow(){
	window.close();
}

function doPrint(){
	window.print();
}

function goAdvanceSearch(){
	location.href='/search/';
}
function openGongKai(catid,id){
	var link=isJSP() ? "/xxgk/gongkai.jsp?catid="+catid+"&id="+id : "/xxgk/gongkai_jsp_catid_"+catid+"_id_"+id+".html";
	var nw=window.open(link);
	nw.focus();
}

function checkSearchForm(ob){
	if(ob.keyword.value==""){
		alert("请填写关键字");
		ob.keyword.focus();
		return false;
	}
}

function goFangtan(){
	//alert("在线访谈暂未开放");
	location.href='/zmhd/chatList.jsp?catid=50|114';
}

function goBBS(){
	alert("论坛暂未开放");
}

function viewPaperResult(catid,id){
	window.open("/public/vote_result.jsp?catid="+catid+"&paperid="+id);
}

function setFav(){
	window.external.AddFavorite(location.href,document.title);
}
function setHomePage(ob){
	window.location.href;ob.style.behavior='url(#default#homepage)';ob.setHomePage('http://www.gzq.gov.cn')
}


function resetForm(ob){
	ob.reset();
}
