// JavaScript Document
function geturlhtml(url){
  var xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
  xmlhttp.Open("POST", url, false);
  xmlhttp.Send();
  var txt=xmlhttp.responseText;
  xmlhttp=null;
  return txt;
}
function convertnum(str){
	str=str.replace(/£±/g,"1");
	str=str.replace(/£²/g,"2");
	str=str.replace(/£³/g,"3");
	str=str.replace(/£´/g,"4");
	str=str.replace(/£µ/g,"5");
	str=str.replace(/£¶/g,"6");
	str=str.replace(/£·/g,"7");
	str=str.replace(/£¸/g,"8");
	str=str.replace(/£¹/g,"9");
	str=str.replace(/£°/g,"0");
	str=str.replace(/£­/g,"-");
	str=str.replace(/ /g,"");
	return str  
}
function checkbuy(proid){
	
	if (document.gm.cc.value=="0" && document.gm.size1.value=="0"){
		buyid.innerHTML="<font color=red>Please select a size</font>";    
		document.gm.size1.focus();
		return false
	}
	document.gm.submit();
}

function delcart(actionid){
	if (actionid==""){
		
	}else{
		url='buy.asp?actionid='+actionid+'&action=del';
		var txt=geturlhtml(url);
		if(txt=="succ"){
				location.href='spcenter.asp';
		}else{
		alert('Parameter error');
		}
		
	}
}

function editcount(x){
	editid.innerHTML="<font color=red>Loading...</font>";
	var productid="";
	var actionid="";
	var productcount="";
	for (ix=0;ix<parseInt(x);ix++){
		if (productid==""){
			productid=document.all.formcart.productid[ix].value;
		}else{productid=productid+","+document.all.formcart.productid[ix].value;}
		
		if (actionid==""){
			actionid=document.all.formcart.actionid[ix].value;
		}else{actionid=actionid+","+document.all.formcart.actionid[ix].value;}
		
		if (productcount==""){
			productcount=document.all.formcart.productcount[ix].value;
		}else{productcount=productcount+","+document.all.formcart.productcount[ix].value;}
		
	}
	url="xgsl.asp?productid="+productid+"&actionid="+actionid+"&productcount="+productcount;
	
	var txt=geturlhtml(url);
	if(txt=="succ"){
		editid.innerHTML="<font color=red>Success</font>";
		location.href='spcenter.asp';
	}else{
		alert('Parameter error');
	}
}

function checkaddr(){
	if (document.formm.uname.value=="" || document.formm.uname.value==" "){
		alert("Please Input your full name!");
		document.formm.uname.focus();
		return false
	}
	if (document.formm.address1.value==""){
		alert("Please Input your address!");
		document.formm.address1.focus();
		return false
	}
	if (document.formm.city.value==""){
		alert("Please Input your town/city!");
		document.formm.city.focus();
		return false
	}
	if (document.formm.postcode.value==""){
		alert("Please Input your postcode!");
		document.formm.postcode.focus();
		return false
	}
	if (document.formm.tel.value=="" || document.formm.tel.value=="-"){
		alert("Please Input your telephone Number!");
		document.formm.tel.focus();
		return false
	}
	
	if (document.formm.uemail.value==""){
		alert("Please Input your email address!");
		document.formm.uemail.focus();
		return false
	}
	if (document.formm.uemail.value!=""){
		haha1=document.formm.uemail.value
		i=haha1.indexOf("@");
        if(i==-1)
		{
			alert("Error,E_mail!")
			document.formm.uemail.focus();
		    return false;
        }
       ii=haha1.indexOf(".")
        if(ii==-1)
		{
			alert("Error,E_mail!")
			document.formm.uemail.focus();
			return false;
        }
	}
}

function curl(x){
if (x==1){
	document.formm.x.value='1';
}
else{
	document.formm.x.value='2';
}
}

function ajaxyhq(){
	youhuiquan.innerHTML="<img src='/images/gif-0537.gif'>";
	if (document.all.yhq.value!=""){
		url='yhq.asp?yhq='+document.all.yhq.value+'&zong='+document.all.zong.value;
		var txt=geturlhtml(url);
		youhuiquan.innerHTML="<font color=red>"+txt+"</font>";
	}
}


function regche(){
	var str=""
	if (document.formm.email.value==""){
		demail.innerHTML="<font color=red>Please input your email</font>";
		document.formm.email.focus();
		return false
	}
	if (document.formm.email.value!=""){
		haha1=document.formm.email.value
		i=haha1.indexOf("@");
        if(i==-1)
		{
			demail.innerHTML="<font color=red>Your email error</font>";
			document.formm.email.focus();
		    return false
        }
       ii=haha1.indexOf(".")
        if(ii==-1)
		{
			demail.innerHTML="<font color=red>Your email error</font>";
			document.formm.email.focus();
			return false
        }
	}
	demail.innerHTML="";
	str="email="+document.formm.email.value;
	if (document.formm.pass1.value==""){
		dpass1.innerHTML="<font color=red>Please Input your password</font>";
		document.formm.pass1.focus();
		return false
	}
	dpass1.innerHTML="";
	if (document.formm.pass2.value==""){
		dpass2.innerHTML="<font color=red>Please Input your password again</font>";
		document.formm.pass2.focus();
		return false
	}
	dpass2.innerHTML="";
	if (document.formm.pass1.value!=document.formm.pass2.value){
		dpass2.innerHTML="<font color=red>Please check your password</font>";
		document.formm.pass1.focus();
		return false
	}
	dpass2.innerHTML="";
	str=str+"&pass1="+document.formm.pass1.value;
	if (document.formm.fname.value==""){
		dfname.innerHTML="<font color=red>Please Input your first name</font>";
		document.formm.fname.focus();
		return false
	}
	dfname.innerHTML="";
	str=str+"&fname="+document.formm.fname.value;
	if (document.formm.lname.value==""){
		dlname.innerHTML="<font color=red>Please Input your last name</font>";
		document.formm.lname.focus();
		return false
	}
	dlname.innerHTML=""
	str=str+"&lname="+document.formm.lname.value;
	if (document.formm.address1.value==""){
		daddress1.innerHTML="<font color=red>Please Input your street address </font>";
		document.formm.address1.focus();
		return false
	}
	daddress1.innerHTML="";
	str=str+"&address1="+document.formm.address1.value;
	if (document.formm.city.value==""){
		dcity.innerHTML="<font color=red>Please Input your town/city</font>";
		document.formm.city.focus();
		return false
	}
	dcity.innerHTML="";
	str=str+"&city="+document.formm.city.value;
	str=str+"&state="+document.formm.state.value;
	if (document.formm.postcode.value==""){
		dpostcode.innerHTML="<font color=red>Please Input your postcode</font>";
		document.formm.postcode.focus();
		return false
	}
	dpostcode.innerHTML="";
	str=str+"&postcode="+document.formm.postcode.value;
	if (document.formm.tel1.value==""){
		dtel.innerHTML="<font color=red>Please Input your phone number</font>";
		document.formm.tel1.focus();
		return false
	}
	dtel.innerHTML="";
	document.formm.submit();
}