String.prototype.trim=function (){return this.replace(/[\xa0]/gi, "");}

/**-???????????*/
function chkdate(datestr) {
 var lthdatestr
 if (datestr !="" )
 lthdatestr= datestr.length ;
 else
 lthdatestr=0;
 var tmpy="";
 var tmpm="";
 var tmpd="";
 //var datestr;
 var status;
 status=0;
 if ( lthdatestr== 0)
 return 0;
 for (i=0;i<lthdatestr;i++) {
 if (datestr.charAt(i)== '-') {
 status++;
 }
 if (status>2) {
 return 0;
 }
 if ((status==0) && (datestr.charAt(i)!='-')) {
 tmpy=tmpy+datestr.charAt(i)
 }
 if ((status==1) && (datestr.charAt(i)!='-')) {
 tmpm=tmpm+datestr.charAt(i)
 }
 if ((status==2) && (datestr.charAt(i)!='-')) {
 tmpd=tmpd+datestr.charAt(i)
 }
 }
 year=new String (tmpy);
 month=new String (tmpm);
 day=new String (tmpd);
 if ((tmpy.length!=4) || (tmpm.length>2) || (tmpd.length>2)) {
 return 0;
 }
 if (!((1<=month) && (12>=month) && (31>=day) && (1<=day)) ) {
 return 0;
 }
 if (!((year % 4)==0) && (month==2) && (day==29)) {
 return 0;
 }
 if ((month<=7) && ((month % 2)==0) && (day>=31)) {
 return 0;
 }
 if ((month>=8) && ((month % 2)==1) && (day>=31)) {
 return 0;
 }
 if ((month==2) && (day==30)) {
 return 0;
 }
 return 1;
}
//---????-????
function save(){
	if(document.form.REALNAME.value=="")
  	{
  		alert(document.all("REALNAME_iserr").value);
       	document.form.REALNAME.focus();
    	return false;
  	}
  	if(document.form.CERTINUM.value=="")
  	{
  		alert(document.all("CERTINUM_ISERR").value);
       	document.form.CERTINUM.focus();
    	return false;
  	}
  	if(document.form.FIXTEL.value=="")
  	{
  		alert(document.all("FIXTEL_ISERR").value);
       	document.form.FIXTEL.focus();
    	return false;
  	}
  	if(document.form.EMAIL.value=="")
  	{
  		alert(document.all("EMAIL_ISERR").value);
       	document.form.EMAIL.focus();
    	return false;
  	}
  	if(document.form.PARTIADDRE.value=="")
  	{
  		alert(document.all("PARTIADDRES_ISERR").value);
       	document.form.PARTIADDRE.focus();
    	return false;
  	}
  	document.all("form").submit();
  	document.all("form").action="addCustomer";
}


//----????----
function save_intro()
  {
      if(document.all("SHOPNAME").value=="")
      {
        alert(document.all("SHOPNAME_ERR").value);
        document.summary.SHOPNAME.focus();
        return;
      }
      if(document.all("CATCHWORD").value=="")
      {
        alert(document.all("CATCHWORD_ERR").value);
        document.summary.CATCHWORD.focus();
        return;
      }
      if(document.all("SHOCARNUM").value=="")
      {
        alert(document.all("SHOCARNUM_ERR").value);
        document.summary.SHOCARNUM.focus();
        return;
      }
      if(document.all("ENTERRESUM").value=="")
      {
        alert(document.all("ENTERRESUM_ERR").value);
        document.summary.ENTERRESUM.focus();
        return;
      }      
      document.all("summary").encoding="application/x-www-form-urlencoded";
      document.all("summary").submit();
      document.all("summary").action="addIntro";
      
  }
//---upload photo---
function upload_photo(){	
	
	if(document.all("LOGPICURL").value=="")
      {
        alert(document.all("LOGPICURL_ERR").value);
        return;
      }                
      document.all("honor").submit();
  	  document.all("honor").action="uploadphoto";  	  
}
//---upload sign photo---
function uploadsign_photo(){	
	var fileext=honor.LOGPICURL.value.substring(honor.LOGPICURL.value.length-4,honor.LOGPICURL.value.length);
 	fileext=fileext.toLowerCase();
 	
	if(document.all("LOGPICURL").value=="")
      {
        alert(document.all("LOGPICURL_ERR").value);
        return;
      }                      
    if ( (fileext!="") && (fileext!=".jpg") && (fileext!=".gif") &&   (fileext!=".bmp") && (fileext!=".png"))
	{
	 alert(document.all("photo_err_type").value);	
	 return;
	}
      document.all("honor").submit();
  	  document.all("honor").action="uploadphoto";  	  
}
//----save affiche---
function save_affiche()
  {
      if(document.all("BULLETOPIC").value=="")
      {
        alert(document.all("BULLETOPIC_ERR").value);
        document.form.BULLETOPIC.focus();
        return;
      }
      if(document.all("BULLECONTEN").value=="")
      {
        alert(document.all("BULLECONTEN_ERR").value);
        document.form.BULLECONTEN.focus();
        return;
      }      
      document.all("form").action="addaffiche";
      document.all("form").submit();
  }
