
function scrollit_r2l(seed)
{ var m1  = "欢迎来到宣城市政务服务中心" ;
 var m2  = "" ;
       var msg=m1+m2;
       var out = " ";
       var c = 1;
 var speed  = 100
if (seed > 100)
{                seed-=2;
                var cmd="scrollit_r2l(" + seed + ")";
             timerTwo=window.setTimeout(cmd,speed);}
    else if (seed <= 100 && seed > 0)
     {                for (c=0 ; c < seed ; c++)
                      {       out+=" ";}
       out+=msg;         seed-=2;
   var cmd="scrollit_r2l(" + seed + ")";
   window.status=out;
 timerTwo=window.setTimeout(cmd,speed); }
      else if (seed <= 0)
{                if (-seed < msg.length)
                  {
                       out+=msg.substring(-seed,msg.length);
                       seed-=2;
                       var cmd="scrollit_r2l(" + seed + ")";
                       window.status=out;
       timerTwo=window.setTimeout(cmd,speed);}
       else {               window.status=" ";
                 timerTwo=window.setTimeout("scrollit_r2l(100)",speed);
}
}
}
scrollit_r2l(100);
// -- End of JavaScript code -->

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.0
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && document.getElementById) x=document.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function mOvr(src,clrOver){ 
	if (!src.contains(event.fromElement)) { 
		src.style.cursor = 'hand'; 
		src.bgColor = clrOver; 
	}
}
function mOut(src,clrIn)  { 
	if (!src.contains(event.toElement)) { 
		src.style.cursor = 'default'; 
		src.bgColor = clrIn; 
	}
} 
function TBOvr(src,clrOver){ 
		src.bgColor = clrOver; 
}
function TBOut(src,clrIn)  { 
		src.bgColor = clrIn; 
} 
function mClk(URL) { 
		window.location.href=URL
	 }

function mClkTag(URL,TAR) { 
                window.open(URL,TAR)
	 }
	 
function CheckNew(theForm,URL,Tag) {
  if (!CheckTextInput(theForm))
      return false;
  theForm.action = URL;
  theForm.target = Tag;
  theForm.submit();
}

function CheckNewzdy(theForm,URL,Tag) {
  theForm.action = URL;
  theForm.target = Tag;
  if(theForm.onsubmit())
  {
    theForm.submit();
   }
}	 	 

function CheckDelete(theForm,URL,Tag) {
	var j;
	j = 0;
	for(var i=0;i<theForm.length;i++)
	{
		if((theForm.elements[i].type=="checkbox")&&(theForm.elements[i].name=="checkdel")) 
		  if (theForm.elements[i].checked == true)
				j = j + 1;
	}
	if (j == 0) {
		alert("必须选择一项进行删除！");
    return false;
  }
  else {
    	if(confirm("所选记录将被删除，你确定吗？")) {
		theForm.action = URL;
		theForm.target = Tag;		
		theForm.submit();
	}
  }
}

function CheckPerson(theForm,URL,Tag) {
	var j;
	j = 0;
	for(var i=0;i<theForm.length;i++)
	{
		if((theForm.elements[i].type=="checkbox")&&(theForm.elements[i].name=="checkdel")) 
		  if (theForm.elements[i].checked == true)
				j = j + 1;
	}
	if (j == 0) {
		alert("必须选择一名职工进行调动！");
    return false;
  }
  else {
	theForm.action = URL;
	theForm.target = Tag;		
	theForm.submit();
  }
}

function Checkpostzdy(theForm,URL,Tag) {
	var j;
	j = 0;
	for(var i=0;i<theForm.length;i++)
	{
		if((theForm.elements[i].type=="checkbox")&&(theForm.elements[i].name=="checkdel")) 
		  if (theForm.elements[i].checked == true)
				j = j + 1;
	}
	if (j == 0) {
		alert("必须选择一项进行保存！");
    return false;
  }
  else {
    	
		theForm.action = URL;
		theForm.target = Tag;		
		theForm.submit();
	
  }
}

function CheckPrint(theForm,URL,Tag) {
  saction = theForm.action
  starget = theForm.target
  theForm.action = URL;
  theForm.target = Tag;
  theForm.submit();
  theForm.action = saction
  theForm.target = starget
}

