// JavaScript Document

function stopRKey(evt) { 
  var evt = (evt) ? evt : ((event) ? event : null); 
  var node = (evt.target) ? evt.target : ((evt.srcElement) ? evt.srcElement : null); 
  if ((evt.keyCode == 13) && (node.type=="text"))  {return false;} 
} 

document.onkeypress = stopRKey;

// What Is Popups
function whatIsPopup(url) {
	window.open(url,'whatis','width=600,height=400,menubar=no,status=no,location=no,toolbar=no,scrollbars=no');
}


// Common Functions
function backButtonOverrideBody() {
	try {
		history.forward();
	} catch (e) {
		// OK to ignore
	}
	setTimeout("backButtonOverrideBody()", 500);
}
// Candidate Registration
function selectProv() {
	document.getElementById("province").value = userProv;
	document.getElementById("otherProv").value = userProv;
}
function selectShipProv() {
	document.getElementById("provinceShip").value = userShipProv;
	document.getElementById("otherShipProv").value = userShipProv;
}

function emptyList( box ) {
	while ( box.options.length ) box.options[0] = null;
}

function fillList( box, arr ) {
	// arr[0] holds the display text
	// arr[1] are the values
	if (arr == lists['Canada'] || arr == lists['US']) {
		for ( i = 0; i < arr[0].length; i++ ) {
			// Create a new drop down option with the
			// display text and value from arr
			option = new Option( arr[0][i], arr[1][i] );
			// Add to the end of the existing options
			box.options[box.length] = option;
		}
	}
	// Preselect option 0
	box.selectedIndex=0;
}

function changeList( box ) {
	var td = document.getElementById('tr_province');
	td.style.display = 'none';
	var td = document.getElementById('tr_otherProvince');
	td.style.display = '';
	
	if (box.options[box.selectedIndex].value == 'Canada' || box.options[box.selectedIndex].value == 'US' ) {
		var td = document.getElementById('tr_province');
		td.style.display = '';
		var td = document.getElementById('tr_otherProvince');
		td.style.display = 'none';
	}
	
	list = lists[box.options[box.selectedIndex].value];
	emptyList( box.form.province );
	fillList( box.form.province, list );
}

function changeShipList( box ) {
	var td = document.getElementById('tr_shipProvince');
	td.style.display = 'none';
	var td = document.getElementById('tr_otherShipProvince');
	td.style.display = '';
	
	if (box.options[box.selectedIndex].value == 'Canada' || box.options[box.selectedIndex].value == 'US' ) {
		var td = document.getElementById('tr_shipProvince');
		td.style.display = '';
		var td = document.getElementById('tr_otherShipProvince');
		td.style.display = 'none';
	}
	
	list = lists[box.options[box.selectedIndex].value];
	emptyList( box.form.provinceShip );
	fillList( box.form.provinceShip, list );
}

function copyAddress(){
	document.getElementById("addressShip").value = document.getElementById("address").value;
	document.getElementById("aptShip").value = document.getElementById("apt").value;
	document.getElementById("cityShip").value = document.getElementById("city").value;
	document.getElementById("postalCodeShip").value = document.getElementById("postalCode").value;
	document.getElementById("countryShip").value = document.getElementById("country").value;
	changeShipList(document.getElementById("countryShip"));
	document.getElementById("provinceShip").value = document.getElementById("province").value;
	document.getElementById("otherShipProv").value = document.getElementById("otherProv").value;
	document.getElementById("phone1Ship").value = document.getElementById("phone1").value;
	document.getElementById("phone2Ship").value = document.getElementById("phone2").value;
	document.getElementById("phone3Ship").value = document.getElementById("phone3").value;
	document.getElementById("addressShip").focus();
}

function ignoreDuplicateUser() {
	document.getElementById("dupCheck").value = 0;
	alert('You must re-submit the form to continue.');
}

