	var alpha = "^([a-zA-Z -])*$";
	var alphanum = "^([a-zA-Z0-9 \._\\(\\)\\-\\&:/#,])*$";
	
	function FullAll(whichID){

		id = whichID + "_same"		
		if (document.getElementById(id).checked){
			id = whichID + "_ship_name"
			document.getElementById(id).value = document.forms[0].customer_name.value;
			document.getElementById(id).disabled = true;
			document.getElementById(id).style.background = "#EFEFEF";

			id = whichID + "_address1"
			document.getElementById(id).value = document.forms[0].street_address.value;
			document.getElementById(id).disabled = true;
			document.getElementById(id).style.background = "#EFEFEF";

			id = whichID + "_address2"
			document.getElementById(id).value = document.forms[0].street_address2.value;
			document.getElementById(id).disabled = true;
			document.getElementById(id).style.background = "#EFEFEF";

			id = whichID + "_city"
			document.getElementById(id).value = document.forms[0].city.value;
			document.getElementById(id).disabled = true;
			document.getElementById(id).style.background = "#EFEFEF";

			id = whichID + "_province"
			document.getElementById(id).value = document.forms[0].province.value;
			document.getElementById(id).disabled = true;
			document.getElementById(id).style.background = "#EFEFEF";
			//alert(document.frm.prov_other.value);
			if(document.forms[0].province.selectedIndex==1)
			if(document.frm.prov_other.value.length>0) 
			{
			
				addOther(1);
				id = whichID + "_prov_other"
				
				document.getElementById(id).value = document.frm.prov_other.value;
				document.getElementById(id).disabled = true;
				document.getElementById(id).style.background = "#EFEFEF";
			}
			
			id = whichID + "_zip"
			document.getElementById(id).value = document.forms[0].zip.value;
			document.getElementById(id).disabled = true;
			document.getElementById(id).style.background = "#EFEFEF";

			id = whichID + "_country"
			
			document.getElementById(id).value = document.forms[0].country.value;
			document.getElementById(id).disabled = true;
			document.getElementById(id).style.background = "#EFEFEF";

			document.forms[0].s_same.checked = true;
		}else{
			id = whichID + "_ship_name"
			document.getElementById(id).disabled = false;
			document.getElementById(id).style.background = "#FFFFFF";


			id = whichID + "_address1"
			document.getElementById(id).disabled = false;
			document.getElementById(id).style.background = "#FFFFFF";

			id = whichID + "_address2"
			document.getElementById(id).disabled = false;
			document.getElementById(id).style.background = "#FFFFFF";

			id = whichID + "_city"
			document.getElementById(id).disabled = false;
			document.getElementById(id).style.background = "#FFFFFF";

			id = whichID + "_province"
			document.getElementById(id).disabled = false;
			document.getElementById(id).style.background = "#FFFFFF";
			
			if(document.forms[0].prov_other) {
				id = whichID + "_prov_other"
				if(document.getElementById(id))
				{
				document.getElementById(id).disabled = false;
				document.getElementById(id).style.background = "#FFFFFF";
				}
			}
			
			id = whichID + "_zip"
			document.getElementById(id).disabled = false;
			document.getElementById(id).style.background = "#FFFFFF";

			id = whichID + "_country"
			document.getElementById(id).disabled = false;
			document.getElementById(id).style.background = "#FFFFFF";

			document.forms[0].s_same.checked = false;
		}
	}

	function validate() {
		
		if(document.forms[0].customer_name) {
		//validate name
		if(!validateNotEmpty(document.forms[0].customer_name.value)) {
	      document.forms[0].customer_name.value = '';
	      alert('Customer name can not be empty.');
	      document.forms[0].customer_name.focus();
	      return false;
		}
		if(!validateValue(document.forms[0].customer_name.value, alphanum)) {
	      alert('Enter valid customer name.');
	      document.forms[0].customer_name.focus();
	      return false;
		}
		
		//validate street address
		if(!validateNotEmpty(document.forms[0].street_address.value)) {
	      document.forms[0].street_address.value = '';
	      alert('address can not be empty.');
	      document.forms[0].street_address.focus();
	      return false;
		}
		/*if(!validateValue(document.forms[0].street_address.value, alphanum)) {
	      alert('Enter valid address.');
	      document.forms[0].street_address.focus();
	      return false;
		}*/

		//validate city
		if(!validateNotEmpty(document.forms[0].city.value)) {
	      document.forms[0].city.value = '';
	      alert('City can not be empty.');
	      document.forms[0].city.focus();
	      return false;
		}
		/*if(!validateValue(document.forms[0].city.value, alphanum)) {
	      alert('Enter valid city.');
	      document.forms[0].city.focus();
	      return false;
		}*/
		
		//validate country
		if(document.forms[0].country.selectedIndex == 0) {
	      alert('please select country.');
	      document.forms[0].country.focus();
	      return false;
		}
		
		//validate state
		if(document.forms[0].province.selectedIndex == 0 || document.forms[0].province.selectedIndex == 2) {
	      alert('please select province.');
	      document.forms[0].province.focus();
	      return false;
		}
		
		//validate state
		if(document.forms[0].province.selectedIndex == 1 &&  document.getElementById('prov_other').value=='') {
	      alert('please enter province.');
	      document.forms[0].province.focus();
	      return false;
		}
		//validate zip
		if(!validateNotEmpty(document.forms[0].zip.value)) {
	      document.forms[0].zip.value = '';
	      alert('Zip can not be empty.');
	      document.forms[0].zip.focus();
	      return false;
		}
		/*if(!validateValue(document.forms[0].zip.value, alphanum)) {
	      alert('Enter valid zip.');
	      document.forms[0].zip.focus();
	      return false;
		}*/
		
		//validate phone
		if(!validateNotEmpty(document.forms[0].phone.value)) {
	      document.forms[0].phone.value = '';
	      alert('phone can not be empty.');
	      document.forms[0].phone.focus();
	      return false;
		}

		//validate email
		if(!validateNotEmpty(document.forms[0].email.value)) {
	      document.forms[0].email.value = '';
	      alert('email can not be empty.');
	      document.forms[0].email.focus();
	      return false;
		}
		if(!validateEmail(document.forms[0].email.value)) {
	      alert('Enter valid email.');
	      document.forms[0].email.focus();
	      return false;
		}

		//validate confirm email
		if(!validateNotEmpty(document.forms[0].conf_email.value)) {
	      document.forms[0].conf_email.value = '';
	      alert('confirm email can not be empty.');
	      document.forms[0].conf_email.focus();
	      return false;
		}
		if(!validateEmail(document.forms[0].conf_email.value)) {
	      alert('Enter valid confirm email.');
	      document.forms[0].conf_email.focus();
	      return false;
		}
		
		//match both emails
		if(document.forms[0].email.value != document.forms[0].conf_email.value) {
			alert("Email and Confirm Email should be same.");
			document.forms[0].email.focus();
			return false;
		}
		
		//validate ship first name
		if(!validateNotEmpty(document.forms[0].ship_name.value)) {
	      document.forms[0].ship_name.value = '';
	      alert('Ship name can not be empty.');
	      document.forms[0].ship_name.focus();
	      return false;
		}
		/*if(!validateValue(document.forms[0].ship_name.value, alphanum)) {
	      alert('Enter valid ship name.');
	      document.forms[0].ship_name.focus();
	      return false;
		}*/
		
		//validate street address
		if(!validateNotEmpty(document.forms[0].ship_street_address.value)) {
	      document.forms[0].ship_street_address.value = '';
	      alert('address can not be empty.');
	      document.forms[0].ship_street_address.focus();
	      return false;
		}
		if(!validateValue(document.forms[0].ship_street_address.value, alphanum)) {
	      alert('Enter valid address.');
	      document.forms[0].ship_street_address.focus();
	      return false;
		}
		
		//validate city
		if(!validateNotEmpty(document.forms[0].ship_city.value)) {
	      document.forms[0].ship_city.value = '';
	      alert('City can not be empty.');
	      document.forms[0].ship_city.focus();
	      return false;
		}

		/*if(!validateValue(document.forms[0].ship_city.value, alphanum)) {
	      alert('Enter valid city.');
	      document.forms[0].ship_city.focus();
	      return false;
		}*/
		
		//validate country
		if(document.forms[0].ship_country.selectedIndex == 0) {
	      alert('please select shipping country.');
	      document.forms[0].ship_country.focus();
	      return false;
		}
		
		//validate state
		if(document.forms[0].ship_province.selectedIndex == 0 || document.forms[0].ship_province.selectedIndex == 2) {
	      alert('please select ship province.');
	      document.forms[0].ship_province.focus();
	      return false;
		}
		//alert(document.getElementById('s_prov_other').value);
		//validate state
		if(document.forms[0].ship_province.selectedIndex == 1 &&  document.getElementById('s_prov_other').value=='') {
	      alert('please enter province.');
	      document.forms[0].ship_province.focus();
	      return false;
		}
		//validate zip
		if(!validateNotEmpty(document.forms[0].ship_zip.value)) {
	      document.forms[0].ship_zip.value = '';
	      alert('Zip can not be empty.');
	      document.forms[0].ship_zip.focus();
	      return false;
		}
		/*if(!validateValue(document.forms[0].ship_zip.value, alphanum)) {
	      alert('Enter valid zip.');
	      document.forms[0].ship_zip.focus();
	      return false;
		}*/

			document.frm.s_imgsame.checked = false;
			FullAll('s');
		}
		
		return true;

		
	}

