
//////////////// check id  
  function check_id()
  {
  var user_id='';
  var user_id2=document.form1.user_id.value;
  
  for(var i=0;i<document.form1.user_id.value.length;i++)
  { 
   user_id2=user_id2.replace(" ",""); 
  }
  for(var i=0;i<user_id2.length;i++)
  { 
    if(user_id2.charCodeAt(i)<10000)
    user_id=user_id+user_id2.charAt(i);
  }
   document.form1.user_id.value=""+user_id+"";
  // alert("testing: "+user_id);
   document.getElementById("uid").src="user_verification.php?uid="+user_id+"";
  }
  
  function reset_id()
  {
   document.form1.user_id.value="";
   document.form1.user_id.focus();
  } 
  
  function set_id(value)
  {
   document.form1.user_id.value=""+value+"";
  } 
//////////////// check id   


//////////////// check phone  
  function check_phone()
  {
  var contact_tel='';
  var contact_tel2=document.form1.contact_tel.value;
  for(var i=0;i<document.form1.contact_tel.value.length;i++)
  {
   contact_tel2=contact_tel2.replace(" ","");
  }
  for(var i=0;i<contact_tel2.length;i++)
  { 
    if(contact_tel2.charCodeAt(i)<10000)
    contact_tel=contact_tel+contact_tel2.charAt(i);
  }
   document.form1.contact_tel.value=""+contact_tel+"";
   document.getElementById("tel").src="phone_verification.php?tel="+contact_tel+"";
  }

  function phone_reset_id()
  {
   document.form1.contact_tel.value="";
   document.form1.contact_tel.focus();
  } 