function validate_boaterReg(form){
	var errResult = "";
	var isValid = true;
	
	// Duplicate User Check
	if (form.dupCheck.value == 1) {
		var cfcAsAjax = new jsobj();
		var tmp;
		tmp = cfcAsAjax.checkDuplicateUser(form.nameFirst.value,form.nameLast.value,form.email.value);
		if(!tmp == 1) {
			errResult = errResult + "It appears that you may have already registered an account. <a href='/en/userservices/login.cfm'><b>Click here to login</b></a> or ignore and re-submit to create a new account.<br/>";
			isValid = false;
		}
		form.dupCheck.value = 0;
	}
	
	if (form.nameFirst.value == ""){
		errResult = "A first name is required.<br/>";
		isValid = false;}
	
	if (form.nameFirst.value.indexOf('<') != -1 || 
	 form.nameFirst.value.indexOf('>') != -1 || 
	 form.nameFirst.value.indexOf('/') != -1 || 
	 form.nameFirst.value.indexOf('\\') != -1 || 
	 form.nameFirst.value.indexOf('&') != -1 ){
		errResult = "The First Name contains invalid characters.<br/>";
		isValid = false;}

	if (form.nameLast.value == ""){
		errResult = errResult + "A last name is required.<br/>";
		isValid = false;}

	if (form.nameLast.value.indexOf('<') != -1 || 
	 form.nameLast.value.indexOf('>') != -1 || 
	 form.nameLast.value.indexOf('/') != -1 || 
	 form.nameLast.value.indexOf('\\') != -1 || 
	 form.nameLast.value.indexOf('&') != -1 ){
		errResult = "The Last Name contains invalid characters.<br/>";
		isValid = false;}
		
	if (form.birthMonth.options[form.birthMonth.selectedIndex].value == "") {
		errResult = errResult + "A birth date is required.<br/>";
		isValid = false;}
		
	if (form.birthDay.options[form.birthDay.selectedIndex].value == "") {
		errResult = errResult + "A birth date is required.<br/>";
		isValid = false;}
		
	if (form.birthYear.options[form.birthYear.selectedIndex].value == "") {
		errResult = errResult + "A birth date is required.<br/>";
		isValid = false;}

	if (form.address.value == ""){
		errResult = errResult + "An address is required.<br/>";
		isValid = false;}

	if (form.address.value.indexOf('<') != -1 || 
	 form.address.value.indexOf('>') != -1 || 
	 form.address.value.indexOf('/') != -1 || 
	 form.address.value.indexOf('\\') != -1 || 
	 form.address.value.indexOf('&') != -1 ){
		errResult = "The Street Address contains invalid characters.<br/>";
		isValid = false;}

	if (form.apt.value.indexOf('<') != -1 || 
	 form.apt.value.indexOf('>') != -1 || 
	 form.apt.value.indexOf('/') != -1 || 
	 form.apt.value.indexOf('\\') != -1 || 
	 form.apt.value.indexOf('&') != -1 ){
		errResult = "The Unit/Apt contains invalid characters.<br/>";
		isValid = false;}
		
	if (form.city.value == ""){
		errResult = errResult + "A city is required.<br/>";
		isValid = false;}

	if (form.city.value.indexOf('<') != -1 || 
	 form.city.value.indexOf('>') != -1 || 
	 form.city.value.indexOf('/') != -1 || 
	 form.city.value.indexOf('\\') != -1 || 
	 form.city.value.indexOf('&') != -1 ){
		errResult = "The City contains invalid characters.<br/>";
		isValid = false;}

	if (form.postalCode.value == ""){
		errResult = errResult + "A postal code is required.<br/>";
		isValid = false;}

	if (form.postalCode.value.indexOf('<') != -1 || 
	 form.postalCode.value.indexOf('>') != -1 || 
	 form.postalCode.value.indexOf('/') != -1 || 
	 form.postalCode.value.indexOf('\\') != -1 || 
	 form.postalCode.value.indexOf('&') != -1 ){
		errResult = "The Postal Code contains invalid characters.<br/>";
		isValid = false;}

	if (form.phone1.value == ""||form.phone2.value == ""||form.phone3.value == ""){
		errResult = errResult + "A phone number is required.<br/>";
		isValid = false;}
	if (isNaN(form.phone1.value)||isNaN(form.phone2.value)||isNaN(form.phone3.value)){
		errResult = errResult + "The phone number must be numeric.<br/>";
		isValid = false;}

	var emailExp = /^[\w\-\.\+]+\@[a-zA-Z0-9\.\-]+\.[a-zA-z0-9]{2,4}$/;
	if (!form.email.value.match(emailExp)){
		errResult = errResult + "A valid email is required.<br/>";
		isValid = false;}
	
	if(!form.email.value == form.emailConfirm.value) {
		errResult = errResult + "Please confirm your email address.<br/>";
		isValid = false;}

	/*SHIPPING ADDRESS*/
	if (form.addressShip.value == ""){
		errResult = errResult + "A shipping address is required.<br/>";
		isValid = false;}

	if (form.addressShip.value.indexOf('<') != -1 || 
	 form.addressShip.value.indexOf('>') != -1 || 
	 form.addressShip.value.indexOf('/') != -1 || 
	 form.addressShip.value.indexOf('\\') != -1 || 
	 form.addressShip.value.indexOf('&') != -1 ){
		errResult = "The Shipping Address contains invalid characters.<br/>";
		isValid = false;}

	if (form.aptShip.value.indexOf('<') != -1 || 
	 form.aptShip.value.indexOf('>') != -1 || 
	 form.aptShip.value.indexOf('/') != -1 || 
	 form.aptShip.value.indexOf('\\') != -1 || 
	 form.aptShip.value.indexOf('&') != -1 ){
		errResult = "The Shipping Unit/Apt contains invalid characters.<br/>";
		isValid = false;}

	if (form.cityShip.value == ""){
		errResult = errResult + "A shipping city is required.<br/>";
		isValid = false;}

	if (form.cityShip.value.indexOf('<') != -1 || 
	 form.cityShip.value.indexOf('>') != -1 || 
	 form.cityShip.value.indexOf('/') != -1 || 
	 form.cityShip.value.indexOf('\\') != -1 || 
	 form.cityShip.value.indexOf('&') != -1 ){
		errResult = "The Shipping City contains invalid characters.<br/>";
		isValid = false;}

	if (form.postalCodeShip.value == ""){
		errResult = errResult + "A shipping postal code is required.<br/>";
		isValid = false;}

	if (form.postalCodeShip.value.indexOf('<') != -1 || 
	 form.postalCodeShip.value.indexOf('>') != -1 || 
	 form.postalCodeShip.value.indexOf('/') != -1 || 
	 form.postalCodeShip.value.indexOf('\\') != -1 || 
	 form.postalCodeShip.value.indexOf('&') != -1 ){
		errResult = "The Shipping Postal code contains invalid characters.<br/>";
		isValid = false;}

	if (form.phone1Ship.value == ""||form.phone2Ship.value == ""||form.phone3Ship.value == ""){
		errResult = errResult + "A shipping phone number is required.<br/>";
		isValid = false;}
	if (isNaN(form.phone1Ship.value)||isNaN(form.phone2Ship.value)||isNaN(form.phone3Ship.value)){
		errResult = errResult + "The shipping phone number must be numeric.<br/>";
		isValid = false;}

	/*PAYMENT OPTION*/
	var paymentOption = 0;
	for (var i=0; i<form.payOpt.length; i++) {
		if (form.payOpt[i].checked == true) {
			paymentOption = i;
			break;}
	}
	
	// Promo Code Check
	if(paymentOption == 0 || paymentOption == 1 || paymentOption == 2 || paymentOption == 3) {
		if (!form.discCode.value == "") {
			var cfcAsAjax = new jsobj();
			var tmpValue;
			var tmp;
			tmp = form.discCode.value;
			//tmpValue = form.discCode.value.toLowerCase();
			//tmpValue = tmpValue.split(' ').join('');
			tmp = cfcAsAjax.validateCode(tmp);
			if(!tmp == 1) {
				errResult = errResult + "The Promotion/Discount Code you entered is invalid.<br/>";
				isValid = false;
			}
		}
	}
	
	if (paymentOption == 4){
		if (form.voucherCode.value == ""){
			errResult = errResult + "Please enter your Voucher Code.<br/>";
			isValid = false;
		}
	}
	
	if (form.agreeTerms.checked == false){
		errResult = errResult + "You must agree to the terms of use and privacy policy to continue.<br/>";
		isValid = false;}
	
	if (!isValid){
		document.getElementById("errMsg").style.display = "block";
		document.getElementById("errMsg").innerHTML = errResult;
		window.scrollTo(0,0);}

	return isValid;
}

