//检测是否字符
function fucCheckNUM(NUM)
{
	var i,j,strTemp;
	strTemp="0123456789.+-";
	if ( NUM.length== 0)
		return 0
	for (i=0;i<NUM.length;i++)
	{
		j=strTemp.indexOf(NUM.charAt(i));	
		if (j==-1)
		{
		//说明有字符不是数字
			return 0;
		}
	}
	//说明是数字
	return 1;
}


//检测email格式
function ismail(mail)
{
	bln = new RegExp(/^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/).test(mail);
	if(bln)return true;
	else {return false;}
}

//检测日期是否正确
function isDate(str)
{
if(!str.match(/^\d{4}\-\d\d?\-\d\d?$/)){return false;}
//str=str.replace(/[^\d \:\-]+/g,"");
window.tmp=false;
window.execScript('tmp=IsDate("' + str + '")', "vbs");
return tmp;
}

//选择单位代码
function Seldw()
{
	width=700;
	height=580;
	xposition = 0;
	yposition = 0;
	if ((parseInt(navigator.appVersion) >= 4 ))
	{
		xposition = (screen.width - width) / 2;
		yposition = (screen.height - height) / 2;
	} 
	theproperty= "width=" + width + ", height=" + height + ", location=0,menubar=0,resizable=1,scrollbars=1,status=0,titlebar=0,toolbar=0,hotkeys=0,screenx=" + xposition + "," + "screeny=" + yposition + "," + "left=" + xposition + "," + "top=" + yposition;
	nw=window.open("dwxx_sz.asp","dwdm_sel",theproperty);
}

//选择办事表格
function Selbsbg(bgsz,dwdm)
{
	width=700;
	height=580;
	xposition = 0;
	yposition = 0;
	if ((parseInt(navigator.appVersion) >= 4 ))
	{
		xposition = (screen.width - width) / 2;
		yposition = (screen.height - height) / 2;
	} 
	theproperty= "width=" + width + ", height=" + height + ", location=0,menubar=0,resizable=1,scrollbars=1,status=0,titlebar=0,toolbar=0,hotkeys=0,screenx=" + xposition + "," + "screeny=" + yposition + "," + "left=" + xposition + "," + "top=" + yposition;
	nw=window.open("bsbg_sz.asp?mybgsz="+bgsz+"&search_txt="+dwdm+"&search_lx=2","bsbg_sel",theproperty);
}


//选择收费依据
function Selsfyj(sfsz,dwdm)
{
	width=700;
	height=580;
	xposition = 0;
	yposition = 0;
	if ((parseInt(navigator.appVersion) >= 4 ))
	{
		xposition = (screen.width - width) / 2;
		yposition = (screen.height - height) / 2;
	} 
	theproperty= "width=" + width + ", height=" + height + ", location=0,menubar=0,resizable=1,scrollbars=1,status=0,titlebar=0,toolbar=0,hotkeys=0,screenx=" + xposition + "," + "screeny=" + yposition + "," + "left=" + xposition + "," + "top=" + yposition;
	nw=window.open("sfyj_sz.asp?mysfsz="+sfsz+"&search_txt="+dwdm+"&search_lx=2","sfyj_sel",theproperty);
}


// 取路径中的文件名
function getfilename(str){
	var myi=str.lastIndexOf("/")+1
	return str.substr(myi,str.length-myi);
}


  var   CalendarData=new   Array(20);   
  var   madd=new   Array(12);   
  var   TheDate=new   Date();   
  var   tgString="甲乙丙丁戊己庚辛壬癸";   
  var   dzString="子丑寅卯辰巳午未申酉戌亥";   
  var   numString="一二三四五六七八九十";   
  var   monString=new Array(12);   
