// JavaScript Document
function $(Id){return document.getElementById(Id);}
function showmore(BigId){var obj=$("COats_Background"+BigId).style;obj.display=obj.display=="none"?"block":"none";}
function selectbox(locationid,price){
	var id=locationid;  
    price=price; 
    if (id == 1){
		document.myform.amount.value = price+25;}
	else{
		document.myform.amount.value = price;}         
}
function checkform()
{
	if(document.Login_form.Email.value=="")
	{
		alert("Email is required!Please try again!");
		document.Login_form.Email.focus();
		return false;
		}
	if(document.Login_form.Pwd.value=="")
	{
		alert("Pwd is required!Please try again!");
		document.Login_form.Pwd.focus();
		return false;
		}
	}
function checkregform()
{
	if(checkspace(document.regform.FirstName.value)) {
	document.regform.FirstName.focus();
    alert("Please specify your first name!");
	return false;
   }
 
   else if(checkspace(document.regform.LastName.value)) {
	document.regform.LastName.focus();
    alert("Please specify your last name!");
	return false;
   } 
    
else if(checkspace(document.regform.Address.value)) {
	document.regform.Address.focus();
    alert("Please specify your address!");
	return false;
   }
else if(checkspace(document.regform.Address.value) || document.regform.Address.value.length < 10) {
	document.regform.Address.focus();
    alert("Your address characters must > 10!");
	return false;
  }
  
  	
else if(checkspace(document.regform.PostCode.value)) {
	document.regform.PostCode.focus();
    alert("Please specify your post code!");
	return false;
   }

	
	
	else if(checkspace(document.regform.Country.value)) {
	document.regform.Country.focus();
    alert("Please select your country!");
	return false;
   }
	
	else if(checkspace(document.regform.Telephone.value)) {
	document.regform.Telephone.focus();
    alert("Please specify your Telephone No.!");
	return false;
   }	
	
	
	
	
	  
else if(checkspace(document.regform.Pwd.value) || document.regform.Pwd.value.length < 6) {
	document.regform.Pwd.focus();
    alert("Password between 6-15 characters!");
	return false;
  }
else if(document.regform.Pwd.value != document.regform.ConfirmPwd.value) {
	document.regform.ConfirmPwd.focus();
	document.regform.ConfirmPwd.value = '';
	document.regform.ConfirmPwd.value = '';
    alert("The Password does not match with the confirmation password!");
	return false;
  }
  
else if(checkspace(document.regform.Question.value)) {
	document.regform.Question.focus();
    alert("Please specify your password question!");
	return false;
   }

else if(checkspace(document.regform.Answer.value)) {
	document.regform.Answer.focus();
    alert("Please specify your answer to question!");
	return false;
   }
       

   
else if(document.regform.Email.value.length!=0)
  {
    if (document.regform.Email.value.charAt(0)=="." ||        
         document.regform.Email.value.charAt(0)=="@"||       
         document.regform.Email.value.indexOf('@', 0) == -1 || 
         document.regform.Email.value.indexOf('.', 0) == -1 || 
         document.regform.Email.value.lastIndexOf("@")==document.regform.Email.value.length-1 || 
         document.regform.Email.value.lastIndexOf(".")==document.regform.Email.value.length-1)
     {
      alert("Your email is not correct. Please specify a valid email addressŁĄ");
      document.regform.Email.focus();
      return false;
      }
   }
 else
  {
   alert("Please specify your email addressŁĄ");
   document.regform.Email.focus();
   return false;
   }	
   
}

    function checkspace(checkstr) {
  var str = '';
  for(i = 0; i < checkstr.length; i++) {
    str = str + ' ';
  }
  return (str == checkstr);	 
}
function chkfield(){
	if(window.document.form1.S_Name.value==''){window.alert("please input your name!");
		return false}
	if(window.document.form1.S_Country.value==''){window.alert("please input your Country!");
		return false}
	if(window.document.form1.S_City.value==''){window.alert("please input your City!");
		return false}
	if(window.document.form1.S_Address.value==''){window.alert("please input your Address!");
		return false}
	if(window.document.form1.S_PostCode.value==''){window.alert("please input your PostCode!");
		return false}
	if(window.document.form1.S_Telefax.value==''){window.alert("please input your Telefax!");
		return false}
	if(window.document.form1.S_Telephone.value==''){window.alert("please input your Telephone!");
		return false}
	if(window.document.form1.S_Email.value==''){window.alert("please input your Email!");
		return false}
	if(window.document.form1.S_Mobile.value==''){window.alert("please input your Mobile Telephone!");
		return false}
	document.getElementById("SubmitOrder").value='Order is in dealing, Please wait...';
	document.getElementById("SubmitOrder").disabled = true;		
	return true;	
}
function subform_onsubmit() {

if(document.subform.firstname_to.value=="")
	{
	  alert("Please specify your first name!")
	  document.subform.firstname_to.focus()
	  return false
	 }
	 else if(document.subform.lastname_to.value=="")
	{
	  alert("Please specify your last name!")
	  document.subform.lastname_to.focus()
	  return false
	 }
else if(document.subform.sub_tel.value=="")
	{
	  alert("Please specify Your Phone No.!")
	  document.subform.sub_tel.focus()
	  return false
	 }
	 else if(document.subform.country_to.value=="")
	{
	  alert("Please specify Your country!")
	  document.subform.country_to.focus()
	  return false
	 }
	 else if(document.subform.province_to.value=="")
	{
	  alert("Please specify Your State/Province!")
	  document.subform.province_to.focus()
	  return false
	 }	 else if(document.subform.city_to.value=="")
	{
	  alert("Please specify Your City!")
	  document.subform.city_to.focus()
	  return false
	 }	 
	 
	 
else if(document.subform.sub_adds.value=="")
	{
	  alert("Please specify Your Consignee Address!")
	  document.subform.sub_adds.focus()
	  return false
	 }
  
  
else if(document.subform.sub_post.value=="")
	{
	  alert("Please specify Your Consignee Code!")
	  document.subform.sub_post.focus()
	  return false
	 }
else if(document.subform.sub_post.value.length>15)
{
	alert("this text is too longer!");
	document.subform.sub_post.focus();
	return false;
	}
	 
else if(document.subform.sub_to.value.length!=0)
  {
    if (document.subform.sub_to.value.charAt(0)=="." ||        
         document.subform.sub_to.value.charAt(0)=="@"||       
         document.subform.sub_to.value.indexOf('@', 0) == -1 || 
         document.subform.sub_to.value.indexOf('.', 0) == -1 || 
         document.subform.sub_to.value.lastIndexOf("@")==document.subform.sub_to.value.length-1 || 
         document.subform.sub_to.value.lastIndexOf(".")==document.subform.sub_to.value.length-1)
     {
      alert("Your Current E-mail is not correct!");
      document.subform.sub_to.focus();
      return false;
      }
   }
 else
  {
   alert("Please specify Your E-mail address!");
   document.subform.sub_to.focus();
   return false;
   }	 	 
}
function Fuc_BeUserName(fo){
	sub_from = document.subform.sub_from.value;
	firstname = document.subform.firstname.value;
	lastname = document.subform.lastname.value;
	country = document.subform.country.value;
	city = document.subform.city.value;
	province = document.subform.province.value;
	
	sub_fromtel = document.subform.sub_fromtel.value;
	sub_fromadds = document.subform.sub_fromadds.value;
	sub_frompost = document.subform.sub_frompost.value;
	if(fo.checked){
		if(sub_from!=""){
			document.subform.sub_to.value = sub_from
		}
		}else{
		document.subform.sub_to.value = "";
	}
	if(fo.checked){
		if(firstname!=""){
			document.subform.firstname_to.value = firstname
		}
		}else{
		document.subform.firstname_to.value = "";
	}
	if(fo.checked){
		if(lastname!=""){
			document.subform.lastname_to.value = lastname
		}
		}else{
		document.subform.lastname_to.value = "";
	}
		if(fo.checked){
		if(country!=""){
			document.subform.country_to.value = country
		}
		}else{
		document.subform.country_to.value = "";
	}
	
			if(fo.checked){
		if(province!=""){
			document.subform.province_to.value = province
		}
		}else{
		document.subform.province_to.value = "";
	}
			if(fo.checked){
		if(city!=""){
			document.subform.city_to.value = city
		}
		}else{
		document.subform.city_to.value = "";
	}
	
	
	
	if(fo.checked){
		if(sub_fromtel!=""){
			document.subform.sub_tel.value = sub_fromtel
		}
		}else{
		document.subform.sub_tel.value = "";
	}
	
	if(fo.checked){
		if(sub_fromadds!=""){
			document.subform.sub_adds.value = sub_fromadds
		}
		}else{
		document.subform.sub_adds.value = "";
	}
	if(fo.checked){
		if(sub_frompost!=""){
			document.subform.sub_post.value = sub_frompost
		}
		}else{
		document.subform.sub_post.value = "";
	}

}