//////////////// check phone   

  
  function change_code(value)
  {
   document.form1.verify_code1.value=""+value+"";
   //alert(document.form1.verify_code1.value);
  } 
  
  function change_code2(value)
  {
   document.form1.verify_code2.value=""+value+"";
   //alert(document.form1.verify_code2.value);
  } 
  
  function change_dir(value)
  {
   document.form0.cat_dir.value=""+value+"";
  } 
  
  function check(){

  	document.form1.birth_day.value=document.form1.orderdate.value;
  
	if (document.form1.contact_name.value == ""){
			alert("Please fill your First Name!");
			document.form1.contact_name.focus();
			return false;
	}
	
	if (document.form1.contact_name1.value == ""){
			alert("Please fill your Last Name!");
			document.form1.contact_name1.focus();
			return false;
	}
	
	if (document.form1.contact_address.value == ""){
			alert("Please fill your Address!");
			document.form1.contact_address.focus();
			return false;
	}	
	
	
	var str=document.form1.contact_tel.value;
	str1=str.replace(' ',"");
	str2=str1.replace('-',"");
	str3=str2.replace('+',"");
	str4=str3.replace('.',"");
	str5=str4.replace(' ',"");
	str6=str5.replace('(',"");
	str7=str6.replace(')',"");
	if (str7 == "" || isNaN(str7)==true){
		alert("Please fill your valid Telephone Number!");
		document.form1.contact_tel.focus();
		return false;
    }
	
	
	
	if (document.form1.contact_email.value == ""){
		alert("Please fill in the E-mail Address");
		document.form1.contact_email.focus();
		return false;
    }else {
		var emailStr=document.form1.contact_email.value;
		//alert(emailStr);
		var emailPat=/[_a-zA-Z\d\-\.]+@[_a-zA-Z\d\-]+(\.[_a-zA-Z\d\-]+)+$/; 
		var matchArray=emailStr.match(emailPat);
		if (matchArray==null) {
 			alert("E-mail Address must include ( @ and . )");
		    document.form1.contact_email.focus();
 			return false;
		}
	}
	
	if (document.form1.contact_email1.value == "" && document.form1.contact_email.value != ""){
		alert("Please re-enter your E-mail Address!");
		document.form1.contact_email1.focus();
		return false;
    }else {
		if (document.form1.contact_email1.value != document.form1.contact_email.value) {
 			alert("The E-mail Address re-entered is not matching!");
			document.form1.contact_email1.focus();
 			return false;
		}
	}
	
	if (document.form1.user_id.value == ""){
			alert("Please fill your User ID!");
			document.form1.user_id.focus();
			return false;
	}
	
	if (document.form1.user_pwd.value == ""){
			alert("Please fill your User Password!");
			document.form1.user_pwd.focus();
			return false;
	}
	
	
	if (document.form1.user_pwd1.value == "" && document.form1.user_pwd.value != ""){
		alert("Please re-enter your User Password");
		document.form1.user_pwd1.focus();
		return false;
    }else {
		if (document.form1.user_pwd1.value != document.form1.user_pwd.value) {
 			alert("The User Password re-entered is not matching!");
		    document.form1.user_pwd1.focus();
 			return false;
		}
	}
	
	

	if (document.form1.birth_day.value == ""){
			alert("Please fill your Birthday!");
			return false;
	}	
	
	
		if (document.form1.verify_code1.value != document.form1.verify_code2.value) {
 			alert("The Verification Code is invalid!");
 			return false;
		}
	
	

var strb=document.form1.agree2;
	if (strb.checked!=true)
    {
	//alert(document.form1.verify_code1.value);
	//alert(document.form1.verify_code2.value);
		alert("Please agree the Agreement and Pivacy!");
		return false;
    }
	
	
//if(true)
//document.form1.submit();	

}




  function checka(){
	if (document.form1.ass_name.value == ""){
			alert("Please fill your Organization Name!");
			document.form1.ass_name.focus();
			return false;
	}

	if (document.form1.contact_name.value == ""){
			alert("Please fill your First Name!");
			document.form1.contact_name.focus();
			return false;
	}
	
	if (document.form1.contact_name1.value == ""){
			alert("Please fill your Last Name!");
			document.form1.contact_name1.focus();
			return false;
	}
	
	if (document.form1.contact_position.value == ""){
			alert("Please fill your Position!");
			document.form1.contact_position.focus();
			return false;
	}
	
	if (document.form1.contact_email.value == ""){
		alert("Please fill in the E-mail Address");
		document.form1.contact_email.focus();
		return false;
    }else {
		var emailStr=document.form1.contact_email.value;
		//alert(emailStr);
		var emailPat=/[_a-zA-Z\d\-\.]+@[_a-zA-Z\d\-]+(\.[_a-zA-Z\d\-]+)+$/; 
		var matchArray=emailStr.match(emailPat);
		if (matchArray==null) {
 			alert("E-mail Address must include ( @ and . )");
		    document.form1.contact_email.focus();
 			return false;
		}
	}
	
	
	var str=document.form1.contact_tel.value;
	str1=str.replace(' ',"");
	str2=str1.replace('-',"");
	str3=str2.replace('+',"");
	str4=str3.replace('.',"");
	str5=str4.replace(' ',"");
	str6=str5.replace('(',"");
	str7=str6.replace(')',"");
	if (str7 == "" || isNaN(str7)==true){
		alert("Please fill your valid Telephone Number!");
		document.form1.contact_tel.focus();
		return false;
    }
	
	
	if (document.form1.ci_form.value == ""){
			//alert("Please upload your CI Form!");
			//document.form1.ci_form.focus();
			//return false;
	}
	
	
	
		if (document.form1.verify_code1.value != document.form1.verify_code2.value) {
 			alert("The Verification Code is invalid!");
 			return false;
		}
	

}



  function checke(){
	if (document.form1.sat.value == ""){
			alert("Please fill your title!");
			document.form1.sat.focus();
			return false;
	}

	if (document.form1.name1.value == ""){
			alert("Please fill your First Name!");
			document.form1.name1.focus();
			return false;
	}
	
	if (document.form1.name2.value == ""){
			alert("Please fill your Last Name!");
			document.form1.name2.focus();
			return false;
	}
	
	var str=document.form1.tel.value;
	str1=str.replace(' ',"");
	str2=str1.replace('-',"");
	str3=str2.replace('+',"");
	str4=str3.replace('.',"");
	str5=str4.replace(' ',"");
	str6=str5.replace('(',"");
	str7=str6.replace(')',"");
	if (str7 == "" || isNaN(str7)==true){
		alert("Please fill your valid Telephone Number!");
		document.form1.tel.focus();
		return false;
    }
	
		var str=document.form1.tel2.value;
	str1=str.replace(' ',"");
	str2=str1.replace('-',"");
	str3=str2.replace('+',"");
	str4=str3.replace('.',"");
	str5=str4.replace(' ',"");
	str6=str5.replace('(',"");
	str7=str6.replace(')',"");
	if (str7 == "" || isNaN(str7)==true){
		alert("Please fill your valid Mobile Phone Number!");
		document.form1.tel2.focus();
		return false;
    }
	
	
	if (document.form1.email.value == ""){
		alert("Please fill in the E-mail Address");
		document.form1.email.focus();
		return false;
    }else {
		var emailStr=document.form1.email.value;
		//alert(emailStr);
		var emailPat=/[_a-zA-Z\d\-\.]+@[_a-zA-Z\d\-]+(\.[_a-zA-Z\d\-]+)+$/; 
		var matchArray=emailStr.match(emailPat);
		if (matchArray==null) {
 			alert("E-mail Address must include ( @ and . )");
		    document.form1.email.focus();
 			return false;
		}
	}
	
	if (document.form1.amount_opt_value.value <1){
			alert("Please select the Event Cost!");
			return false;
	}
	
var test_status=true;	
for (i=1; i<=1; i++) {
	if (document.getElementById('money_type'+i).checked==true){
		test_status=false;
    }
}
	
if(test_status)
{
alert("Please select the Payment Method !");
return false;
}
else
{
return true;
}
	
}