function boaterReg_paymentType(typeID) {
	if (typeID == 1) {
		mydiv = document.getElementById("promoCode");
		mydiv.style.display = "block";
		mydiv = document.getElementById("promoCode1");
		mydiv.style.display = "block";
		mydiv = document.getElementById("voucherCode");
		mydiv.style.display = "none";
		mydiv = document.getElementById("voucherCode1");
		mydiv.style.display = "none";
	}else if (typeID == 2) {
		mydiv = document.getElementById("promoCode");
		mydiv.style.display = "none";
		mydiv = document.getElementById("promoCode1");
		mydiv.style.display = "none";
		mydiv = document.getElementById("voucherCode");
		mydiv.style.display = "block";
		mydiv = document.getElementById("voucherCode1");
		mydiv.style.display = "block";
	}
}

function validate_boaterLogin(form){
	var errResult = "";
	var isValid = true;
	if (form.username.value == "" || form.username.value == "username"){
		errResult = "A username is required.<br/>";
		isValid = false;}
	
	if (form.password.value == "" || form.password.value == "password"){
		errResult = errResult + "A password is required.<br/>";
		isValid = false;}
		
	if (!isValid){
		document.getElementById("errMsg").style.display = "block";
		document.getElementById("errMsg").innerHTML = errResult;
		window.scrollTo(0,0);}

	return isValid;
}