function print() {
	WebBrowser1.ExecWB(6,1);
}

function CheckModify(theForm,URL,Tag) {
	var j;
	j = 0;
	for(var i=0;i<theForm.length;i++)
	{
		if((theForm.elements[i].type=="checkbox")&&(theForm.elements[i].name=="checkdel")) 
		  if (theForm.elements[i].checked == true)
				j = j + 1;
	}
	if (j == 0) {
		alert("必须选择一项进行修改！");
    return false;
  }
  else if ( j > 1) {
		alert("修改时选择的项目不能多于一条！");
    return false;
  }
  else {
		theForm.action = URL;
		theForm.target = Tag;
		theForm.submit();
  }
}

function selectallbox(theForm) { 
	xx = theForm.checkall.checked
	for(var i=0;i<theForm.length;i++)
	{
		if((theForm.elements[i].type=="checkbox")&&(theForm.elements[i].name=="checkdel"))
			theForm.elements[i].checked=xx;
	}
}

function checkdatebak(theInput)
{
  var vDate,vYear,vMonth,vDay;
  vDate = theInput.value;
  vYear = vDate.substring(0,4);
  if (vDate.length > 10)
  {
    window.alert("您输入的日期有误，请以YYYY-MM-DD格式输入！");
    if (theInput.type != "hidden")
      theInput.focus();
    return false;
  }
  if (isNaN(vYear) || vYear < 1900)
  {
    window.alert("您输入的年份有误，请以YYYY-MM-DD格式输入！");
    if (theInput.type != "hidden")    
      theInput.focus();
    return false;
  }
  vMonth = vDate.substring(5,7);
  if (isNaN(vMonth) || vMonth < 01 || vMonth > 12)
  {
    window.alert("您输入的月份有误，请以YYYY-MM-DD格式输入！");
    if (theInput.type != "hidden")    
      theInput.focus();
    return false;
  }
  vDay = vDate.substring(8,10);
  if (isNaN(vDay) || vDay == "" || vDay.length != 2 || vDay < 01 || vDay > 31)
  {
    window.alert("您输入的日期有误，请以YYYY-MM-DD格式输入！");
    if (theInput.type != "hidden")    
      theInput.focus();
    return false;
  }
  if (vMonth == 04 || vMonth == 06 || vMonth == 09 || vMonth == 11)
  {
    if (vDay > 30)
    {
      window.alert("您输入的日期有误，请以YYYY-MM-DD格式输入！");
      if (theInput.type != "hidden")      
        theInput.focus();        
      return false;
    }
  }
  if (vMonth == 02)
  {
    if (vYear % 4 == 0 && vYear % 100 || vYear % 400 == 0)
    {
      if (vDay > 29)
      {
        window.alert("您输入的日期有误，请以YYYY-MM-DD格式输入！");
        if (theInput.type != "hidden")        
          theInput.focus();
        return false;
      }
    }
    else
    {
      if (vDay > 28)
      {
        window.alert("您输入的日期有误，请以YYYY-MM-DD格式输入！");
        if (theInput.type != "hidden")        
          theInput.focus();
        return false;
      }
    }
  }
  if (vDate.substring(4,5) != "-" || vDate.substring(7,8) != "-")
  {
    window.alert("您的输入有误，请以YYYY-MM-DD格式输入！");
    if (theInput.type != "hidden")    
      theInput.focus();
    return false;
  }
  return true;
}

