// JavaScript Document
var SITE_URL = "http://www.haicang.gov.cn/";

function Trim(_value){
				return _value.replace(/(^\s*)|(\s*$)/g, "");
}

function checkSubmit(){
	if(Trim($ID("title").value) == ""){
			alert("请输入关键字！");
			return false;
	}
}
function searchFun(ItemsCount, currObj, method){
	for(i=1; i<=ItemsCount; i++){
		if($ID("search_" + i) == currObj){
			$ID("search_" + i).className = "bar_c";
			$ID("clz").value = method;
			if(method == "Hdzx"){
				$ID("IndexForm").action = "http://www.haicang.gov.cn:8086/hchd/main.jsp";
			}else{
				$ID("IndexForm").action = "http://www.haicang.gov.cn:8090/hcSearch/search.html";
			}
		}else{
			$ID("search_" + i).className = "";
		}
	}
	return false;
}

var scripts = [
   "http://www.haicang.gov.cn:8090/hcSearch/sitehits.jsp?siteid=10",SITE_URL + "images/switch.js"
];

var url = window.location.href;
var tempSubStr = url.substring(SITE_URL.length, url.length);


var headfooter = {
	headfooter_header:function(){
                document.write('<div style="position:absolute; width:250px; height:107px; left:50%; margin-left:-500px; z-index:1000; cursor:pointer;" title="海沧区人民政府首页" onclick="window.location.href = \'' + SITE_URL + '\' "></div>');
		document.write('<table width="1002" border="0" cellspacing="0" cellpadding="0" align="center" height="107" class="ind_head"><tr>');
		document.write('<td height="71" valign="top">');
		document.write('<table width="444" align="right" border="0" cellspacing="0" cellpadding="0" height="66" class="ind_t1">');
		document.write('	  <tr>');
		document.write('		<td height="34">');
		document.write('		<table width="392" border="0" cellspacing="0" cellpadding="0" class="h22 f_c ind_color mar_l10 t12">');
		document.write('		  <tr>');
		document.write('			<td height="22" width="60"><a id="search_1" href="javascript:void(0);" onclick="searchFun(5,this,\'SearchSite\');" class="bar_c"><span>全站检索</span></a></td>');
		document.write('			<td width="6">|</td>');
		document.write('			<td width="60"><a id="search_2" href="javascript:void(0);" onclick="searchFun(5,this,\'SearchNews\');"><span>新闻检索</span></a></td>');
document.write('			<td width="6">|</td>');
		document.write('			<td width="103"><a id="search_3" href="javascript:void(0);" onclick="searchFun(5,this,\'SearchXxgk\');"><span>政府信息公开检索</span></a></td>');
		document.write('			<td width="6">|</td>');
		document.write('			<td width="85"><a id="search_4" href="javascript:void(0);" onclick="searchFun(5,this,\'SearchBszn\');"><span>办事指南检索</span></a></td>');
		document.write('			<td width="6">|</td>');
		document.write('			<td width="60"><a id="search_5" href="javascript:void(0);" onclick="searchFun(5,this,\'Hdzx\');"><span>信件检索</span></a></td>');
		document.write('		  </tr>');
		document.write('		</table>');
		document.write('		</td>');
		document.write('	  </tr>');
		document.write('	  <tr>');
		document.write('		<td height="32">');
		document.write('        <form target="_blank" action="http://www.haicang.gov.cn:8090/hcSearch/search.html" id="IndexForm" name="IndexForm" method="get" style=" margin:0px; padding:0px;" onsubmit="return checkSubmit();">');
		document.write('        <input type="hidden" id="clz" name="clz" value="SearchSite" />');
		document.write('        <input type="hidden" name="dir" value="1" />');
		document.write('		<table width="95%" border="0" cellspacing="0" cellpadding="0" class="h28 tgray1 t12" align="center">');
		document.write('		  <tr>');
		document.write('			<td height="28">');
		document.write('            <input name="title" value type="text" style="width:190px;" />');
		document.write('            </td>');
		document.write('			<td width="50" align="center"><' +'input type="image" src="' + SITE_URL +'images/11xmhc_jyly_btn1.png" align="absmiddle" width="45" height="18" border="0"/></td>');
		document.write('			<td width="70" align="center"><a href="http://www.haicang.gov.cn/SITE_CONFIG/advsearch/" target="_blank"><' +'img src="' + SITE_URL +'images/11xmhc_jyly_btn2.png" align="absmiddle" width="63" height="18" border="0"/></a></td>');
		document.write('			<td width="22" align="center"><' +'img src="' + SITE_URL +'images/11xmhc_jyly_icon1.png" align="absmiddle" border="0"/></td>');
		document.write('			<td width="25" align="left"><a href="http://www.haicang.gov.cn/rss" target="_blank">RSS</a></td>');
		document.write('			<td width="60" class="tb"><A name="asp99" id="asp99">繁體中文</A></td>');
		document.write('		  </tr>');
		document.write('		</table>');
 		document.write('       </form>');
		document.write('		</td>');
		document.write('	  </tr>');
		document.write('	</table>');

		document.write('</td></tr>');
		document.write('<tr><td height="36" valign="bottom">');
		if(typeof HASHDZX == "undefined" && (url.indexOf("hchd/outer/user/index.jsp") != -1 || url.indexOf("hchd") == -1) && !tempSubStr.startWith("hdzx") && url.indexOf("spzx") == -1){
			document.write('<table width="725" height="36" class="h36 f_c t16 tb" border="0" cellSpacing="0" cellPadding="0" style="margin-left: 250px;">');
			document.write('	<tr>');
			document.write('		<td width="15" class="twhite1"></td>');
			document.write('		<td width="120"><span class="' + (tempSubStr.startWith("tstzq") ? 'ind_menu_bar tblue10' : 'awhite1') + '"  id="td_81"><span><a href=\'http://www.haicang.gov.cn/tstzq/\'>台商投资区</a></span></span></td>');
			document.write('		<td width="85"><span class="' + (tempSubStr.startWith("gov")  || tempSubStr == "" ? 'ind_menu_bar tblue10' : 'awhite1') + '"  id="td_82"><span><a href=\'http://www.haicang.gov.cn/gov/\'>政府</a></span></span></td>');
			document.write('		<td width="85"><span class="' + (tempSubStr.startWith("jm") ? 'ind_menu_bar tblue10' : 'awhite1') + '"  id="td_83"><span><a href=\'http://www.haicang.gov.cn/jm/\'>居民</a></span></span></td>');
			document.write('		<td width="120"><span class="' + (tempSubStr.startWith("swqy") ? 'ind_menu_bar tblue10' : 'awhite1') + '"  id="td_84"><span><a href=\'http://www.haicang.gov.cn/swqy/\'>商务与企业</a></span></span></td>');
			document.write('		<td width="100"><span class="awhite1"><a href="http://www.xmhcly.com" target="_blank">旅游</a></span></td>');
			document.write('		<td width="100"><span class="' + (tempSubStr.startWith("zjhc") ? 'ind_menu_bar tblue10' : 'awhite1') + '"  id="td_85"><span><a href=\'http://www.haicang.gov.cn/zjhc/\'>走进海沧</a></span></span></td>');
			document.write('		<td width="100"><span class="' + (url.indexOf("hchd") != -1 ? 'ind_menu_bar tblue10' : 'awhite1') + '"  id="td_86"><span><a href=\'http://www.haicang.gov.cn:8086/hchd/outer/user/index.jsp\'>用户中心</a></span></span></td>');
			document.write('	</tr>');
			document.write('</table>');
			//addLoadEvent(selectType);	
		}else{
			document.write('<table width border="0" cellspacing="0" cellpadding="0" align="right" height="36" class="h36 f_c t16 tb">');
			document.write('  <tr>');
			document.write('	<td class="awhite1 wssp_menu_line" width="105"><a href=\'http://www.haicang.gov.cn/tstzq/\'>台商投资区</a></td>');
			document.write('	<td class="awhite1 wssp_menu_line" width="70"><a href=\'http://www.haicang.gov.cn/gov/\'>政府</a></td>');
			document.write('	<td class="awhite1 wssp_menu_line" width="70"><a href=\'http://www.haicang.gov.cn/jm/\'>居民</a></td>');
			document.write('	<td class="awhite1 wssp_menu_line" width="105"><a href=\'http://www.haicang.gov.cn/swqy/\'>商务与企业</a></td>');
			document.write('	<td class="awhite1 wssp_menu_line" width="70"><a href="http://www.xmhcly.com" target="_blank">旅游</a></td>');
			document.write('	<td class="awhite1 wssp_menu_line" width="95"><a href=\'http://www.haicang.gov.cn/zjhc/\'>走进海沧</a></td>');
			document.write('	<td class="awhite1" width="95"><a href=\'http://www.haicang.gov.cn:8086/hchd/outer/user/index.jsp\'>用户中心</a></td>');
			document.write('  </tr>');
			document.write('</table>');
		}
		document.write('</td>');
		document.write('</tr>');
		document.write('</table>');
	},
	headfooter_footer:function(){
		document.write('<table width="1000" border="0" cellspacing="0" cellpadding="0" align="center" height="70">');
		document.write('	<tr>');
		document.write('		<td width="477" valign="top" class="pad_t15 pad_l5"><p><a href="http://mail.haicang.gov.cn" target="_blank">政府邮箱</a> | <a href="http://www.haicang.gov.cn/lxwm/" target="_blank">联系我们</a> | <a href="http://www.haicang.gov.cn/SITE_CONFIG/wzdt/" target="_blank">网站地图</a> <!--| <a href="http://www.haicang.gov.cn/SITE_CONFIG/fwtj/" target="_blank">访问统计</a> -->| <a href="http://www.haicang.gov.cn/SITE_CONFIG/xqwzdh/" target="_blank">网站导航</a><span id="siteCount"></span></p><p class="mar_t10">服务电话:<'+'img src="' + SITE_URL +'images/11xmhc_ind_ph.png" align="absmiddle" border="0"/></p></td>');
		document.write('		<td width="356" align="right" class="h20 pad_t15" valign="top">2011.海沧台商投资区 厦门市海沧区人民政府 <br />');
		document.write('备案序号：闽ICP备07055302号</td>');
		document.write('		<td width="167" align="center" valign="top" class="pad_t15"><' +'img src="' + SITE_URL +'images/11xmhc_logo.png" align="absmiddle" /></td>');
		document.write('	</tr>');
                document.write('<tr><td height="15" colspan="3"></td></tr>');
		document.write('</table>');
                addLoadEvent(loadHitsCount);
	}
};