//---save welcome---
function save_welcome()
  {
      if(document.all("WELCOTOPIC").value=="")
      {
        alert(document.all("WELCOTOPIC_ERR").value);
        document.form.WELCOTOPIC.focus();
        return;
      }
      if(document.all("WELCOCONTENT").value=="")
      {
        alert(document.all("WELCOCONTENT_ERR").value);
        document.form.WELCOCONTENT.focus();
        return;
      }      
      document.all("form").action="addwelcome";
      document.all("form").submit();
  }
//*----upload honor photo
function upload_honor_photo(){
	
	if(document.all("HONCERURL").value=="")
      {
        alert(document.all("HONCERURL_ERR").value);
        return;
      }
      document.all("honor").submit();
      document.all("honor").action="uploadphoto";
  	  
}

//----photo view------
function photo_view(url){
	
	var ph="../uploadfile/"+url	
	//parent.document.images['proimg'].src='img/bb.gif';
	document.all("url").src=ph;
}

//------del photo
function del_honor_photo(id,userID){
	if(confirm(document.all("DELETE").value))
     location.href="addIntro?id="+id+"&userID="+userID
}
//----save goods----
function save_goods(){
	if(document.all("goodsName").value=="")
      {
        alert(document.all("goodsName_err").value);
        document.form.goodsName.focus();
        return;
      }
      if(document.all("title").value=="")
      {
        alert(document.all("title_err").value);
        document.form.title.focus();
        return;
      }
      if(document.all("type1").value=="0")
      {
        alert(document.all("goodstype_err").value);
        document.form.type1.focus();
        return;
      }
      if(document.all("brandname").value=="")
      {
        alert(document.all("brand_err").value);
        document.form.brandname.focus();
        return;
      }
      if(document.all("markePrice").value=="")
      {
        alert(document.all("markePrice_err").value);
        document.form.markePrice.focus();
        return;
      }
      if(document.all("prefePrice").value=="")
      {
        alert(document.all("prefePrice_err").value);
        document.form.prefePrice.focus();
        return;
      }
      if(document.all("interPrice").value=="")
      {
        alert(document.all("interPrice_err").value);
        document.form.interPrice.focus();
        return;
      }
      if(document.all("currePrice").value=="")
      {
        alert(document.all("currePrice_err").value);
        document.form.currePrice.focus();
        return;
      }
      if(document.all("resume").value=="")
      {
        alert(document.all("resume_err").value);
        document.form.resume.focus();
        return;
      }
      if(document.all("photo").value!="")
      {
        alert(document.all("photo_err_addgoods").value);
        document.form.upload.focus();
        return;
      }
      
      document.all("form").encoding="application/x-www-form-urlencoded";
      document.all("form").submit();
      document.all("form").action="productServlet";

}

//---upload goods photo----
function upload_goods_photo(){	
	if(document.all("goodsName").value=="")
      {
        alert(document.all("goodsName_err").value);
        document.form.goodsName.focus();
        return;
      }
      if(document.all("title").value=="")
      {
        alert(document.all("title_err").value);
        document.form.title.focus();
        return;
      }
      if(document.all("type1").value=="0")
      {
        alert(document.all("goodstype_err").value);
        document.form.type1.focus();
        return;
      }
      if(document.all("brandname").value=="0")
      {
        alert(document.all("brand_err").value);
        document.form.brandname.focus();
        return;
      }
      if(document.all("markePrice").value=="")
      {
        alert(document.all("markePrice_err").value);
        document.form.markePrice.focus();
        return;
      }
      if(document.all("prefePrice").value=="")
      {
        alert(document.all("prefePrice_err").value);
        document.form.prefePrice.focus();
        return;
      }
      if(document.all("interPrice").value=="")
      {
        alert(document.all("interPrice_err").value);
        document.form.interPrice.focus();
        return;
      }
      if(document.all("currePrice").value=="")
      {
        alert(document.all("currePrice_err").value);
        document.form.currePrice.focus();
        return;
      }
      if(document.all("resume").value=="")
      {
        alert(document.all("resume_err").value);
        document.form.resume.focus();
        return;
      }	
	if(document.all("photo").value=="")
      {
        alert(document.all("picture_err").value);
        return;
      }        
      document.all("form").action="uploadphoto";  	        
      document.all("form").submit();  	    
}