function checkdate(theInput)
{
  var vDate,vYear,vMonth,vDay;
  vDate = theInput.value;
  vYear = vDate.substring(0,4);
  if (vDate.length > 8)
  {
    window.alert("您输入的日期有误，请以YYYYMMDD格式输入！");
    if (theInput.type != "hidden")
      theInput.focus();
    return false;
  }
  if (isNaN(vYear) || vYear < 1900)
  {
    window.alert("您输入的年份有误，请以YYYYMMDD格式输入！");
    if (theInput.type != "hidden")    
      theInput.focus();
    return false;
  }
  vMonth = vDate.substring(4,6);
  if (isNaN(vMonth) || vMonth < 01 || vMonth > 12)
  {
    window.alert("您输入的月份有误，请以YYYYMMDD格式输入！");
    if (theInput.type != "hidden")    
      theInput.focus();
    return false;
  }
  vDay = vDate.substring(6,8);
  if (isNaN(vDay) || vDay == "" || vDay.length != 2 || vDay < 01 || vDay > 31)
  {
    window.alert("您输入的日期有误，请以YYYYMMDD格式输入！");
    if (theInput.type != "hidden")    
      theInput.focus();
    return false;
  }
  if (vMonth == 04 || vMonth == 06 || vMonth == 09 || vMonth == 11)
  {
    if (vDay > 30)
    {
      window.alert("您输入的日期有误，请以YYYYMMDD格式输入！");
      if (theInput.type != "hidden")      
        theInput.focus();        
      return false;
    }
  }
  if (vMonth == 02)
  {
    if (vYear % 4 == 0 && vYear % 100 || vYear % 400 == 0)
    {
      if (vDay > 29)
      {
        window.alert("您输入的日期有误，请以YYYYMMDD格式输入！");
        if (theInput.type != "hidden")        
          theInput.focus();
        return false;
      }
    }
    else
    {
      if (vDay > 28)
      {
        window.alert("您输入的日期有误，请以YYYYMMDD格式输入！");
        if (theInput.type != "hidden")        
          theInput.focus();
        return false;
      }
    }
  }
  return true;
}

function check_number(theInput) {
  var length = theInput.value.length;
  if(theInput.value == "") 
  {
    alert("数值位不可为空！"); 
    if (theInput.type != "hidden")    
      theInput.focus();
    return false
  }
  else 
  {
    for(var i=0; i < length; i++) 
    {
      var nu = theInput.value.charAt(i);
      if((nu >= '0' && nu <= '9') || nu == '.') 
      {
        continue;
      }
      else 
      {
        alert("只能输入数字，请按“确定”返回重新修改.");
        if (theInput.type != "hidden")        
          theInput.focus()
	return false;
      }
    }
    return true;
  }
}

function CheckTextInput(theForm) {
  var Letters = "~`!@#$%^&*_+=;:'\"<>,?"
  for(var i=0;i<theForm.length;i++)
  {    
    if(((theForm.elements[i].type=="text")||(theForm.elements[i].type=="textarea"))&&(theForm.elements[i].name!="#")&&(theForm.elements[i].value!="")&&(theForm.elements[i].readOnly != true))
    {
      var length = theForm.elements[i].value.length;  	
      for (j=0; j < length; j++)    
      {
         var CheckChar = theForm.elements[i].value.charAt(j);
         CheckChar = CheckChar.toUpperCase();
         if (Letters.indexOf(CheckChar) != -1)
         {
	    //alert ("输入框中有非法字符！");
            alert ("输入框中不能有非法字符如：\n"+Letters);
	    theForm.elements[i].focus();
            return false;
          }				
       }
    }
  }
  return true
}
function CheckForm(thisForm)
  {
    if(!CheckTextInput(thisForm))
      return false;
  }

function QuickGet(theField,sSelect){
  sTmp = "../hwbrows.asp?class=" + sSelect
  aaa = window.showModalDialog(sTmp,null,"scrollbars:auto;status:no;center:yes;help:no;minimize:no;maximize:no;border:no;statusbar:auto;dialogWidth:600px;dialogHeight:300px");
  if (aaa != null)
    theField.value = aaa
}

function QuickGetY_W(theField,sSelect){
  sTmp = "../../hwbrows.asp?class=" + sSelect
  aaa = window.showModalDialog(sTmp,null,"scrollbars:auto;status:no;center:yes;help:no;minimize:no;maximize:no;border:no;statusbar:auto;dialogWidth:600px;dialogHeight:300px");
  if (aaa != null)
    theField.value = aaa
}

function QuickGetHY(theField,sSelect){
  sTmp = "../hybrows.asp?class=" + sSelect
  aaa = window.showModalDialog(sTmp,null,"scrollbars:auto;status:no;center:yes;help:no;minimize:no;maximize:no;border:no;statusbar:auto;dialogWidth:600px;dialogHeight:300px");
  if (aaa != null)
    theField.value = aaa
}