function checkd1(){
//  && document.getElementById("donate_type2").checked==false
	if (document.getElementById("donate_type1").checked==false){
		alert("Please select the donation option!");
		return false;
    }

}

function checkd2(value){
var test_status=true;

if(document.getElementById("ass_select").value=="")
test_status=true;
else
test_status=false;

if(test_status)
{
alert("Please select the beneficiary organization !");
return false;
}
else
{
return true;
}
}


function checkd3a(){
if (document.getElementById('item_des1').checked==true){
	if (document.getElementById('item_element11').value == ""){
			alert("Please fill the Item Name!");
			return false;
	}

	if (document.getElementById('item_element12').value == ""){
			alert("Please fill the estimated price!");
			return false;
	}
	
	if (document.getElementById('item_element13').value == ""){
			alert("Please fill the Description!");
			return false;
	}
}	

if (document.getElementById('item_des2').checked==true){
	if (document.getElementById('item_element21').value == ""){
			alert("Please fill the Message!");
			return false;
	}
}
	
}

function checkd3b(){
var test_status=true;
	if (document.getElementById('money_value').value <1 && isNaN(document.getElementById('money_value'))==true){
		    alert("Please fill the Donation Amount which is equal to or larger than HK$ 100!");
			return false;
	}

for (i=1; i<=1; i++) {
	if (document.getElementById('money_type'+i).checked==true){
		test_status=false;
    }
}

if(test_status)
{
alert("Please select the Payment Method !");
return false;
}
else
{
return true;
}
}


function checkdt(){

if (document.getElementById('dt_message').value == ""){
			alert("Please fill the Donation Time Details!");
			return false;
}


var test_status=true;

if(document.getElementById("ass_select").value=="")
test_status=true;
else
test_status=false;

if(test_status)
{
alert("Please select the beneficiary organization !");
return false;
}
else
{
return true;
}
}




















//////////// beau peep ///////////////////////////////////////////////////////////////////////////////////////////
function check1a(){
var num=document.getElementById('shape_num').value;
//alert(num);
var test_status=true;
for (i=1; i<=num; i++) {
	if (document.getElementById('selected_shape'+i).checked==true){
		test_status=false;
    }
}

if (test_status){
			alert("Please select the clutch style!");
			return false;
}

///////////////////////////////////////////////////////////////////////////////////////////
if (document.getElementById('selected_materials6').value == ""){
			alert("Please select the material!");
			return false;
}
var num6=document.getElementById('materials_color_num6').value;
var test_status6=true;
for (i=1; i<=num6; i++) {
	if (document.getElementById('materials_color6'+i).checked==true){
		test_status6=false;
    }
}

if (test_status6){
			alert("Please select the material color!");
			return false;
}
///////////////////////////////////////////////////////////////////////////////////////////
}