// Candidate Cart Functions
function updateNumCards(){
	window.location = "yourCart.cfm?numbOfCards=" + 	document.getElementById("addCards").value;
}

function cartCopyAddress(){
	document.getElementById("SHIP_ADDRESS1").value = document.getElementById("BILL_ADDRESS1").value;
	document.getElementById("SHIP_ADDRESS2").value = document.getElementById("BILL_ADDRESS2").value;
	document.getElementById("SHIP_CITY").value = document.getElementById("BILL_CITY").value;
	document.getElementById("SHIP_POSTAL_CODE").value = document.getElementById("BILL_POSTAL_CODE").value;
	document.getElementById("countryShip").value = document.getElementById("country").value;
	changeShipList(document.getElementById("countryShip"));
	document.getElementById("provinceShip").value = document.getElementById("province").value;
	document.getElementById("otherShipProv").value = document.getElementById("otherProv").value;
	document.getElementById("shipphone1").value = document.getElementById("phone1").value;
	document.getElementById("shipphone2").value = document.getElementById("phone2").value;
	document.getElementById("shipphone3").value = document.getElementById("phone3").value;
	document.getElementById("addressShip").focus();
}

function validate_boaterCart(form){
	var errResult = "";
	var isValid = true;
	
	submitcount++;
	if (1 == submitcount ) {
		document.Order.submit();
	}else{
		alert("You have already submitted  this form");
		isValid = false;
	}

	if (form.BILL_ADDRESS1.value == ""){
		errResult = errResult + "An address is required.<br/>";
		isValid = false;}

	if (form.BILL_CITY.value == ""){
		errResult = errResult + "A city is required.<br/>";
		isValid = false;}

	if (form.BILL_POSTAL_CODE.value == ""){
		errResult = errResult + "A postal code is required.<br/>";
		isValid = false;}

	if (form.phone1.value == ""||form.phone2.value == ""||form.phone3.value == ""){
		errResult = errResult + "A phone number is required.<br/>";
		isValid = false;}
	if (isNaN(form.phone1.value)||isNaN(form.phone2.value)||isNaN(form.phone3.value)){
		errResult = errResult + "The phone number must be numeric.<br/>";
		isValid = false;}

	var emailExp = /^[\w\-\.\+]+\@[a-zA-Z0-9\.\-]+\.[a-zA-z0-9]{2,4}$/;
	if (!form.EMAIL.value.match(emailExp)){
		errResult = errResult + "A valid email is required.<br/>";
		isValid = false;}
	
	/*SHIPPING ADDRESS*/
	if (form.SHIP_ADDRESS1.value == ""){
		errResult = errResult + "A shipping address is required.<br/>";
		isValid = false;}

	if (form.SHIP_CITY.value == ""){
		errResult = errResult + "A shipping city is required.<br/>";
		isValid = false;}

	if (form.SHIP_POSTAL_CODE.value == ""){
		errResult = errResult + "A shipping postal code is required.<br/>";
		isValid = false;}
		
	if (form.shipphone1.value == ""||form.shipphone2.value == ""||form.shipphone3.value == ""){
		errResult = errResult + "A shipping phone number is required.<br/>";
		isValid = false;}
	if (isNaN(form.shipphone1.value)||isNaN(form.shipphone2.value)||isNaN(form.shipphone3.value)){
		errResult = errResult + "The shipping phone number must be numeric.<br/>";
		isValid = false;}

	/*PAYMENT OPTION*/
	if((form.payOpt.value == 0 || form.payOpt.value == 1 || form.payOpt.value == 2) || (form.payOpt.value == 5 && CCamount > 0)) {
		if(!isValidCreditCardNumber(form.cardNumber.value, form.CARD_TYPE.value)) {
			errResult = errResult + "A valid credit card number is required. (numbers only / no spaces or dashes)<br/>";
			isValid = false;}
	}
	
	if (!isValid){
		document.getElementById("errMsg").style.display = "block";
		document.getElementById("errMsg").innerHTML = errResult;
		window.scrollTo(0,0);}

	return isValid;
}