//  var   monString="正二三四五六七八九十冬腊";     
  var   weekString="日一二三四五六";   
  var   sx="鼠牛虎兔龙蛇马羊猴鸡狗猪";   
  var   cYear;   
  var   cMonth;   
  var   cDay;   
  var   cHour;   
  var   cDateString;   
  var   DateString;   
  var   Browser=navigator.appName;   
    
  function   init()   
  {     
      CalendarData[0]=0x41A95;   
      CalendarData[1]=0xD4A;   
      CalendarData[2]=0xDA5;   
      CalendarData[3]=0x20B55;   
      CalendarData[4]=0x56A;   
      CalendarData[5]=0x7155B;   
      CalendarData[6]=0x25D;   
      CalendarData[7]=0x92D;   
      CalendarData[8]=0x5192B;   
      CalendarData[9]=0xA95;   
      CalendarData[10]=0xB4A;   
      CalendarData[11]=0x416AA;   
      CalendarData[12]=0xAD5;   
      CalendarData[13]=0x90AB5;   
      CalendarData[14]=0x4BA;   
      CalendarData[15]=0xA5B;   
      CalendarData[16]=0x60A57;   
      CalendarData[17]=0x52B;   
      CalendarData[18]=0xA93;   
      CalendarData[19]=0x40E95;   
      madd[0]=0;   
      madd[1]=31;   
      madd[2]=59;   
      madd[3]=90;   
      madd[4]=120;   
      madd[5]=151;   
      madd[6]=181;   
      madd[7]=212;   
      madd[8]=243;   
      madd[9]=273;   
      madd[10]=304;   
      madd[11]=334; 
	  monString[0]="正";
 	  monString[1]="二";
 	  monString[2]="三";
 	  monString[3]="四";
   	  monString[4]="五";
 	  monString[5]="六";
 	  monString[6]="七";
 	  monString[7]="八";
   	  monString[8]="九";
 	  monString[9]="十";
 	  monString[10]="十一";	  
 	  monString[11]="十二";
	}   
    
  function   GetBit(m,n)   
  {     
        return   (m>>n)&1;   
  }   
    
  function   e2c()   
  {       
      var   total,m,n,k;   
      var   isEnd=false;   
      var   tmp=TheDate.getYear();   
      if   (tmp<1900)     tmp+=1900;   
      total=(tmp-2001)*365   
          +Math.floor((tmp-2001)/4)   
          +madd[TheDate.getMonth()]   
          +TheDate.getDate()   
          -23;   
      if   (TheDate.getYear()%4==0&&TheDate.getMonth()>1)   
          total++;   
      for(m=0;;m++)   
      {       
          k=(CalendarData[m]<0xfff)?11:12;   
          for(n=k;n>=0;n--)   
          {   
              if(total<=29+GetBit(CalendarData[m],n))   
              {     
                  isEnd=true;   
                  break;   
              }   
              total=total-29-GetBit(CalendarData[m],n);   
          }   
          if(isEnd)break;   
      }   
      cYear=2001   +   m;   
      cMonth=k-n+1;   
      cDay=total;   
      if(k==12)   
      {   
          if(cMonth==Math.floor(CalendarData[m]/0x10000)+1)   
              cMonth=1-cMonth;   
          if(cMonth>Math.floor(CalendarData[m]/0x10000)+1)   
              cMonth--;   
      }   
      cHour=Math.floor((TheDate.getHours()+3)/2);   
  }   
    
  function   GetcDateString()   
  {   var   tmp="";   
      tmp+=tgString.charAt((cYear-4)%10);       //年干   
      tmp+=dzString.charAt((cYear-4)%12);       //年支   
      tmp+="年(";   
      tmp+=sx.charAt((cYear-4)%12);   
      tmp+=")";   
      if(cMonth<1)   
      {     
        tmp+="闰";   
          tmp+=monString[-(cMonth+1)];		
//          tmp+=monString.charAt(-cMonth-1);   
      }   
      else   
          tmp+=monString[cMonth-1];   
//          tmp+=monString.charAt(cMonth-1);   
      tmp+="月";   
      tmp+=(cDay<11)?"初":((cDay<20)?"十":((cDay<30)?"廿":"卅"));   
      if(cDay%10!=0||cDay==10)   
          tmp+=numString.charAt((cDay-1)%10);   
//      if(cHour==13)tmp+="夜";   
//          tmp+=dzString.charAt((cHour-1)%12);   
//      tmp+="时";   
      cDateString=tmp;   
      return   tmp;   
  }   
    
  function   GetDateString()   
  {     
      var   tmp="";   
      var   t1=TheDate.getYear();   
      if   (t1<1900)t1+=1900;   
      tmp+=t1   
                +"-"   
                +(TheDate.getMonth()+1)+"-"   
                +TheDate.getDate()+""   
                +"<font color=#ff0000> 星期"+weekString.charAt(TheDate.getDay())+"</font>";     
      DateString=tmp;   
      return   tmp;   
  }   
    
  init();   
  e2c();   
  GetDateString();   
  GetcDateString();   
  //document.write(DateString,"<br>",cDateString);

function CAL(){ 

document.write(" <b><font color=#008040>"+DateString+"</font></b> <font color=#9B4E00>"+cDateString+"</font> "); 
//document.write(bsWeek+"a "+dayiy); 
//document.write(bsWeek+" "+"<font color=#9B4E00>"); 
//document.write(bsYear+""+bsYear2+""); 
} 


function loginformsubmit()
{
	if (loginformcheck())
	{
		document.loginform.submit();
	}
}

function loginformcheck()
{
	var tusername_value=loginform.tusername.value;
	if (tusername_value=="" || tusername_value.length<1)
	{
		alert('您必须提供有效的用户名！');
		loginform.tusername.focus();
		return false;
	}

	var tpassword_value=loginform.tpassword.value;
	if (tpassword_value=="" || tpassword_value.length<1)
	{
		alert('您必须提供有效的密码！');
		loginform.tpassword.focus();
		return false;
	}
	return true;
}

function getpassword()
{
	var tusername_value=document.loginform.tusername.value;
	if (tusername_value=="" || tusername_value.length<1)
	{
		alert('您必须提供有效的用户名！');
		document.loginform.tusername.focus();
		location = "#";		
		return true;
	}
	else
	{
		location = "http://webmail.shantou.gov.cn/config/forgotPW.jsp?name=" + tusername_value;
		return true;		
	}
}

//网站导航
function wzdh()
{
	width=570;
	height=440;
	xposition = 0;
	yposition = 0;
	if ((parseInt(navigator.appVersion) >= 4 ))
	{
		xposition = (screen.width - width) / 2;
		yposition = (screen.height - height) / 2;
	} 
	theproperty= "width=" + width + ", height=" + height + ", location=0,menubar=0,resizable=1,scrollbars=1,status=0,titlebar=0,toolbar=0,hotkeys=0,screenx=" + xposition + "," + "screeny=" + yposition + "," + "left=" + xposition + "," + "top=" + yposition;
	nw=window.open("http://www.shantou.gov.cn/fwdt/wzdh.asp","wzdh",theproperty);
}	

//服务导航
function wzdh1()
{
	width=570;
	height=440;
	xposition = 0;
	yposition = 0;
	if ((parseInt(navigator.appVersion) >= 4 ))
	{
		xposition = (screen.width - width) / 2;
		yposition = (screen.height - height) / 2;
	} 
	theproperty= "width=" + width + ", height=" + height + ", location=0,menubar=0,resizable=1,scrollbars=1,status=0,titlebar=0,toolbar=0,hotkeys=0,screenx=" + xposition + "," + "screeny=" + yposition + "," + "left=" + xposition + "," + "top=" + yposition;
	nw=window.open("/fwdt/wzdh1.asp","fwdh",theproperty);
}	