/** 网站搜索检测 **/
function checkSeach(formName){
	if(!formName) formName="SearchForm";
	var formOjb = document.forms[formName];
	if(formOjb.elements["SearchInfo"].value==""){
		alert('请输入关键字');
		formOjb.elements["SearchInfo"].focus();
		return false;
	}else{
		if(formOjb.elements["radiobutton"][2].checked){
			// 进行搜索引擎操作
			if(document.forms['googleSearchForm']){
				document.forms['googleSearchForm'].elements['q'].value = formOjb.elements["SearchInfo"].value;
				document.forms['googleSearchForm'].submit();
			}else alert("请加载/hidden_form.htm文件");
			return false;
		}else if(formOjb.elements["radiobutton"][0].checked){
			// 本站
			formOjb.submit();
		}else{
			// 政府群站
			if(document.forms['groupSearchForm']){
				//document.forms['groupSearchForm'].elements['q'].value = formOjb.elements["SearchInfo"].value;
				//document.forms['groupSearchForm'].elements['q'].value = encodeURIComponent(formOjb.elements["SearchInfo"].value);
				//document.forms['groupSearchForm'].elements['q'].value = formOjb.elements["SearchInfo"].value;
				//document.forms['groupSearchForm'].action = document.forms['groupSearchForm'].action+"?q="+encodeURI(formOjb.elements["SearchInfo"].value);
				//document.forms['groupSearchForm'].submit();	
				//window.open('http://60.190.2.12/jsearch/index.jsp?pagemode=result&appid=1&style=1&ck=o&pos='+encodeURIComponent("title,content")+'&q='+encodeURIComponent(formOjb.elements["SearchInfo"].value));
				window.open('http://60.190.2.12/jsearch/index.jsp?pagemode=result&appid=2&style=2&last_q=&pos='+encodeURIComponent("title,content")+'&pg=10&ck=o&tmp_od=0&qq=&q='+encodeURIComponent(formOjb.elements["SearchInfo"].value)+'&od=0&x=28&y=12');
			}else alert("请加载/common/hidden_form.htm文件");
			return false;
		}
		return false;
	}
}

function Gb2312ToUtf8(gb2312_str){
	return gb2312_str.replace(/[^\u0000-\u00FF]/g,function($0){return escape($0).replace(/(%u)(\w{4})/gi,"&#x$2;");});
}

function Utf8ToGb2312(utf8_str){
	return unescape(utf8_str.replace(/&#x/g,'%u').replace(/;/g,''));
}


var _guideState = false;
var _highcontrast = false;

function ocGuides(){
	if(_guideState==false) {
		grayscale.openGuides();
		document.getElementById("cwebsGuides").innerHTML="关闭辅助线";

		var expdate = new Date();
		expdate = new Date(expdate.getTime()+1000*60*30);
		setCookie("_guideState",true,expdate,"/");

		_guideState = true;
	}else{
		grayscale.removeGuides();
		document.getElementById("cwebsGuides").innerHTML="开启辅助线";
		clearCookie("_guideState");
		_guideState = false;
	}
}

function ocHighContrast(){
	if(_highcontrast==false) {
		grayscale(document.body);
		document.getElementById("cwebsHighContrast").innerHTML="关闭高对比度";

		var expdate = new Date();
		expdate = new Date(expdate.getTime()+1000*60*30);
		setCookie("_highcontrast",true,expdate,"/");

		_highcontrast = true;
	}else{
		grayscale.reset(document.body);
		document.getElementById("cwebsHighContrast").innerHTML="开启高对比度";
		clearCookie("_highcontrast");
		_highcontrast = false;
	}
}

$(document).ready(function(){
	if(getCookie("_guideState")) {
		_guideState = false;
		ocGuides();
	}
	if(getCookie("_highcontrast")) {
		_highcontrast = false;
		ocHighContrast();
	}

});