// Supervisor Registration
function validate_supervisorReg(form){
	var errResult = "";
	var isValid = true;
	if (form.nameFirst.value == ""){
		errResult = "A first name is required.<br/>";
		isValid = false;}

	if (form.nameLast.value == ""){
		errResult = errResult + "A last name is required.<br/>";
		isValid = false;}

	if (form.address.value == ""){
		errResult = errResult + "An address is required.<br/>";
		isValid = false;}

	if (form.city.value == ""){
		errResult = errResult + "A city is required.<br/>";
		isValid = false;}

	if (form.postalCode.value == ""){
		errResult = errResult + "A postal code is required.<br/>";
		isValid = false;}

	if (form.phone1.value == ""||form.phone2.value == ""||form.phone3.value == ""){
		errResult = errResult + "A phone number is required.<br/>";
		isValid = false;}
	if (isNaN(form.phone1.value)||isNaN(form.phone2.value)||isNaN(form.phone3.value)){
		errResult = errResult + "The phone number must be numeric.<br/>";
		isValid = false;}

	var emailExp = /^[\w\-\.\+]+\@[a-zA-Z0-9\.\-]+\.[a-zA-z0-9]{2,4}$/;
	if (!form.email.value.match(emailExp)){
		errResult = errResult + "A valid email is required.<br/>";
		isValid = false;}

	if (!isValid){
		document.getElementById("errMsg").style.display = "block";
		document.getElementById("errMsg").innerHTML = errResult;
		window.scrollTo(0,0);}

	return isValid;
}

function validate_supervisorLogin(form){
	var errResult = "";
	var isValid = true;
	if (form.supervisorLoginID.value == "" || form.supervisorLoginID.value == "username"){
		errResult = "A username is required.<br/>";
		isValid = false;}
	
	if (form.supervisorLoginPassword.value == "" || form.supervisorLoginPassword.value == "password"){
		errResult = errResult + "A password is required.<br/>";
		isValid = false;}
		
	if (!isValid){
		document.getElementById("errMsg").style.display = "block";
		document.getElementById("errMsg").innerHTML = errResult;
		window.scrollTo(0,0);}

	return isValid;
}