String.prototype.endWith=function(str){
	if(str==null||str==""||this.length==0||str.length>this.length)
		return false;
	if(this.substring(this.length-str.length)==str)
		return true;
	else
		return false;
}

String.prototype.startWith=function(str){
	if(str==null||str==""||this.length==0||str.length>this.length)
		return false;
	if(this.substr(0,str.length)==str)
		return true;
	else
		return false;
}


function selectType(){
	var url = window.location.href;
	var tempSubStr = url.substring(SITE_URL.length, url.length);
	if(tempSubStr.startWith("gov")){
		UtilFunction.changeAdvTDFunction(8,6,$ID("td_82"),'','ind_menu_bar tblue2','twhite1');
	}else if(tempSubStr.startWith("tstzq")){
		UtilFunction.changeAdvTDFunction(8,6,$ID("td_81"),'','ind_menu_bar tblue2','twhite1');
	
	}else if(tempSubStr.startWith("jm")){
		UtilFunction.changeAdvTDFunction(8,6,$ID("td_83"),'','ind_menu_bar tblue2','twhite1');
	
	}else if(tempSubStr.startWith("swqy")){
		UtilFunction.changeAdvTDFunction(8,6,$ID("td_84"),'','ind_menu_bar tblue2','twhite1');
	
	}else if(tempSubStr.startWith("zjhc")){
		UtilFunction.changeAdvTDFunction(8,6,$ID("td_85"),'','ind_menu_bar tblue2','twhite1');
	}else if(url.indexOf("hchd") != -1){
		UtilFunction.changeAdvTDFunction(8,6,$ID("td_86"),'','ind_menu_bar tblue2','twhite1');
	}else{
		UtilFunction.changeAdvTDFunction(8,6,$ID("td_82"),'','ind_menu_bar tblue2','twhite1');
	}
}

function loadHitsCount(){
    seriesLoadScripts(scripts,function(){if(typeof writeSiteCount != "undefined"){writeSiteCount("siteCount");}});
}
