/**
 * shopping_cart.js - JavaScript functions for Shopping Cart Functionality.
 * @author OSD :: Victor Leonard
 * @copyright 2005 - 2006 Victor Leonard
 */


function popUp(URL, height, width, scroll, resize) {
	day = new Date();
	id = day.getTime();
	eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=" + scroll + ",location=0,statusbar=0,menubar=0,resizable=" + resize + ",width=" + width + ",height=" + height + ",left = 10,top = 10');");
}

function CheckCheckoutDetails(){ 
    var o_race_cat = o_team = o_tshirt = "";
	var pass = true;
	var details = 'Invalid information entered.\n\n';
    var inputVal = document.form.o_email.value;

	var j = document.form.o_race_cat.length;
	for (i=0; i<j; i++){
		if(document.form.o_race_cat[i].checked) o_race_cat = document.form.o_race_cat[i].value;
	}
	if (o_race_cat == '') { 
		details+= '- Please select your Race Category.\n\n';
		//if (pass) document.form.o_race_cat.focus();
		pass = false;
	}
	if (document.form.o_firstname.value == '') { 
		details+= '- Please enter your First Name.\n\n';
		if (pass) document.form.o_firstname.focus();
		pass = false;
	}
	if (document.form.o_lastname.value == '') { 
		details+= '- Please enter your Last Name.\n\n';
		if (pass) document.form.o_lastname.focus();
		pass = false;
	}
	if (document.form.o_dob_date.value == '') { 
		details+= '- Please select your Date of Birth - Date.\n\n';
		if (pass) document.form.o_dob_date.focus();
		pass = false;
	}
	if (document.form.o_dob_month.value == '') { 
		details+= '- Please select your Date of Birth - Month.\n\n';
		if (pass) document.form.o_dob_month.focus();
		pass = false;
	}
	if (document.form.o_dob_year.value == '') { 
		details+= '- Please select your Date of Birth - Year.\n\n';
		if (pass) document.form.o_dob_year.focus();
		pass = false;
	}
	if ((inputVal == '') || (inputVal.indexOf("@") == -1) || (inputVal.indexOf(".") == -1)) { 
		details+= '- Please enter a valid Email Address.\n\n';
    	if (pass) document.form.o_email.focus();
		pass = false;
	}
	if (inputVal != document.form.o_emailconf.value) { 
		details+= '- Please make sure the Email Address matches the Confirm field.\n\n';
    	if (pass) document.form.o_emailconf.focus();
		pass = false;
	}
	if (document.form.o_address1.value == '') { 
		details+= '- Please enter your Address Line 1.\n\n';
    	if (pass) document.form.o_address1.focus();
		pass = false;
	}
	if (document.form.o_address2.value == '') { 
		details+= '- Please enter your Address Line 2.\n\n';
    	if (pass) document.form.o_address2.focus();
		pass = false;
	}
	if (document.form.o_city.value == '') { 
		details+= '- Please enter your City.\n\n';
    	if (pass) document.form.o_city.focus();
		pass = false;
	}
	if (document.form.o_county.value == '') { 
		details+= '- Please select a value for State or County/Province.\n\n';
    	if (pass) document.form.o_county.focus();
		pass = false;
	}
	if (document.form.o_country.value == '') { 
		details+= '- Please select your Country.\n\n';
    	if (pass) document.form.o_country.focus();
		pass = false;
	}
	j = document.form.o_tshirt.length;
	for (i=0; i<j; i++){
		if(document.form.o_tshirt[i].checked) o_tshirt = document.form.o_tshirt[i].value;
	}
	if (o_tshirt == '') { 
		details+= '- Please select your T-Shirt size.\n\n';
    	//if (pass) document.form.o_tshirt.focus();
		pass = false;
	}
	if (!document.form.o_tick.checked) {
		details+= '- Please confirm you have Read and Accept All Rules, Terms and Conditions.\n\n';
    	if (pass) document.form.o_tick.focus();
		pass = false;
	}
	if (pass) { 
		//return false;
		return true;
	}
	else { 
		details+= 'Please correct the above errors before proceeding.    \n\n';
		alert(details);
		return false;
	}
}

function CheckCheckoutDetailsWalker(){ 
    var o_race_cat = o_team = o_tshirt = "";
	var pass = true;
	var details = 'Invalid information entered.\n\n';
    var inputVal = document.form.o_email.value;

	if (document.form.o_firstname.value == '') { 
		details+= '- Please enter your First Name.\n\n';
		if (pass) document.form.o_firstname.focus();
		pass = false;
	}
	if (document.form.o_lastname.value == '') { 
		details+= '- Please enter your Last Name.\n\n';
		if (pass) document.form.o_lastname.focus();
		pass = false;
	}
	if (document.form.o_dob_date.value == '') { 
		details+= '- Please select your Date of Birth - Date.\n\n';
		if (pass) document.form.o_dob_date.focus();
		pass = false;
	}
	if (document.form.o_dob_month.value == '') { 
		details+= '- Please select your Date of Birth - Month.\n\n';
		if (pass) document.form.o_dob_month.focus();
		pass = false;
	}
	if (document.form.o_dob_year.value == '') { 
		details+= '- Please select your Date of Birth - Year.\n\n';
		if (pass) document.form.o_dob_year.focus();
		pass = false;
	}
	if ((inputVal == '') || (inputVal.indexOf("@") == -1) || (inputVal.indexOf(".") == -1)) { 
		details+= '- Please enter a valid Email Address.\n\n';
    	if (pass) document.form.o_email.focus();
		pass = false;
	}
	if (inputVal != document.form.o_emailconf.value) { 
		details+= '- Please make sure the Email Address matches the Confirm field.\n\n';
    	if (pass) document.form.o_emailconf.focus();
		pass = false;
	}
	if (document.form.o_address1.value == '') { 
		details+= '- Please enter your Address Line 1.\n\n';
    	if (pass) document.form.o_address1.focus();
		pass = false;
	}
	if (document.form.o_address2.value == '') { 
		details+= '- Please enter your Address Line 2.\n\n';
    	if (pass) document.form.o_address2.focus();
		pass = false;
	}
	if (document.form.o_city.value == '') { 
		details+= '- Please enter your City.\n\n';
    	if (pass) document.form.o_city.focus();
		pass = false;
	}
	if (document.form.o_county.value == '') { 
		details+= '- Please select a value for State or County/Province.\n\n';
    	if (pass) document.form.o_county.focus();
		pass = false;
	}
	if (document.form.o_country.value == '') { 
		details+= '- Please select your Country.\n\n';
    	if (pass) document.form.o_country.focus();
		pass = false;
	}
	j = document.form.o_tshirt.length;
	for (i=0; i<j; i++){
		if(document.form.o_tshirt[i].checked) o_tshirt = document.form.o_tshirt[i].value;
	}
	if (o_tshirt == '') { 
		details+= '- Please select your T-Shirt size.\n\n';
    	//if (pass) document.form.o_tshirt.focus();
		pass = false;
	}
	if (!document.form.o_tick.checked) {
		details+= '- Please confirm you have Read and Accept All Rules, Terms and Conditions.\n\n';
    	if (pass) document.form.o_tick.focus();
		pass = false;
	}
	if (pass) { 
		//return false;
		return true;
	}
	else { 
		details+= 'Please correct the above errors before proceeding.    \n\n';
		alert(details);
		return false;
	}
}