///---save deploy---
function save_deploy(){
	
	if(document.all("CPU").value=="")
      {
        alert(document.all("CPU_ERR").value);
        document.form.CPU.focus();
        return;
      }        
      if(document.all("motheboard").value=="")
      {
        alert(document.all("motheboard_ERR").value);
        document.form.motheboard.focus();
        return;
      }  
      if(document.all("memory").value=="")
      {
        alert(document.all("memory_ERR").value);
        document.form.memory.focus();
        return;
      }  
      if(document.all("harddisk").value=="")
      {
        alert(document.all("harddisk_ERR").value);
        document.form.harddisk.focus();
        return;
      }  
      if(document.all("display").value=="")
      {
        alert(document.all("display_ERR").value);
        document.form.display.focus();
        return;
      }  
      if(document.all("displCard").value=="")
      {
        alert(document.all("displCard_ERR").value);
        document.form.displCard.focus();
        return;
      }  
      if(document.all("diskDriver").value=="")
      {
        alert(document.all("diskDriver_ERR").value);
        document.form.diskDriver.focus();
        return;
      }  
      if(document.all("keyboard").value=="")
      {
        alert(document.all("keyboard_ERR").value);
        document.form.keyboard.focus();
        return;
      }  
      if(document.all("mouse").value=="")
      {
        alert(document.all("mouse_ERR").value);
        document.form.mouse.focus();
        return;
      }  
      if(document.all("hostShell").value=="")
      {
        alert(document.all("hostShell_ERR").value);
        document.form.hostShell.focus();
        return;
      }  
      if(document.all("totalPrice").value=="")
      {
        alert(document.all("totalPrice_ERR").value);
        document.form.totalPrice.focus();
        return;
      }  
      document.all("form").action="addDeploy";  	        
      document.all("form").submit(); 
}


//-----price---
function price(object){
 var reg = /^\d+[.]?\d*$/;
   if(!reg.test(document.all(object).value)){
  	 alert(document.all("price_err").value);
     document.all(object).value="";
  	 document.all(object).focus();
   	return false;
	}
}

//-------ChoseID----
function reChoseID()
{
  var a=document.all("count").value
  var ID="";
  for(k=0;k<=a-1;k++)
  {
    if(document.all("vch"+k).checked==true)
    ID+=document.all("vch"+k).value+",";
  }
  return ID;
}
//----Chose All--
function selectChkAll()
{
  var i=document.all("count").value
  for(k=0;k<=i-1;k++)
  {
    if(document.all("checkall").checked)
    document.all("vch"+k).checked=true;
    else
    document.all("vch"+k).checked=false;
  }
}

//*----upload honor photo
function save_review(){
	
	if(document.all("topic").value=="")
      {
        alert(document.all("topic_err").value);
        document.pform.topic.focus();
        return;
      }
      if(document.all("content").value=="")
      {
        alert(document.all("content_err").value);
        document.pform.content.focus();
        return;
      }
      document.all("pform").submit();
      document.all("pform").action="addReview";
  	  
}
//--proposal
function save_proposal(){
	
	if(document.all("topic").value=="")
      {
        alert(document.all("proposal_topic_err").value);
        document.lform.topic.focus();
        return;
      }
      if(document.all("content").value=="")
      {
        alert(document.all("proposal_content_err").value);
        document.lform.content.focus();
        return;
      }
      document.all("lform").submit();
      document.all("lform").action="addProposal";  
}
//login
function Login(){
	if(document.all("loginName").value=="")
      {
        alert(document.all("login_err").value);
        document.form.loginName.focus();
        return;
      }
      if(document.all("loginPassword").value=="")
      {
        alert(document.all("password_err").value);
        document.form.loginPassword.focus();
        return;
      }
      
      document.all("form").submit();
      document.all("form").action="login";
}
//--save order
function save_neworder(){
	if(document.all("Num").value=="")
      {
        alert(document.all("Num_err").value);
        document.orderform.Num.focus();
        return;
      }
      if(document.all("LINKMAN").value=="")
      {
        alert(document.all("linkMan_err").value);
        document.orderform.LINKMAN.focus();
        return;
      }
      if(document.all("TEL").value=="")
      {
        alert(document.all("tel_err_not").value);
        document.orderform.TEL.focus();
        return;
      }
      document.all("orderform").submit();
      document.all("orderform").action="addOrder";
}

//*---save message
function save_message(){
	if(document.all("topic").value=="")
      {
        alert(document.all("message_topic_err").value);
        document.cform.topic.focus();
        return;
      }
      if(document.all("content").value=="")
      {
        alert(document.all("message_content_err").value);
        document.cform.content.focus();
        return;
      }
      document.all("cform").submit();
      document.all("cform").action="addMessage";  
}