function validate3() {
		// uncheck this to apply validation - if(document.forms[0].customer_name) {
		//validate name
		/*if(!validateNotEmpty(document.forms[0].customer_name.value)) {
	      document.forms[0].customer_name.value = '';
	      alert('Customer name can not be empty.');
	      document.forms[0].customer_name.focus();
	      return false;
		}
		if(!validateValue(document.forms[0].customer_name.value, alphanum)) {
	      alert('Enter valid customer name.');
	      document.forms[0].customer_name.focus();
	      return false;
		}
		
		//validate street address
		if(!validateNotEmpty(document.forms[0].street_address.value)) {
	      document.forms[0].street_address.value = '';
	      alert('address can not be empty.');
	      document.forms[0].street_address.focus();
	      return false;
		}
		if(!validateValue(document.forms[0].street_address.value, alphanum)) {
	      alert('Enter valid address.');
	      document.forms[0].street_address.focus();
	      return;
		}
		
		//validate city
		if(!validateNotEmpty(document.forms[0].city.value)) {
	      document.forms[0].city.value = '';
	      alert('City can not be empty.');
	      document.forms[0].city.focus();
	      return false;
		}
		if(!validateValue(document.forms[0].city.value, alphanum)) {
	      alert('Enter valid city.');
	      document.forms[0].city.focus();
	      return false;
		}
		
		//validate country
		if(document.forms[0].country.selectedIndex == 0) {
	      alert('please select country.');
	      document.forms[0].country.focus();
	      return false;
		}
		
		//validate state
		if(document.forms[0].province.selectedIndex == 0 || document.forms[0].province.selectedIndex == 2) {
	      alert('please select province.');
	      document.forms[0].province.focus();
	      return false;
		}
		
		//validate zip
		if(!validateNotEmpty(document.forms[0].zip.value)) {
	      document.forms[0].zip.value = '';
	      alert('Zip can not be empty.');
	      document.forms[0].zip.focus();
	      return false;
		}
		if(!validateValue(document.forms[0].zip.value, alphanum)) {
	      alert('Enter valid zip.');
	      document.forms[0].zip.focus();
	      return false;
		}
		
		//validate phone
		if(!validateNotEmpty(document.forms[0].phone.value)) {
	      document.forms[0].phone.value = '';
	      alert('phone can not be empty.');
	      document.forms[0].phone.focus();
	      return false;
		}
		if(!validateValue(document.forms[0].phone.value, alphanum)) {
	      alert('Enter valid phone.');
	      document.forms[0].phone.focus();
	      return false;
		}*/

		//validate email
		if(!validateNotEmpty(document.forms[0].email.value)) {
	      document.forms[0].email.value = '';
	      alert('email can not be empty.');
	      document.forms[0].email.focus();
	      return false;
		}
		if(!validateEmail(document.forms[0].email.value)) {
	      alert('Enter valid email.');
	      document.forms[0].email.focus();
	      return false;
		}

		/*
		//validate ship first name
		if(!validateNotEmpty(document.forms[0].ship_name.value)) {
	      document.forms[0].ship_name.value = '';
	      alert('Ship name can not be empty.');
	      document.forms[0].ship_name.focus();
	      return false;
		}
		if(!validateValue(document.forms[0].ship_name.value, alphanum)) {
	      alert('Enter valid ship name.');
	      document.forms[0].ship_name.focus();
	      return false;
		}
		
		//validate street address
		if(!validateNotEmpty(document.forms[0].ship_street_address.value)) {
	      document.forms[0].ship_street_address.value = '';
	      alert('address can not be empty.');
	      document.forms[0].ship_street_address.focus();
	      return false;
		}
		if(!validateValue(document.forms[0].ship_street_address.value, alphanum)) {
	      alert('Enter valid address.');
	      document.forms[0].ship_street_address.focus();
	      return false;
		}
		
		//validate city
		if(!validateNotEmpty(document.forms[0].ship_city.value)) {
	      document.forms[0].ship_city.value = '';
	      alert('City can not be empty.');
	      document.forms[0].ship_city.focus();
	      return false;
		}
		if(!validateValue(document.forms[0].ship_city.value, alphanum)) {
	      alert('Enter valid city.');
	      document.forms[0].ship_city.focus();
	      return false;
		}
		
		//validate country
		if(document.forms[0].ship_country.selectedIndex == 0) {
	      alert('please select shipping country.');
	      document.forms[0].ship_country.focus();
	      return false;
		}
		
		//validate state
		if(document.forms[0].ship_province.selectedIndex == 0 || document.forms[0].ship_province.selectedIndex == 2) {
	      alert('please select ship province.');
	      document.forms[0].ship_province.focus();
	      return false;
		}
		
		//validate zip
		if(!validateNotEmpty(document.forms[0].ship_zip.value)) {
	      document.forms[0].ship_zip.value = '';
	      alert('Zip can not be empty.');
	      document.forms[0].ship_zip.focus();
	      return false;
		}
		if(!validateValue(document.forms[0].ship_zip.value, alphanum)) {
	      alert('Enter valid zip.');
	      document.forms[0].ship_zip.focus();
	      return false;
		}*/

			document.frm.s_imgsame.checked = false;
			FullAll('s');
		//}
		
		document.forms[0].submit();
		return true;
	}

	function addOther(pref, val) {
		if(val == null) val="";
		
		if(pref) {
			if(document.frm.ship_province.value == 'XX') {
				/*document.getElementById('ship_prov_other_div').innerHTML = 
				"<div style='float:left;text-align:right;font-size:8pt'><input name='ship_prov_other' value='"+val+"' type='text' id='s_prov_other' class='txtbox2' style='width:150px;' />&nbsp;(Other)</div>";*/
				var ship_prov_other=document.createElement('input');
				document.getElementById('ship_prov_other_div').appendChild(ship_prov_other);
				ship_prov_other.setAttribute("name","ship_prov_other");
				ship_prov_other.setAttribute("id","s_prov_other");
				ship_prov_other.setAttribute("class","txtbox2");
				ship_prov_other.setAttribute("style","width:150px;");
				ship_prov_other.setAttribute("value",val);
			} else {
				document.getElementById('ship_prov_other_div').innerHTML = "";
			}
		} else {
			if(document.frm.province.value == 'XX') {
				/*document.getElementById('province_other_div').innerHTML = "<div style='float:left;text-align:right;font-size:8pt'> "+
				"<input name='prov_other' value='"+val+"' type='text' id='prov_other' class='txtbox2' style='width:150px;' />&nbsp;(Other)</div>";*/
				var prov_other=document.createElement('input');
				document.getElementById('province_other_div').appendChild(prov_other);
				prov_other.setAttribute("name","prov_other");
				prov_other.setAttribute("id","prov_other");
				prov_other.setAttribute("class","txtbox2");
				prov_other.setAttribute("style","width:150px;");
				prov_other.setAttribute("value",val);
			} else {
				document.getElementById('province_other_div').innerHTML = "";
			}
		}
	}
			