function check1(){
var num=document.getElementById('shape_num').value;
//alert(num);
var test_status=true;
for (i=1; i<=num; i++) {
	if (document.getElementById('selected_shape'+i).checked==true){
		test_status=false;
    }
}

	
if (test_status){
			alert("Please select the shoe shape!");
			return false;
}

if (document.getElementById('size_type').value == ""){
			alert("Please select the standard of shoe size!");
			return false;
}

if (document.getElementById('size_value').value == ""){
			alert("Please select the size of shoe!");
			return false;
}

}






function check3(){
if (document.getElementById('back_status').value == "0"){
///////////////////////////////////////////////////////////////////////////////////////////
		if (document.getElementById('selected_materials1').value == ""){
					alert("Please select the material!");
					return false;
		}
		
		var num=document.getElementById('materials_color_num1').value;
		
		var test_status=true;
		
		for (i=1; i<=num; i++) {
			if (document.getElementById('materials_color1'+i).checked==true){
				test_status=false;
			}
		}
	
		if (test_status){
					alert("Please select the material color!");
					return false;
		}
///////////////////////////////////////////////////////////////////////////////////////////



/*
var test_status2=true;
for (i=1; i<=3; i++) {
	if (document.getElementById('heel_style1'+i).checked==true){
		test_status2=false;
    }
}
if (test_status2){
			alert("Please select the heel shpae!");
			return false;
}
*/
///////////////////////////////////////////////////////////////////////////////////////////
		if (document.getElementById('heel_style13')){
			if (document.getElementById('heel_style13').checked==true){
			
				if (document.getElementById('selected_materials2').value == ""){
							alert("Please select the material!");
							return false;
				}
				
				var num=document.getElementById('materials_color_num2').value;
				var test_status3=true;
				for (i=1; i<=10; i++) {
					if (document.getElementById('materials_color2'+i).checked==true){
						test_status3=false;
					}
				}
				
				if (test_status3){
							alert("Please select the material color!");
							return false;
				}
			
			}
		}
///////////////////////////////////////////////////////////////////////////////////////////



///////////////////////////////////////////////////////////////////////////////////////////
		var test_status5=true;
//if(document.getElementById('platform_style2').checked==true){
/*
for (i=1; i<=3; i++) {
	if (document.getElementById('heel_style2'+i).checked==true){
		test_status5=false;
    }
}
if (test_status5){
			alert("Please select the heel shpae!");
			return false;
}
*/
//}
///////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////
		if (document.getElementById('heel_style23')){
			if (document.getElementById('heel_style23').checked==true){
			
				if (document.getElementById('selected_materials3').value == ""){
							alert("Please select the material!");
							return false;
				}
			
				var num=document.getElementById('materials_color_num3').value;
				var test_status4=true;
				for (i=1; i<=10; i++) {
					if (document.getElementById('materials_color3'+i).checked==true){
						test_status4=false;
					}
				}
			
				if (test_status4){
					alert("Please select the material color!");
					return false;
				}
			}
		///////////////////////////////////////////////////////////////////////////////////////////
		}
	}
}