function validate_affiliateProfile(form){
	var errResult = "";
	var isValid = true;
	if (form.address.value == ""){
		errResult = errResult + "An address is required.<br/>";
		isValid = false;}

	if (form.city.value == ""){
		errResult = errResult + "A city is required.<br/>";
		isValid = false;}

	if (form.postalCode.value == ""){
		errResult = errResult + "A postal code is required.<br/>";
		isValid = false;}

	if (form.phone1.value == ""||form.phone2.value == ""||form.phone3.value == ""){
		errResult = errResult + "A phone number is required.<br/>";
		isValid = false;}
	if (isNaN(form.phone1.value)||isNaN(form.phone2.value)||isNaN(form.phone3.value)){
		errResult = errResult + "The phone number must be numeric.<br/>";
		isValid = false;}

	var emailExp = /^[\w\-\.\+]+\@[a-zA-Z0-9\.\-]+\.[a-zA-z0-9]{2,4}$/;
	if (!form.email.value.match(emailExp)){
		errResult = errResult + "A valid email is required.<br/>";
		isValid = false;}
	
	if (!isValid){
		document.getElementById("errMsg").style.display = "block";
		document.getElementById("errMsg").innerHTML = errResult;
		window.scrollTo(0,0);}

	return isValid;
}

function validate_affiliateReg(form){
	var errResult = "";
	var isValid = true;
	if (form.company.value == ""){
		errResult = "A company name is required.<br/>";
		isValid = false;}

	if (form.nameFirst.value == ""){
		errResult = "A first name is required.<br/>";
		isValid = false;}

	if (form.nameLast.value == ""){
		errResult = errResult + "A last name is required.<br/>";
		isValid = false;}

	if (form.address.value == ""){
		errResult = errResult + "An address is required.<br/>";
		isValid = false;}

	if (form.city.value == ""){
		errResult = errResult + "A city is required.<br/>";
		isValid = false;}

	if (form.postalCode.value == ""){
		errResult = errResult + "A postal code is required.<br/>";
		isValid = false;}

	if (form.phone1.value == ""||form.phone2.value == ""||form.phone3.value == ""){
		errResult = errResult + "A phone number is required.<br/>";
		isValid = false;}
	if (isNaN(form.phone1.value)||isNaN(form.phone2.value)||isNaN(form.phone3.value)){
		errResult = errResult + "The phone number must be numeric.<br/>";
		isValid = false;}

	var emailExp = /^[\w\-\.\+]+\@[a-zA-Z0-9\.\-]+\.[a-zA-z0-9]{2,4}$/;
	if (!form.email.value.match(emailExp)){
		errResult = errResult + "A valid email is required.<br/>";
		isValid = false;}
	
	if (!isValid){
		document.getElementById("errMsg").style.display = "block";
		document.getElementById("errMsg").innerHTML = errResult;
		window.scrollTo(0,0);}

	return isValid;
}

function validate_enterExamsReg(form){
	var errResult = "";
	var isValid = true;
	if (form.nameFirst.value == ""){
		errResult = "A first name is required.<br/>";
		isValid = false;}

	if (form.nameLast.value == ""){
		errResult = errResult + "A last name is required.<br/>";
		isValid = false;}

	if (form.address.value == ""){
		errResult = errResult + "An address is required.<br/>";
		isValid = false;}

	if (form.city.value == ""){
		errResult = errResult + "A city is required.<br/>";
		isValid = false;}

	if (form.postalCode.value == ""){
		errResult = errResult + "A postal code is required.<br/>";
		isValid = false;}

	if (form.phone1.value == ""||form.phone2.value == ""||form.phone3.value == ""){
		errResult = errResult + "A phone number is required.<br/>";
		isValid = false;}
	if (isNaN(form.phone1.value)||isNaN(form.phone2.value)||isNaN(form.phone3.value)){
		errResult = errResult + "The phone number must be numeric.<br/>";
		isValid = false;}

	var emailExp = /^[\w\-\.\+]+\@[a-zA-Z0-9\.\-]+\.[a-zA-z0-9]{2,4}$/;
	if (!form.email.value.match(emailExp)){
		errResult = errResult + "A valid email is required.<br/>";
		isValid = false;}
	
	if(form.examDate.value == "") {
		errResult = errResult + "An exam date is required.<br/>";
		isValid = false;}
	else{
		var dateExp = /^\d{2}\/\d{2}\/\d{4}$/;
		if (!form.examDate.value.match(dateExp)){
			errResult = errResult + "The exam date is invalid.<br/>";
			isValid = false;}
	}

	if(form.examScore.value == "") {
		errResult = errResult + "An exam score is required.<br/>";
		isValid = false;}
	else{
		if(form.examScore.value < 0 || form.examScore.value > 36) {
			errResult = errResult + "The exam score is invalid. (0-36)<br/>";
			isValid = false;}
	}

	
	if (!isValid){
		document.getElementById("errMsg").style.display = "block";
		document.getElementById("errMsg").innerHTML = errResult;
		window.scrollTo(0,0);}

	return isValid;
}