//used for some payment.php 
function validate2() {
		
		//validate name

		if(!validateNotEmpty(document.forms[0].item_name.value)) {
	      document.forms[0].item_name.value = '';
	      alert('Please mention your business/project.');
	      document.forms[0].item_name.focus();
	      return false;
		}
		
		if(!validateNotEmpty(document.forms[0].amount.value)) {
	      document.forms[0].amount.value = '';
	      alert('Amount can not be empty.');
	      document.forms[0].amount.focus();
	      return false;
		}
		
		if(!validateNumeric(document.forms[0].amount.value)) {
	      document.forms[0].amount.value = '';
	      alert('Enter valid amount.');
	      document.forms[0].amount.focus();
	      return false;
		}
		if(!validateNotEmpty(document.forms[0].first_name.value)) {
	      document.forms[0].first_name.value = '';
	      alert('First name can not be empty.');
	      document.forms[0].first_name.focus();
	      return false;
		}
		if(!validateValue(document.forms[0].first_name.value, alpha)) {
	      alert('Enter valid first name.');
	      document.forms[0].first_name.focus();
	      return false;
		}
		
		//validate last name
		if(!validateNotEmpty(document.forms[0].last_name.value)) {
	      document.forms[0].last_name.value = '';
	      alert('Last name can not be empty.');
	      document.forms[0].last_name.focus();
	      return false;
		}
		if(!validateValue(document.forms[0].last_name.value, alpha)) {
	      alert('Enter valid last name.');
	      document.forms[0].last_name.focus();
	      return false;
		}

		//validate street address
		if(!validateNotEmpty(document.forms[0].address1.value)) {
	      document.forms[0].address1.value = '';
	      alert('address can not be empty.');
	      document.forms[0].address1.focus();
	      return false;
		}
		if(!validateValue(document.forms[0].address1.value, alphanum)) {
	      alert('Enter valid address.');
	      document.forms[0].address1.focus();
	      return;
		}
		
		//validate city
		if(!validateNotEmpty(document.forms[0].city.value)) {
	      document.forms[0].city.value = '';
	      alert('City can not be empty.');
	      document.forms[0].city.focus();
	      return false;
		}
		if(!validateValue(document.forms[0].city.value, alphanum)) {
	      alert('Enter valid city.');
	      document.forms[0].city.focus();
	      return false;
		}
		
		//validate country
		if(document.forms[0].country.selectedIndex == 0) {
	      alert('please select country.');
	      document.forms[0].country.focus();
	      return false;
		}
		
		//validate state
		if(document.forms[0].state.selectedIndex == 0 || document.forms[0].state.selectedIndex == 2) {
	      alert('please select province.');
	      document.forms[0].state.focus();
	      return false;
		}
		
		//validate zip
		if(!validateNotEmpty(document.forms[0].zip.value)) {
	      document.forms[0].zip.value = '';
	      alert('Zip can not be empty.');
	      document.forms[0].zip.focus();
	      return false;
		}
		if(!validateValue(document.forms[0].zip.value, alphanum)) {
	      alert('Enter valid zip.');
	      document.forms[0].zip.focus();
	      return false;
		}
		
		//validate phone
		if(!validateNotEmpty(document.forms[0].H_PhoneNumber.value)) {
	      document.forms[0].H_PhoneNumber.value = '';
	      alert('phone can not be empty.');
	      document.forms[0].H_PhoneNumber.focus();
	      return false;
		}
		if(!validateValue(document.forms[0].H_PhoneNumber.value, alphanum)) {
	      alert('Enter valid phone.');
	      document.forms[0].H_PhoneNumber.focus();
	      return false;
		}

		//validate email
		if(!validateNotEmpty(document.forms[0].email.value)) {
	      document.forms[0].email.value = '';
	      alert('email can not be empty.');
	      document.forms[0].email.focus();
	      return false;
		}
		if(!validateEmail(document.forms[0].email.value)) {
	      alert('Enter valid email.');
	      document.forms[0].email.focus();
	      return false;
		
		}
		
		return true;
	}
	