var Time = new Date();
var day = Time.getDate();
var month = Time.getMonth() + 1;
String.prototype.trim = function(){
    return this.replace(/(^\s*)|(\s*$)/g,""); 
}
function check(){


	



	
	if(document.payfrom.userrealname.value==""){
		alert("请输入订花人姓名！");
		document.payfrom.userrealname.focus();
		return false;
	}
	if(document.payfrom.buymobile.value.trim()=="" && document.payfrom.buytel.value.trim()==""){
		alert("手机或固定电话必填一项！");
		document.payfrom.buymobile.focus();
		return false;
	}
	if(document.payfrom.buymobile.value.trim()!=""){
		var buymobile = document.payfrom.buymobile.value;
		//var yzmobile=/^13\d{9}|15[0,3,5,6,8,9]\d{8}$/;
		var yzmobile=/^(13|15|18)\d{9}$/;
		if(!yzmobile.test(buymobile)){
		  alert("请输入正确的11位手机号码！");
		  return false;	
		}
	}
       
	if(document.payfrom.s3.value==""){
		alert("请选择送花日期！");
		document.payfrom.s3.focus();
		return false;
	}
	if(document.payfrom.s3.value<day && document.payfrom.s2.value==month){
		alert("您选择的送花时间已过期！");
		document.payfrom.s3.focus();
		return false;
	}
	if(document.payfrom.stime.value==""){
		alert("请选择送花时段！");
		document.payfrom.stime.focus();
		return false;
	}
	if(document.payfrom.receipt.value.trim()==""){
		alert("请输入收花人姓名！");
		document.payfrom.receipt.focus();
		return false;
	}
	if(document.payfrom.postcode.value.length!=0)

{
        var filter=/^\s*[0-9]{6,6}\s*$/; 

     if (!filter.test(document.payfrom.postcode.value)) 
    
     {
      alert("邮编格式不正确！");
      document.payfrom.postcode.focus();
      return false;
      }
   }
 else
{
	document.payfrom.postcode.focus();
    alert("对不起，请填写邮编！");
	return false;
  }
 
if(document.payfrom.usermobile.value.trim()=="" && document.payfrom.usertel.value.trim()==""){
		alert("手机或固定电话必填一项！");
		document.payfrom.usermobile.focus();
		return false;
	}
	if(document.payfrom.usermobile.value.trim()!=""){
		var usermobile = document.payfrom.usermobile.value;
		//var yzmobile=/^13\d{9}|15[0,3,5,6,8,9]\d{8}$/;
		var yzmobile=/^(13|15|18)\d{9}$/;
		if(!yzmobile.test(usermobile)){
		  alert("请输入正确的11位手机号码！");
		  return false;	
		}
	}

  if(document.payfrom.useremail.value.length!=0)
  {
    if (document.payfrom.useremail.value.charAt(0)=="." ||        
         document.payfrom.useremail.value.charAt(0)=="@"||       
         document.payfrom.useremail.value.indexOf('@', 0) == -1 || 
         document.payfrom.useremail.value.indexOf('.', 0) == -1 || 
         document.payfrom.useremail.value.lastIndexOf("@")==document.payfrom.useremail.value.length-1 || 
         document.payfrom.useremail.value.lastIndexOf(".")==document.payfrom.useremail.value.length-1)
     {
      alert("Email地址格式不正确！");
      document.payfrom.useremail.focus();
      return false;
      }
   }
 else
  {
   alert("Email不能为空！");
   document.payfrom.useremail.focus();
   return false;
   }
	if(payfrom.province.value.trim()=="省份"){
		alert("请选择收花人所在省份!\r\n"); 		 
		document.payfrom.province.focus();
		return false;
	}
	if(payfrom.city.value.trim()=="市"){
		alert("请选择收花人所在城市!\r\n"); 		 
		document.payfrom.city.focus();
		return false;
	}
	if(payfrom.county.value.trim()=="县"){
		alert("请选择收花人所在县区!\r\n"); 		 
		document.payfrom.county.focus();
		return false;
	}
	
	 if(checkspace(document.payfrom.address.value)) {
	document.payfrom.address.focus();
    alert("对不起，请填写收花人详细收货地址！");
	return false;
 
}
	
	 var a=document.getElementById("Niming");
	if (a.checked){
		if(document.payfrom.shuming.value==""){
			alert("请填写署名！");
			document.payfrom.shuming.focus();
			return false;
		}
	}
	
	
	document.payfrom.submit23.disabled='disabled';
	return true;
}


<!--
function IsNull(inputName){
 var isNotNull = false;
 var someNodeList = document.getElementsByName(inputName);
 for(i=0;i<someNodeList.length;i++){
  var node = someNodeList[i];
  if(node.type=='checkbox' || node.type=='radio'){
   if(node.checked == true && node.value != "")
    isNotNull = true;
  }
  else{
   if(node.value != "")
    isNotNull = true;
  }
 }
 return isNotNull;
}
//-->


function check2(flag){
	if(flag == true){
		//tst.innerHTML=':'
		tst.style.display="block";
	}else{
		//tst.innerHTML=''
		tst.style.display="none";
	}
}


var xmlHttp_city = false;
try{
	xmlHttp_city=new ActiveXObject("Msxml2.XMLHTTP")
}
catch(e){
	try{
		xmlHttp_city=new ActiveXObject("Microsoft.XMLHTTP")
	}
	catch(E){
		xmlHttp_city = new XMLHttpRequest();
	}
}
if(!xmlHttp_city && !alerted){
	try{
		xmlHttp_city = new XMLHttpRequest();
	}
	catch(e){
		alert("你的浏览器不支持XMLHttpRequest对象，无法使用此功能！");
	}
}
function change_city(code,code2,code3){
  var province_code=code;
  var province_code2=code2;
  var province_code3=code3;
  document.getElementById("province_city").innerHTML="<img style='margin:0px;' src='images/loading.gif'><br>正在查找，请稍侯……";
  if ((province_code == null) || (province_code == "")) return;
  var url = "containers/Songflowers.asp?province_code=" + escape(province_code) + "&province_code2=" + escape(province_code2) + "&province_code3=" + escape(province_code3) + "&pare_id=" + Math.random()*2147483647;
  xmlHttp_city.open("GET", url, true);
  xmlHttp_city.onreadystatechange = updatePage;
  xmlHttp_city.send(null); 
} 	
function updatePage() {
	if (xmlHttp_city.readyState==4){
		if(xmlHttp_city.status==200){
			document.getElementById("province_city").innerHTML=xmlHttp_city.responseText;
		}
		else{document.getElementById("province_city").innerHTML="<font color=#FF0000>您选择的时间不对，请重新选择！</font>";}
	}else{document.getElementById("province_city").innerHTML="<div style='text-align:center; width:100%;'><img style='margin:50px 0px;' src='images/loading.gif'></div>";}
}