function QuickGetH_Y(theField,sSelect){
  sTmp = "../../hybrows.asp?class=" + sSelect
  aaa = window.showModalDialog(sTmp,null,"scrollbars:auto;status:no;center:yes;help:no;minimize:no;maximize:no;border:no;statusbar:auto;dialogWidth:600px;dialogHeight:300px");
  if (aaa != null)
    theField.value = aaa
}

function QuickGetCJ(theField,sSelect){
  sTmp = "../CJbrows.asp?class=" + sSelect
  aaa = window.showModalDialog(sTmp,null,"scrollbars:auto;status:no;center:yes;help:no;minimize:no;maximize:no;border:no;statusbar:auto;dialogWidth:600px;dialogHeight:300px");
  if (aaa != null)
    theField.value = aaa
}

function QuickGetC_J(theField,sSelect){
  sTmp = "../../CJbrows.asp?class=" + sSelect
  aaa = window.showModalDialog(sTmp,null,"scrollbars:auto;status:no;center:yes;help:no;minimize:no;maximize:no;border:no;statusbar:auto;dialogWidth:600px;dialogHeight:300px");
  if (aaa != null)
    theField.value = aaa
}

function QuickGetZD(theField,sSelect){
  sTmp = "../ZDbrows.asp?class=" + sSelect
  aaa = window.showModalDialog(sTmp,null,"scrollbars:auto;status:no;center:yes;help:no;minimize:no;maximize:no;border:no;statusbar:auto;dialogWidth:600px;dialogHeight:300px");
  if (aaa != null)
    theField.value = aaa
}

function QuickGetZ_D(theField,sSelect){
  sTmp = "../../ZDbrows.asp?class=" + sSelect
  aaa = window.showModalDialog(sTmp,null,"scrollbars:auto;status:no;center:yes;help:no;minimize:no;maximize:no;border:no;statusbar:auto;dialogWidth:600px;dialogHeight:300px");
  if (aaa != null)
    theField.value = aaa
}

function QuickGetGG(theField,sSelect){
  sTmp = "../GGbrows.asp?class=" + sSelect
  aaa = window.showModalDialog(sTmp,null,"scrollbars:auto;status:no;center:yes;help:no;minimize:no;maximize:no;border:no;statusbar:auto;dialogWidth:600px;dialogHeight:300px");
  if (aaa != null)
    theField.value = aaa
}

function QuickGetG_G(theField,sSelect){
  sTmp = "../../GGbrows.asp?class=" + sSelect
  aaa = window.showModalDialog(sTmp,null,"scrollbars:auto;status:no;center:yes;help:no;minimize:no;maximize:no;border:no;statusbar:auto;dialogWidth:600px;dialogHeight:300px");
  if (aaa != null)
    theField.value = aaa
}

function QuickAddr(theField){
  sTmp = "/func/QuickAddr.asp"
  aaa = window.showModalDialog(sTmp,null,"scrollbars:auto;status:no;center:yes;help:no;minimize:no;maximize:no;border:no;statusbar:auto;dialogWidth:200px;dialogHeight:400px");
  if (aaa != null)
    theField.value = aaa
}	

function QuickGroup(theField){
  sTmp = "/func/QuickGroup.asp"
  aaa = window.showModalDialog(sTmp,null,"scrollbars:auto;status:no;center:yes;help:no;minimize:no;maximize:no;border:no;statusbar:auto;dialogWidth:200px;dialogHeight:400px");
  if (aaa != null)
    theField.value = aaa
}


function GoURL(URL)
{
  window.location=URL;
}