function validate_boaterProfile(form){
	var errResult = "";
	var isValid = true;
	if (form.address.value == ""){
		errResult = errResult + "An address is required.<br/>";
		isValid = false;}

	if (form.city.value == ""){
		errResult = errResult + "A city is required.<br/>";
		isValid = false;}

	if (form.postalCode.value == ""){
		errResult = errResult + "A postal code is required.<br/>";
		isValid = false;}

	if (form.phone1.value == ""||form.phone2.value == ""||form.phone3.value == ""){
		errResult = errResult + "A phone number is required.<br/>";
		isValid = false;}
	if (isNaN(form.phone1.value)||isNaN(form.phone2.value)||isNaN(form.phone3.value)){
		errResult = errResult + "The phone number must be numeric.<br/>";
		isValid = false;}

	var emailExp = /^[\w\-\.\+]+\@[a-zA-Z0-9\.\-]+\.[a-zA-z0-9]{2,4}$/;
	if (!form.email.value.match(emailExp)){
		errResult = errResult + "A valid email is required.<br/>";
		isValid = false;}
	
	/*SHIPPING ADDRESS*/
	if (form.addressShip.value == ""){
		errResult = errResult + "A shipping address is required.<br/>";
		isValid = false;}

	if (form.cityShip.value == ""){
		errResult = errResult + "A shipping city is required.<br/>";
		isValid = false;}

	if (form.postalCodeShip.value == ""){
		errResult = errResult + "A shipping postal code is required.<br/>";
		isValid = false;}

	if (form.phone1Ship.value == ""||form.phone2Ship.value == ""||form.phone3Ship.value == ""){
		errResult = errResult + "A shipping phone number is required.<br/>";
		isValid = false;}
	if (isNaN(form.phone1Ship.value)||isNaN(form.phone2Ship.value)||isNaN(form.phone3Ship.value)){
		errResult = errResult + "The shipping phone number must be numeric.<br/>";
		isValid = false;}

	if (!isValid){
		document.getElementById("errMsg").style.display = "block";
		document.getElementById("errMsg").innerHTML = errResult;
		window.scrollTo(0,0);}

	return isValid;
}
/*
function verifyAgreement(form){
	if (form.agreement.checked) {
		return true;
	}else{
		errResult = "You must read and accept the agreement.";
		document.getElementById("errMsg").style.border = "1px solid #0000CC";
		document.getElementById("errMsg").style.padding = "10px 10px 10px 10px";
		document.getElementById("errMsg").innerHTML = errResult;
		document.getElementById("errMsg").style.display = "block"; 
		window.scrollTo(0,0);
		return false;}
}
*/
function declineAgreement() {
	errResult = "You must read and accept the agreement.";
	document.getElementById("errMsg").style.border = "1px solid #0000CC";
	document.getElementById("errMsg").style.padding = "10px 10px 10px 10px";
	document.getElementById("errMsg").innerHTML = errResult;
	document.getElementById("errMsg").style.display = "block"; 
	window.scrollTo(0,0);
	return false;
}