function keycheck(keyValue,keyName,windowName){
    if(keyValue.replace(/ | /g,"") == ''||keyValue.replace(/ | /g,"") == '请输入关键字')
      {
       alert("请输入查询条件");
	   keyName.focus();
       return false;
      }
     var searchStr = keyValue.replace(/ | /g,"");
           for(var i=0; i<searchStr.length; i++)
             {
              if(searchStr.charCodeAt(i)<128)
                {
                   if(searchStr.charAt(i).search(/[A-Za-z0-9]/) == -1)
                   {
                     alert('对不起,您输入的内容有误!\r\n\n关键字只能为中英文或数字');
					 keyName.focus();
                     return false;
                    }
                }
             }
	keyValue=keyValue.replace(/ | /g,"");		 
    keyValue=keyValue.toUpperCase();
	if(windowName!="self")
	    window.open('',windowName,'scrollbars=yes,width=670,height=480');

}

function newscheck(){
   if(searchStr.charAt(i).search(/[A-Za-z0-9]/) == -1)
   {
     alert('对不起,选择时间范围不正确');
     return false;
    }
}
 
function closeCurWin()
      {
      window.close();
      }   
	  
function chngPage2(newPage)
         {     
        document.forms("more").curPage.value = newPage;
        document.forms("more").submit();
         }

function jumpPage2(newPage,curPage,totalPages)
         {
	     if(newPage == curPage || newPage < 1 || newPage > totalPages || newPage.search(/^[0-9]+$/) == -1)
           {
		    alert("Error!");
		    return false;
		   }
         }     

function showItem(id)
     {
 window.open('show.php?id='+id,'_blank','menubar=0,width=720,height=500,scrollbars=1');
     }

window.onerror=new Function("return true;");


function check_form()
    {
	  
     if (document.form1.from_name.value.replace(/| /g,"") == '')
		  {
		    window.alert("请填写'您的姓名'！");
		    document.form1.from_name.focus();
		    return false;
		  }    
     if (document.form1.from_email.value.replace(/| /g,"") == '')
		  {
		    window.alert("请填写'您的邮箱'！");
		    document.form1.from_email.focus();
		    return false;
		  } 
    if (isEmail(document.form1.from_email.value)==false)
		 {
		  alert("请正确填写您的邮箱地址！");
		  document.form1.from_email.focus();
		  return false;
		 }
 
 if (document.form1.subject.value.replace(/| /g,"") == '')
		  {
		    window.alert("请填写'主题'！");
		    document.form1.subject.focus();
		    return false;
		  } 
  if (document.form1.mail_body.value.replace(/| /g,"") == '')
		  {
		    window.alert("请填写'内容'！");
		    document.form1.mail_body.focus();
		    return false;
		  } 
   

    }
	
	
	function isEmail(string)
{
if (string.search(/^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/) != -1)
return true;
else
return false;
}

function CaricaFoto(img){
  foto1= new Image();
  foto1.src=(img);
  Controlla(img);
}
function Controlla(img){
  if((foto1.width!=0)&&(foto1.height!=0)){
    viewFoto(img);
  }
  else{
    funzione="Controlla('"+img+"')";
    intervallo=setTimeout(funzione,20);
  }
}
function viewFoto(img){
  largh=foto1.width+20;
  altez=foto1.height+20;
  stringa="width="+largh+",height="+altez;
  finestra=window.open(img,"",stringa);
}


function IsDate(DateString , Dilimeter) 
{ 
  if (DateString==null) return false; 
  if (Dilimeter=='' || Dilimeter==null) 
   Dilimeter = '-'; 
  var tempy=''; 
  var tempm=''; 
  var tempd=''; 
  var tempArray; 
  if (DateString.length<8 && DateString.length>10) 
    return false;    
  tempArray = DateString.split(Dilimeter); 
  if (tempArray.length!=3) 
   return false; 
  if (tempArray[0].length==4) 
  { 
   tempy = tempArray[0]; 
   tempd = tempArray[2]; 
  } 
  else 
  { 
   tempy = tempArray[2]; 
   tempd = tempArray[1]; 
  } 
  tempm = tempArray[1]; 
  var tDateString = tempy + '/'+tempm + '/'+tempd+' 8:0:0';//加八小时是因为我们处于东八区 
  var tempDate = new Date(tDateString); 
  if (isNaN(tempDate)) 
   return false; 
 if (((tempDate.getUTCFullYear()).toString()==tempy) && (tempDate.getMonth()==parseInt(tempm)-1) && (tempDate.getDate()==parseInt(tempd))) 
  { 
   return true; 
  } 
  else 
  { 
   return false; 
  } 
} 