function check4(){
	
	if (document.getElementById('back_status').value == "0"){
	
	var num1=document.getElementById('edge_num').value;
	var test_status1=false;
	
	for (i=1; i<=num1; i++) {
		if (document.getElementById('edge_style'+i).checked==true){
			test_status1=true;
		}
	}
	
	if (test_status1){
		///////////////////////////////////////////////////////////////////////////////////////////
		if (document.getElementById('selected_materials4').value == ""){
					alert("Please select the material!");
					return false;
		}
		var num2=document.getElementById('materials_color_num4').value;
		var test_status2=true;
		for (i=1; i<=10; i++) {
			if (document.getElementById('materials_color4'+i).checked==true){
				test_status2=false;
			}
		}
		
		if (test_status2){
			alert("Please select the material color!");
			return false;
		}
		///////////////////////////////////////////////////////////////////////////////////////////
		}
	
		/*
		if (test_status1 && document.getElementById('edge_style1').checked!=true){
		///////////////////////////////////////////////////////////////////////////////////////////
		var test_status2a=true;
		for (i=1; i<=10; i++) {
			if (document.getElementById('materials_colorb4'+i).checked==true){
				test_status2a=false;
			}
		}
		
		if (test_status2a){
					alert("Please select the material color!");
					return false;
		}
		///////////////////////////////////////////////////////////////////////////////////////////
		}
		*/
	
	
		var num3=document.getElementById('acc_num').value;
		var test_status3=false;
		
		for (i=1; i<=3; i++) {
			if (document.getElementById('acc_style'+i).checked==true){
				test_status3=true;
			}
		}
		
		if (test_status3){
		///////////////////////////////////////////////////////////////////////////////////////////
			if (document.getElementById('selected_materials5')){
				if (document.getElementById('selected_materials5').value == ""){
					alert("Please select the material!");
					return false;
				}
				
				var num4=document.getElementById('materials_color_num5').value;
				
				var test_status4=true;
				
				for (i=1; i<=10; i++) {
					if (document.getElementById('materials_color5'+i).checked==true){
						test_status4=false;
					}
				}
			
				if (test_status4){
					alert("Please select the material color!");
					return false;
				}
			}else{
				alert("Please select the material! ......");
				return false;
			}
		///////////
		
		////////////////////////////////////////////////////////////////////////////////
		}
	}
}


  function check5(){
	if (document.form_step5.name.value == ""){
			alert("Please fill your First Name!");
			document.form_step5.name.focus();
			return false;
	}
	
	if (document.form_step5.name1.value == ""){
			alert("Please fill your Last Name!");
			document.form_step5.name1.focus();
			return false;
	}

	if (document.form_step5.address.value == ""){
			alert("Please fill your address!");
			document.form_step5.address.focus();
			return false;
	}
	
	if (document.form_step5.city.value == ""){
			alert("Please fill your city!");
			document.form_step5.city.focus();
			return false;
	}
	
	if (document.form_step5.city.value == ""){
			alert("Please fill your city!");
			document.form_step5.city.focus();
			return false;
	}
	
	if (document.form_step5.post_code.value == ""){
			alert("Please fill in your post code!");
			document.form_step5.post_code.focus();
			return false;
	}
	
	if (document.form_step5.country.value == ""){
			alert("Please select your country!");
			document.form_step5.country.focus();
			return false;
	}
/**/
	if (document.form_step5.tel.value == ""){
			alert("Please fill in your telephone number!");
			document.form_step5.tel.focus();
			return false;
	}
		
	if (document.form_step5.email.value == ""){
		alert("Please fill in your E-mail Address");
		document.form_step5.email.focus();
		return false;
    }else {
		var emailStr=document.form_step5.email.value;
		//alert(emailStr);
		var emailPat=/[_a-zA-Z\d\-\.]+@[_a-zA-Z\d\-]+(\.[_a-zA-Z\d\-]+)+$/; 
		var matchArray=emailStr.match(emailPat);
		if (matchArray==null) {
 			alert("E-mail Address must include ( @ and . )");
		    document.form_step5.email.focus();
 			return false;
		}
	}

}


function calculation(value){
if(value<1)
{
value=1;
document.getElementById('quantity').value =1;
}
document.getElementById('cost').innerHTML =(document.getElementById('unit_cost').value)*value;

}

function selectedexternal(){
if (document.getElementById('heel_style23').checked==true){
document.getElementById('colorchart3').style.visibility='visible';
}
}

function empty_confirm()
{
var r=confirm("Are you sure to empty the cart?");
return r;
}
//////////// beau peep ///////////////////////////////////////////////////////////////////////////////////////////