function Del(theForm,URL,Tag)
{
	var j;
	j = 0;
	for(var i=0;i<theForm.length;i++)	
	{
		if((theForm.elements[i].type=="checkbox")&&(theForm.elements[i].name=="checkdel")) 
		  if (theForm.elements[i].checked == true)
				j = j + 1;
	}
       if (j == 0) 
	 {
	  alert("必须选择一项进行删除！");
          return false;
         }
       else       
        {
    	 if(confirm("所选记录将被删除，你确定吗？"))
    	  {
    	   var str=new Array()	
    	   m=0
    	   for(var i=0;i<theForm.length;i++)
           {
	        if((theForm.elements[i].type=="checkbox")&&(theForm.elements[i].name=="checkdel")) 
	         if (theForm.elements[i].checked == true)
	         {
   	          theForm.action = URL+"?value="+theForm.elements[i].value;
		  theForm.target = Tag;		
		  theForm.submit();
	         }
	    }
         }
       }
}


function rep(theForm,URL,Tag) {

	var j;
	j = 0;
	for(var i=0;i<theForm.length;i++)
	{
		if((theForm.elements[i].type=="checkbox")&&(theForm.elements[i].name=="checkdel")) 
		  if (theForm.elements[i].checked == true)
				j = j + 1;
	}
       if (j == 0) 
	 {
	  alert("必须选择一项进行修改！");
          return false;
         }
       else 
       {
        if (j >1)   
           {
	        alert("必须选择一项进行修改！");
                return false;
           }
        else           
           {
    	              for(var i=0;i<theForm.length;i++)
                        {
	                  if((theForm.elements[i].type=="checkbox")&&(theForm.elements[i].name=="checkdel")) 
	                     if (theForm.elements[i].checked == true)
	                        {
	                                theForm.action = URL+"?value="+theForm.elements[i].value;
	                                //theForm.target = Tag;		
	                                theForm.submit();
	                        }
	                }
                
          }  
       }
}



function brows(theForm,URL,Tag) {
	var j;
	j = 0;
	for(var i=0;i<theForm.length;i++)
	{
		if((theForm.elements[i].type=="botton")&&(theForm.elements[i].name=="brows")) 
		  if (theForm.elements[i].checked == true)
				j = j + 1;
	}
       if (j == 0) 
	 {
	  alert("必须选择一项进行修改！");
          return false;
         }
       else 
       {
        if (j >1)   
           {
	        alert("必须选择一项进行修改！");
                return false;
           }
        else           
           {
    	              for(var i=0;i<theForm.length;i++)
                        {
	                  if((theForm.elements[i].type=="botton")&&(theForm.elements[i].name=="brows")) 
	                     if (theForm.elements[i].checked == true)
	                        {
	                                theForm.action = URL+"?value="+theForm.elements[i].value;
	                                //theForm.target = Tag;		
	                                theForm.submit();
	                        }
	                }
                
          }  
       }
}


function ShouQuan(theForm,URL,Tag)
{
	var j;
	j = 0;
	for(var i=0;i<theForm.length;i++)	
	{
		if((theForm.elements[i].type=="checkbox")&&(theForm.elements[i].name=="checkdel")) 
		  if (theForm.elements[i].checked == true)
				j = j + 1;
	}
       if (j == 0) 
	 {
	  alert("必须选择一项进行删除！");
          return false;
         }
       else       
        {
    	 if(confirm("所选记录将被删除，你确定吗？"))
    	  {
    	   var str=new Array()	
    	   m=0
    	   for(var i=0;i<theForm.length;i++)
           {
	        if((theForm.elements[i].type=="checkbox")&&(theForm.elements[i].name=="checkdel")) 
	         if (theForm.elements[i].checked == true)
	         {
   	          theForm.action = URL+"?value="+theForm.elements[i].value;
		  theForm.target = Tag;		
		  theForm.submit();
	         }
	    }
         }
       }
}
 function fPopUpCalendarDlg(ctrlobj)  //日期速查
{
	showx = event.screenX - event.offsetX - 4 ; // + deltaX;
	showy = event.screenY - event.offsetY + 18; // + deltaY;
	newWINwidth = 210 + 4 + 18;

	retval = window.showModalDialog("/js/CalendarDlg.htm", "", "dialogWidth:197px; dialogHeight:210px; dialogLeft:"+showx+"px; dialogTop:"+showy+"px; status:no; directories:yes;scrollbars:no;Resizable=no; "  );
	if( retval != null ){
		ctrlobj.value = retval;
	}else{
		//alert("canceled");
	}
	ctrlobj.blur();
}  