//revert_massage
function revert_massage(){
	if(document.all("topic").value=="")
      {
        alert(document.all("message_topic_err").value);
        document.form.topic.focus();
        return;
      }
      if(document.all("content").value=="")
      {
        alert(document.all("message_content_err").value);
        document.form.content.focus();
        return;
      }
      document.all("form").submit();
      document.all("form").action="revertMessage";  
}
//--m revert_massage
function mrevert_massage(){
	if(document.all("topic").value=="")
      {
        alert(document.all("message_topic_err").value);
        document.form.topic.focus();
        return;
      }
      if(document.all("content").value=="")
      {
        alert(document.all("message_content_err").value);
        document.form.content.focus();
        return;
      }
      document.all("form").submit();
      document.all("form").action="mervertMessage";  
}

//font
function font(){
	if(fucCheckLength(document.summary.SHOPNAME.value) > 26){
   	alert(document.all("FONT_ERR").value);
   	document.summary.SHOPNAME.value="";
   	document.summary.SHOPNAME.focus();   
  }
}
function fucCheckLength(strTemp)
{
	var i,sum;
	sum=0;
	for(i=0;i<strTemp.length;i++)
	{
		if ((strTemp.charCodeAt(i)>=0) && (strTemp.charCodeAt(i)<=26))
			sum=sum+1;
		else
			sum=sum+2;
	}
	return sum;
}
//font
function font_wel(){
	if(fucCheckLength(document.form.WELCOTOPIC.value) > 20){
   	alert(document.all("FONT_ERR").value);
   	document.form.WELCOTOPIC.value="";
   	document.form.WELCOTOPIC.focus();   
  }
}
function fucCheckLength_wel(strTemp)
{
	var i,sum;
	sum=0;
	for(i=0;i<strTemp.length;i++)
	{
		if ((strTemp.charCodeAt(i)>=0) && (strTemp.charCodeAt(i)<=20))
			sum=sum+1;
		else
			sum=sum+2;
	}
	return sum;
}

//-----tonghang
function save_tonghang(){
	if(document.all("goodsName").value=="")
      {
        alert(document.all("goodsName_err").value);
        document.form.goodsName.focus();
        return;
      }
    
      if(document.all("type1").value=="")
      {
        alert(document.all("goodstype_err").value);
        document.form.type1.focus();
        return;
      }
      if(document.all("brandname").value=="0")
      {
        alert(document.all("brand_err").value);
        document.form.brandname.focus();
        return;
      }
      if(document.all("markePrice").value=="")
      {
        alert(document.all("markePrice_err").value);
        document.form.markePrice.focus();
        return;
      }
     
      if(document.all("innPri").value=="")
      {
        alert(document.all("interPrice_err").value);
        document.form.innPri.focus();
        return;
      }
     
      if(document.all("resume").value=="")
      {
        alert(document.all("resume_err").value);
        document.form.resume.focus();
        return;
      }                 
      document.all("form").submit();      
}
//save inninfo
function modify_tile(){
	if(document.all("ban").value=="")
      {
        alert(document.all("title_err").value);
        document.form.ban.focus();
        return;
      }     
      if(document.all("maiGoo").value=="")
      {
        alert(document.all("goo_err").value);
        document.form.maiGoo.focus();
        return;
      }                 
      document.all("form").submit();  
}
//save add_entchag
function add_entchag(){
	if(document.all("top").value=="")
      {
        alert(document.all("top_err").value);
        document.form.top.focus();
        return;
      }     
      if(document.all("content").value=="")
      {
        alert(document.all("cont_err").value);
        document.form.content.focus();
        return;
      }                 
      document.all("form").submit();  
}
//save domain
function savedomain(){
	var txt6=document.getElementById("domNam");
	if(txt6.value.length>16 ){
		alert(document.getElementById("httpaddress_err").value);
		document.getElementById("domNam").value="";					
		document.form.domNam.focus();
		return;
	}
	if(document.all("domNam").value=="")
      {
        alert(document.all("domain_err2").value);
        document.form.domNam.focus();
        return;
      }                 
      document.all("form").submit();  
}

//modify tonghang
function modify_tonghang(){
	if(document.all("goodsName").value=="")
      {
        alert(document.all("goodsName_err").value);
        document.form.goodsName.focus();
        return;
      }
    
      if(document.all("type1").value=="")
      {
        alert(document.all("goodstype_err").value);
        document.form.type1.focus();
        return;
      }
      if(document.all("brandID").value=="0")
      {
        alert(document.all("brand_err").value);
        document.form.brandID.focus();
        return;
      }
      if(document.all("markePrice").value=="")
      {
        alert(document.all("markePrice_err").value);
        document.form.markePrice.focus();
        return;
      }
     
      if(document.all("innPri").value=="")
      {
        alert(document.all("interPrice_err").value);
        document.form.innPri.focus();
        return;
      }
     
      if(document.all("resume").value=="")
      {
        alert(document.all("resume_err").value);
        document.form.resume.focus();
        return;
      }                 
      document.all("form").submit();      
}