function creatsel(selname,stroption,opt)
    {document.write("<select name='"+selname+"' id='"+selname+"'></select>");	
	temparr=stroption.split(",")  
	
	
     for (i=0;i<temparr.length; i++)
        {
             document.form1.country.options[document.form1.country.length] = new Option(temparr[i],i);  
			 if(opt==temparr[i])document.form1.country.selectedIndex=i;              
        }
	}
function checkdata() {
if( form1.sex.value =="") {
alert("请选性别!");
return false;
}
if( form1.firstname.value =="" || form1.firstname.value.length<2) {
alert("请写名字!");
return false;
}


if( isNumberString(form1.usermail.value,"1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_@.-")!=1 || form1.usermail.value.length<8) {
alert("邮箱有误");
form1.usermail.focus();
return false;
}
if(form1.streetaddress.value==""){
alert("请写地址!");
form1.streetaddress.focus();
return false;
}
if(form1.zip.value==""){
alert("请写邮编!");
form1.zip.focus();
return false;
}
if(form1.city.value==""){
alert("请写城市");
form1.city.focus();
return false;
}


if(form1.country.value==""){
alert("请选国家!");
form1.country.focus();
return false;
}
if(form1.telephone.value==""){
alert("请写电话");
return false;
}
if(form1.paymentvia.value=="0"){
alert("请选配送方式");
form1.paymentvia.focus();
return false;
}
return true;
}
function isNumberString (InString,RefString)
{
if(InString.length==0) return (false);
for (Count=0; Count < InString.length; Count++)  {
	TempChar= InString.substring (Count, Count+1);
	if (RefString.indexOf (TempChar, 0)==-1)  
	return (false);
}
return (true);
}

