// JavaScript Document
//====初始化一下====
init();
function form_submit(id,delid)
 {var str="";
   if(id==0)
   { //====n等于1表示可以增加
     if(formcheck())
     {document.theform.action="order.asp?flag_save=1";
      document.theform.method="post";
      document.theform.submit();
    }
  }
}
//======改变产品信息======
function change_cpinfo(sel_obj,str_cpdm)
{sel_obj.length=0;
for (var i=0;i<array_cp_info.length;i++)
 {
if(i==0)
   sel_obj.options[sel_obj.options.length]=new Option("--请选择产品型号--","",true,true);
 if(array_cp_info[i][0]==str_cpdm){
       var the_option= new Option(array_cp_info[i][1],array_cp_info[i][1],true,true);
       sel_obj.options[sel_obj.options.length]=the_option   
           }
  }
sel_obj.selectedIndex=0;
}
//判断表单的数据是否有效
  function formcheck() 
    {if(trim(document.theform.xm.value) == "") 
         {alert("请输入姓名！");
		   document.theform.xm.focus();
		   document.theform.xm.select(); 
           return false;
         }
    else if(trim(document.theform.lxdh.value) == "") 
         {alert("请输入联系电话！");
		   document.theform.lxdh.focus();
		   document.theform.lxdh.select(); 
           return false;
         }
    else if(!isValidEmail(trim(document.theform.email.value))) 
         {alert("请输入正确的email地址！");
		   document.theform.email.focus();
		   document.theform.email.select(); 
           return false;
         }

    else if(trim(document.theform.dz.value) == "") 
         {alert("请输入联系地址！");
		   document.theform.dz.focus();
		   document.theform.dz.select(); 
           return false;
         }
  else if(trim(document.theform.cp.value) == "") 
         {alert("请填写订购产品！");
		   document.theform.cp.focus();
           return false;
         }
  //else if(trim(document.theform.wpmc.value) == "") 
//         {alert("请选择产品型号！");
//		   document.theform.wpmc.focus();
//           return false;
//         }
else if(trim(document.theform.sgdd.value) == "") 
         {alert("请输入设备使用地点！");
		   document.theform.sgdd.focus();
		   document.theform.sgdd.select(); 
           return false;
         }
    return true;      
}
