function showBox(showBox) {
	if (showBox=='-') {
		document.getElementById('other').style.display='block';
	} else {
		document.getElementById('other').style.display='none';
	}
}

function setShippingInfo(isChecked) {
	with (window.document.frmRegister) {
		if (isChecked) {
			document.getElementById('ship_info').style.display='none';
		} else {
			document.getElementById('ship_info').style.display='block';		
		}
	}
}

function checkRegister() {
	var frm = document.frmRegister;

	if((/^[a-zA-Z0-9._-]+@([a-zA-Z0-9.-]+\.)+[a-zA-Z]{2,5}$/).exec(frm.email.value)==null){
		alert("Enter a proper E-mail");
		frm.email.focus();
		return false;
	}
	if((/^[a-zA-Z0-9._-]+@([a-zA-Z0-9.-]+\.)+[a-zA-Z]{2,5}$/).exec(frm.confirm_email.value)==null){
		alert("Enter a proper E-mail");
		frm.confirm_email.focus();
		return false;
	}
	if(frm.email.value!=frm.confirm_email.value) {
		alert ("The two E-Mail Addresses don't match");
		frm.email.focus(); frm.confirm_email.value="";
		return false;
	}
	
	if (isEmpty(frm.password, 'Enter Password')) {
		frm.password.focus();
		return false;
	} else {
		if(frm.password.value.length < 6) {
			alert ("Password should of minimum 6 characters");
			frm.password.focus();	frm.password.value="";	frm.confirm_password.value="";
			return false;
		} else if(frm.password.value!=frm.confirm_password.value) {
			alert ("The two passwords don't match");
			frm.password.focus();	frm.password.value="";	frm.confirm_password.value="";
			return false;
		}
	}
	
	// billing info validation
	if (isEmpty(frm.bill_first_name, 'Enter First Name')) {
		frm.bill_first_name.focus();
		return false;
	}
	if (isEmpty(frm.bill_last_name, 'Enter Last Name')) {
		frm.bill_last_name.focus();
		return false;
	}
	if(frm.bill_gender[0].checked==false && frm.bill_gender[1].checked==false) {
		alert ("Select gender");
		return false;
	}
	
	if (isEmpty(frm.bill_address1, 'Enter Address')) {
		frm.bill_address1.focus();
		return false;
	}
	if (isEmpty(frm.bill_city_state, 'Enter City/State')) {
		frm.bill_city_state.focus();
		return false;
	}
	if (isEmpty(frm.bill_postal_code, 'Enter Postal Code')) {
		frm.bill_postal_code.focus();
		return false;
	}
	if (frm.bill_country.selectedIndex == 0) {
		alert('Choose the country');
		frm.bill_country.focus();
		return false;
	}
	if(frm.bill_phone1.value=="" || frm.bill_phone2.value=="") {
		alert ("Enter Home Telephone");
		frm.bill_phone1.focus();
		return false;
	}
	if(frm.bill_mobile1.value || frm.bill_mobile2.value) {
		if(frm.bill_mobile1.value=="" || frm.bill_mobile2.value=="") {
			alert ("Enter Full Mobile no");
			frm.bill_mobile1.focus();
			return false;
		}
	}
	if (frm.hrd_abt_us.selectedIndex == 0) {
		alert('Choose Where you heard about us');
		frm.hrd_abt_us.focus();
		return false;
	}
	if (frm.hrd_abt_us.value == "-" && frm.other_specify.value=="") {
		alert('Please Specify Where you heard about us');
		frm.other_specify.focus();
		return false;
	}
	
	
	if(frm.chkSame.checked==false) {
		// shipping info validation
		if (isEmpty(frm.ship_first_name, 'Enter First Name')) {
			frm.ship_first_name.focus();
			return false;
		}
		if (isEmpty(frm.ship_last_name, 'Enter Last Name')) {
			frm.ship_last_name.focus();
			return false;
		}
		if(frm.ship_gender[0].checked==false && frm.ship_gender[1].checked==false) {
			alert ("Select gender");
			return false;
		}
		
		if (isEmpty(frm.ship_address1, 'Enter Address')) {
			frm.ship_address1.focus();
			return false;
		}
		if (isEmpty(frm.ship_city_state, 'Enter City/State')) {
			frm.ship_city_state.focus();
			return false;
		}
		if (isEmpty(frm.ship_postal_code, 'Enter Postal Code')) {
			frm.ship_postal_code.focus();
			return false;
		}
		if (frm.ship_country.selectedIndex == 0) {
			alert('Choose the country');
			frm.ship_country.focus();
			return false;
		}
		if(frm.ship_phone1.value=="" || frm.ship_phone2.value=="") {
			alert ("Enter Telephone");
			frm.ship_phone1.focus();
			return false;
		}
		if(frm.ship_mobile1.value || frm.ship_mobile2.value) {
			if(frm.ship_mobile1.value=="" || frm.ship_mobile2.value=="") {
				alert ("Enter Full Mobile no");
				frm.ship_mobile1.focus();
				return false;
			}
		}
	}
	
	if (frm.hear_about_us.selectedIndex == 0) {
		alert('Choose how did you hear about us');
		frm.hear_about_us.focus();
		return false;
	}
	
	return true;
}
