﻿// JavaScript Document
function $(o){ return (typeof o == "object")?o:document.getElementById(o);}

function goMenu(tab)
{
   var _topMenuArr=$t("a",$("tbl_topMenu"));
   var _len=_topMenuArr.length;
		for(i=0;i<_len;i++)
		{
			if(/^a\d+$/.test(_topMenuArr[i].id.toString()))
			{
			  var n=_topMenuArr[i].id.toString().replace(/a/i, '');
			  $("m"+n).className="";
			  $("a"+n).className="menuTe";
			  $("t"+n).style.display="none";
			}
		}
		
			 $("m"+tab).className="menuBg";
			 $("a"+tab).className="menuTeA";
			 $("t"+tab).style.display="block";
}
//780
function goMenu1(tab)
{
for(i=0;i<8;i++)
		{		   
			 $("m"+i).className="";
			 $("a"+i).className="menuTe";
			 $("t"+i).style.display="none";
		}
			 $("m"+tab).className="ivBg";
			 $("a"+tab).className="menuTeA";
			 $("t"+tab).style.display="block";
}

//date
function writeDate(){
	todayDate = new Date();
	date = todayDate.getDate();
	month= todayDate.getMonth() +1;
	year= todayDate.getYear();
	if(navigator.appName == "Netscape"){
		year=1900+year;
	}
	var datestr=year+""+month+""+date+"";
	if (todayDate.getDay() == 5){ datestr+=" ";}
	if (todayDate.getDay() == 6){ datestr+=" ";}
	if (todayDate.getDay() == 0){ datestr+=" ";}
	if (todayDate.getDay() == 1){ datestr+=" һ";}
	if (todayDate.getDay() == 2){ datestr+=" ڶ";}
	if (todayDate.getDay() == 3){ datestr+=" ";}
	if (todayDate.getDay() == 4){ datestr+=" ";}
	document.write(datestr);
}


//Tab
function goNews(tab)
{
for(i=0;i<4;i++)
		{		   
			 $("nb"+i).className="tabbt";
			 $("na"+i).className="";
			 $("news"+i).style.display="none";
		}
			 $("nb"+tab).className="tabbt-on";
			 $("na"+tab).className="tabta";
			 $("news"+tab).style.display="block";
}

//ѶTab
function goInfo(tab)
{
for(i=0;i<4;i++)
		{		   
			 $("ib"+i).className="tabbt";
			 $("ia"+i).className="";
			 $("info"+i).style.display="none";
		}
			 $("ib"+tab).className="tabbt-on";
			 $("ia"+tab).className="tabta";
			 $("info"+tab).style.display="block";
}

//Tab
function goLink(tab)
{
for(i=0;i<6;i++)
		{		   
			 $("lib"+i).className="tabbt2";
			 $("lia"+i).className="tabta3";
			 $("link"+i).style.display="none";
		}
			 $("lib"+tab).className="tabbt2-on";
			 $("lia"+tab).className="tabta2";
			 $("link"+tab).style.display="block";
}

//ϰTab
function goBai(tab)
{
for(i=0;i<2;i++)
		{		   
			 //$("bb"+i).className="tabbt1";
			 $("ba"+i).src="Images/bans_"+i+"_n.gif";
			 $("bai"+i).style.display="none";
		}
			// $("bb"+tab).className="tabbt1-on";
			 $("ba"+tab).src="Images/bans_"+tab+".gif";
			 $("bai"+tab).style.display="block";
}


function URLgo(value)
{
	var sel;
	sel = eval('document.forms["linkSel"].' + value + ';');
	if (sel && (sel.value != ""))
		this.open(sel.value,target="_blank");
}

//񹫿Ĳб
function showbm(id,c){
	if($("bm"+id).style.display=="none"){
	    $("bm"+id).style.display="block";		
	}else{
		$("bm"+id).style.display="none";
    }
	
	if(c){
	//Ƹ߶ͬ
	if(($("bm1").style.display=="block") && ($("bm2").style.display=="none")){
		$("rightH").height = 905; 
		}
		else if(($("bm1").style.display=="none") && ($("bm2").style.display=="block")){
		$("rightH").height = 645; 
		}
		else if(($("bm1").style.display=="none") && ($("bm2").style.display=="none")){
		$("rightH").height = 580; 
		}
		else if(($("bm1").style.display=="block") && ($("bm2").style.display=="block")){
		$("rightH").height = 970; 
		}
	}
		
}
function setsn(sn){
    $("sn").innerText=sn;
}

function setUnable(ap){
	
    if(ap==0){
	    $("ap1").style.display="block";
		$("ap2").style.display="none";	
	}else{
	    $("ap1").style.display="none";
		$("ap2").style.display="block";
	}

}

//splitpage
//createPageHTML(ҳ, ǰҳ, ҳļ, չ);
function createPageHTML(_nPageCount, _nCurrIndex, _sPageName, _sPageExt){
	if(_nPageCount == null || _nPageCount<=1){
		return;
	}
	var nCurrIndex = _nCurrIndex || 0;
	document.write("<div  class='GpageSpliter'>");
	if(_nCurrIndex >0 ){
		if(_nCurrIndex == 1)
                      document.write("<span class=\"pagepre\"><a href=\""+_sPageName + "."+_sPageExt+"\" target=\"_self\">һҳ</a></span>&nbsp;");
                else
                      document.write("<span class=\"pagepre\"><a href=\""+_sPageName+"_" + (_nCurrIndex-1) + "."+_sPageExt+"\" target=\"_self\">һҳ</a></span>");
        }	
        if(_nCurrIndex < _nPageCount-1)
		document.write("<span class=\"pagenext\"><a href=\""+_sPageName+"_" + (_nCurrIndex+1) + "."+_sPageExt+"\" target=\"_self\">һҳ</a></span>");
	document.write("<br />");
	document.write("<span class=\"text\"></span> ");
	if(nCurrIndex == 0)
		document.write("<span class=\"current\">1</span> ");
	else
		document.write("<span class=\"pagecode\"><a href=\""+_sPageName+"."+_sPageExt+"\" target=\"_self\">1</a></span> ");
	for(var i=1; i<_nPageCount; i++){
		if(nCurrIndex == i)
			document.write("<span class=\"current\">" + (i+1) + "</span>&nbsp;&nbsp;");
		else
			document.write("<span class=\"pagecode\"><a href=\""+_sPageName+"_" + i + "."+_sPageExt+"\" target=\"_self\">"+(i+1)+"</a></span> ");
		//if(i!=_nPageCount-1)	document.write(" ");
	}
	document.write("<span class=\"text\">ҳ</span>");
	document.write("</div>");
}


document.onkeydown = keyDown;
function keyDown(e)
{
	var e=(typeof event!="undefined")?window.event:e;   // IE : Firefox
	var s=(document.getSelection)?document.getSelection():document.selection.createRange().text;
	if(e.ctrlKey && e.keyCode==13){
		if (s!="") 
		{
			window.open("Inc/SearchGo.shtml");
		}else{
			alert("ѡֶΣ");
			return false;
		}
	}
}

//ȥոTrim
function   
String.prototype.Trim()   
{return   this.replace(/(^\s*)|(\s*$)/g,"");}    
 function   String.prototype.Ltrim()
{return   this.replace(/(^\s*)/g,   "");}     
function   String.prototype.Rtrim()
{return   this.replace(/(\s*$)/g,   "");}

function checkreg()
{
	if(document.regform.username.value.Trim()=="")
	{
	alert('û');
	document.regform.username.focus();
	return false;
	}
	if(document.regform.UserPassword.value.Trim()=="")
	{
	alert('룡');
	document.regform.UserPassword.focus();
	return false;
	}
	if(document.regform.UserPassword.value.Trim() != document.regform.UserPassword1.value.Trim())
	{
	alert('ȷ벻һ');
	document.regform.UserPassword1.focus();
	return false;
	}
	if(document.regform.UName.value.Trim()=="")
	{
	alert('ʵ');
	document.regform.UName.focus();
	return false;
	}
	if(document.regform.UDepart.value.Trim()=="")
	{
	alert('ѡţ');
	document.regform.UDepart.focus();
	return false;
	}
	if(document.regform.UNO.value.Trim()=="")
	{
	alert('֤');
	document.regform.UNO.focus();
	return false;
	}
	if(document.regform.UTel.value.Trim()=="")
	{
	alert('绰');
	document.regform.UTel.focus();
	return false;
	}
}

function checklog()
{
	if(document.logform.username.value.Trim()=="")
	{
	alert('û');
	document.logform.username.focus();
	return false;
	}
	if(document.logform.userpassword.value.Trim()=="")
	{
	alert('룡');
	document.logform.userpassword.focus();
	return false;
	}	
}

function votecheck(){
var flag=0
for(i=0;i<voteform.nn.length;i++)
if(voteform.nn[i].checked==true){
flag=1
break
}
if(!flag){
alert("11")
return false
}
}

 // 日期时间
var dateTime = {
	now		: new Date(),
	showObj	: null,
	timer	: null,
	tInt	: null,
	date : function() {
		var nY = dateTime.now.getFullYear(), nM = dateTime.now.getMonth()+1, nD = dateTime.now.getDate();
		return (nY +'年'+ nM +'月'+ nD +'日');
	},
	week : function() {
		var day = dateTime.now.getDay();
		var wStr = null;
		switch(day){
			case 0 : wStr = '日'; break;
			case 1 : wStr = '一'; break;
			case 2 : wStr = '二'; break;
			case 3 : wStr = '三'; break;
			case 4 : wStr = '四'; break;
			case 5 : wStr = '五'; break;
			case 6 : wStr = '六'; break;
		}
		wStr = '星期'+ wStr;
		return wStr;
	},
	time : function() {
		var now = new Date();
		var nH = now.getHours(), nM = now.getMinutes(), nS = now.getSeconds();
		nH = nH >= 10 ? nH : '0'+ nH;
		nM = nM >= 10 ? nM : '0'+ nM;
		nS = nS >= 10 ? nS : '0'+ nS;
		var tmpStr = null;
		var tInt = null;
		if(dateTime.timer == null){
			clearInterval(dateTime.tInt);
			tmpStr = '<span id="__timer">'+
					 nH +':'+ nM +':'+ nS +
					 '<\/span>';
			dateTime.timer = $('__timer');
			dateTime.tInt = setInterval('dateTime.time()', 1000);
			return tmpStr;
		}else{
			tmpStr = nH +':'+ nM +':'+ nS;
			dateTime.timer.innerHTML = tmpStr;
		}
	},
	show : function(d, w, t) {
		if(dateTime.showObj == null){ return;}
		var tnpStr = null;
		var tmpDate = new Array();
		tmpDate[0] = d ? dateTime.date() : null;
		tmpDate[1] = w ? dateTime.week() : null;
		tmpDate[2] = t ? dateTime.time() : null;
		tnpStr = tmpDate.join('&nbsp;');
		dateTime.showObj.innerHTML = tnpStr;
	}
}






