function getObj(nm) {
	if (document.getElementById) {
		return document.getElementById(nm);
	} else if (document.all) {
		return document.all[nm];
	} else {
		return eval("document." + nm);
	}
}

function adjust_menuheight(status) {
	if (status == 1) {
		var main_content_height = document.getElementById('central_content_holder_norhs').offsetHeight;
	} else {
		var main_content_height = document.getElementById('central_content_holder').offsetHeight;
	}
	if (main_content_height > document.getElementById('vertical_menu_holder').offsetHeight) {
		document.getElementById('vertical_menu_holder').style.height = main_content_height;
	}
	//alert(document.getElementById('central_content_holder').offsetHeight);	
	//alert(document.getElementById('vertical_menu_holder').offsetHeight);
}
//
//buttons
function buttonOn(buttonID, image) {
	getObj("buttonImage" + buttonID).src = "graphics/navigation/button_" + image + "_over.gif";
}
//
function buttonOut(buttonID, image) {
	getObj("buttonImage" + buttonID).src = "graphics/navigation/button_" + image + ".gif";
}

<!--
function openWin( windowURL, windowName, windowFeatures ) { 
	return window.open( windowURL, windowName, windowFeatures ) ; 
} 
// -->
function emailpage(){	
	var emailpage=window.open("emailpage.asp?pageurl=" + escape(document.location.href), "emailpage", "width=340,height=290,locationbar=0,menubar=0,personalbar=0,status=0,scrollbars=0,resizable=0");
}

function shown_orderinginfo(sessionid) {
	var orderinfopage=window.open("contentpopup.asp?pageid=6&state_sessionid=" + sessionid, "emailpage", "width=500,height=450,locationbar=0,menubar=0,personalbar=0,status=0,scrollbars=1,resizable=0");
}

function create_notify(product_id, acc_id, catid) {
	var notifypage=window.open("create_notify.asp?product_id=" + product_id + "&acc=" + acc_id + "&categories_id=" + catid, "Product_Notification", "width=500,height=350,locationbar=0,menubar=0,personalbar=0,status=0,scrollbars=0,resizable=0");
}

function check_notify() {
	valid = 1;
	message = "You have not completed all the required fields, please check:\n";
	formName = document.forms['create_notify'];
	//
	if (formName.elements["customer_name"].value == "") {
		valid = 0;
		message += "Name\n";
		getObj("customer_name").style.border = "#aa0000 solid 1px";
	} else {
		getObj("customer_name").style.border = "#A5ACB2 solid 1px";
	}
	
	if (formName.elements["customer_email"].value == "") {
		valid = 0;
		message += "Email\n";
		getObj("customer_email").style.border = "#aa0000 solid 1px";
	} else {
			if (checkEmail(formName.elements["customer_email"].value) == false) {
			valid = 0;
			message += "The e-mail address isn't valid\n";
			getObj("customer_email").style.border = "#aa0000 solid 1px";
		} else {
			getObj("customer_email").style.border = "#A5ACB2 solid 1px";
		}
	}
	
	if (valid == 0) {
		alert(message);
	} else {
		formName.submit();
	}
}


function printcart(sessionid){	
	var newurl = "print_cart.asp?state_sessionID=" + sessionid;
	var printpage=window.open(newurl, "PrintCart", "width=600,height=500,locationbar=0,menubar=0,personalbar=0,status=0,scrollbars=0,resizable=0");
}

function arena_4_ecommerce_validcompetitionform() {
	valid = 1;
	message = "You have not completed all the required fields, please check:\n";
	formName = document.forms['competitionentry'];

	if (formName.elements["answer"].value == "") {
		valid = 0;
		message += "Answer\n";
		getObj("answer").style.border = "#aa0000 solid 1px";
	} else {
		getObj("answer").style.border = "#A5ACB2 solid 1px";
	}

	if (formName.elements["email_addy"].value == "") {
		valid = 0;
		message += "Email Address\n";
		getObj("email_addy").style.border = "#aa0000 solid 1px";
	} else {
		if (checkEmail(formName.elements["email_addy"].value) == false) {
			valid = 0;
			message += "The e-mail address isn't valid\n";
			getObj("email_addy").style.border = "#aa0000 solid 1px";
		} else {
			getObj("email_addy").style.border = "#A5ACB2 solid 1px";
		}
	}

	if (formName.elements["name"].value == "") {
		valid = 0;
		message += "Name\n";
		getObj("name").style.border = "#aa0000 solid 1px";
	} else {
		getObj("name").style.border = "#A5ACB2 solid 1px";
	}
	
	if (valid == 0) {
		alert(message);
	} else {
		formName.submit();
	}
}


function removevalue() {
	if (getObj("search_string").value == "Quick Search" ) {
		getObj("search_string").value = ""	
	}
}

function enlarge_photo(photo_id, productname, catid) {
	var newurl1 = "enlarge.asp?photo="+ photo_id + "&pname="+ productname + "&categories_id=" + catid;
	var photopage=window.open(newurl1, "Enlarged_Photo", "width=600,height=500,locationbar=0,menubar=0,personalbar=0,status=0,scrollbars=0,resizable=0");
}

function getObj(nm) {
	if (document.getElementById) {
		return document.getElementById(nm);
	} else if (document.all) {
		return document.all[nm];
	} else {
		return eval("document." + nm);
	}
}

function calculate_postage(cart_lines) {
//
var thispostage = 0.00;
var lastpostage = 0.00;
var maxpostage = 0.00;
	for (var i=1; i<=cart_lines; i++) {
		var thispostage = document.forms["cartline" + i].item_postage_value.value;
		//
		if (thispostage > lastpostage) {
			maxpostage = thispostage;
		}
		lastpostage = thispostage;
	}
//
document.forms["master_form"].order_delivery_cost.value = maxpostage;
}
//




function setzero_postage (line_id, cart_lines) {
	var postage_amount = document.forms["cartline" + line_id].item_postage_value.value;
	var delivery_type = document.forms["cartline" + line_id].products_deliver.value;
	var actual_postage = document.forms["cartline" + line_id].item_actual_postage_value.value;
	//alert(delivery_type)
	
	if (delivery_type != "2") {
		document.forms["cartline" + line_id].item_postage_value.value = actual_postage;
	} else {
		document.forms["cartline" + line_id].item_postage_value.value="0.00";
	}
	var calcpostage = calculate_postage(cart_lines);
}
//
function verify_deliveryoptions(cart_lines,includeGST) {
	var overall_valid = "true";
	var valid = 0;
	var total_true = cart_lines;
	for (var i=1; i<=cart_lines; i++) {
		var delivery_selected = document.forms["cartline" + i].products_deliver.value;
		//
		if (delivery_selected != "") {
			document.forms["cartline" + i].products_deliver.value = delivery_selected;
			document.forms["cartline" + i].products_deliver.style.color = "#000000";

			var valid = valid + 1;
		} else {
			var valid = valid + 0;
			document.forms["cartline" + i].products_deliver.style.color = "#aa0000";
		}
		
	}
	//alert(valid)
		if (valid != cart_lines) {
			alert("You have not declared all your delivery/collection options");
		} else {
			var max_postage = calculate_postage(cart_lines);
			
			//getObj("delivery_cost_display").style.display = "block"
			var message = "Your total delivery charge is £" + document.forms["master_form"].order_delivery_cost.value + " If you wish to accept this and continue the checkout process please click OK, if you wish to alter your delivery/collection options please click Cancel"
			//alert(message)
			//
			if (document.forms["master_form"].order_delivery_cost.value == "0") {
				var message = "All items have been set to collection OR there is no delivery charge for your selected item(s). If you wish to accept this and continue the checkout process please click OK, if you wish to cancel this order please click Cancel"
			}
			//
			if (confirm(message)) {
			//
			var completecheck = complete_checkout(cart_lines,includeGST);
			}
		}
}
//
function complete_checkout(cart_lines,includeGST) {
//
	var order_id = document.forms["cartline1"].order_id.value;
	var maximum_delivery = document.forms["master_form"].order_delivery_cost.value
	var staff_repcode = document.forms["master_form"].staff_repcode.value
	//
	if (maximum_delivery == "") {
		var maximum_delivery = 0.00
	}
	//
	var redirect = "checkout_saveoptions.asp?orderid=" + order_id + "&state_sessionid=" + document.forms["master_form"].state_sessionid.value + "&maxdel=" + maximum_delivery + "&repcode=" + staff_repcode + "&includeGST=" + includeGST
	//
	for (var i=1; i<=cart_lines; i++) {
	var delivery_selected = document.forms["cartline" + i].products_deliver.value;
	//
	var redirect = redirect + "&l=" + i + "_" + delivery_selected
	}
	document.location.href = redirect
//
}
//
//



/****************************************************************************************************/
/****************************************************************************************************/
var shippingAddress1 = "";
var shippingAddress2 = "";
var shippingAddress3 = "";
var shippingPostcode = "";
var shippingParish = "";

function saveVariables(form) {
	shippingAddress1 = form.shipping_address1.value;
	shippingAddress2 = form.shipping_address2.value;
	shippingAddress3 = form.shipping_address3.value;
	shippingPostcode = form.shipping_postcode.value;
	shippingParish = form.shipping_parish_select.value;
}

function BillToShipPerson(form) {
	if (form.copyAddress.checked) {
		saveVariables(form);
		form.shipping_address1.value = form.billing_address1.value;
		form.shipping_address2.value = form.billing_address2.value;
		form.shipping_address3.value = form.billing_address3.value;
		form.shipping_postcode.value = form.billing_postcode.value;
		form.shipping_parish_select.value = form.billing_parish_select.value;
	}
	else {
		form.shipping_address1.value = shippingAddress1;
		form.shipping_address2.value = shippingAddress2;
		form.shipping_address3.value = shippingAddress3;
		form.shipping_postcode.value = shippingPostcode;
		form.shipping_parish_select.value = shippingParish;
   }
}

function TrimString(sInString) {
  sInString = sInString.replace( /^\s+/g, "" );// strip leading
  return sInString.replace( /\s+$/g, "" );// strip trailing
}



function arena_4_ecommerce_validaccaddress() {
valid = 1;
	message = "You have not completed all the required fields, please check:\n";
	formName = document.forms["accountaddress_details"];

	if (TrimString(formName.elements['billing_address1'].value) == "") {
		valid = 0;
		message += "Billing Line 1\n";
		getObj("billing_address1").style.border = "#aa0000 solid 1px";
	} else {
		getObj("billing_address1").style.border = "#A5ACB2 solid 1px";
	}
	
	if (TrimString(formName.elements['billing_address2'].value) == "") {
		valid = 0;
		message += "Billing Line 2\n";
		getObj("billing_address2").style.border = "#aa0000 solid 1px";
	} else {
		getObj("billing_address2").style.border = "#A5ACB2 solid 1px";
	}
	
	//if (formName.elements['billing_address3'].value == "") {
	//	valid = 0;
	//	message += "Billing Line 3\n";
	//	getObj("billing_address3").style.border = "#aa0000 solid 1px";
	//} else {
	//	getObj("billing_address3").style.border = "#A5ACB2 solid 1px";
	//}
	
	if (TrimString(formName.elements['billing_postcode'].value) == "") {
		valid = 0;
		message += "Billing Postcode\n";
		getObj("billing_postcode").style.border = "#aa0000 solid 1px";
	} else {
		getObj("billing_postcode").style.border = "#A5ACB2 solid 1px";
	}
	
	if (TrimString(formName.elements['parish_select'].value) == "") {
		valid = 0;
		message += "Billing Parish/Town\n";
		getObj("parish_select").style.border = "#aa0000 solid 1px";
	} else {
		getObj("parish_select").style.border = "#A5ACB2 solid 1px";
	}
	
	if (TrimString(formName.elements['billing_country'].value) == "") {
		valid = 0;
		message += "Billing Country\n";
		getObj("billing_country").style.color = "#aa0000";
	} else {
		getObj("billing_country").style.color = "#000000";
	}
	
	//Shipping Address testing
	
	//if (formName.elements['shipping_address1'].value == "") {
		//valid = 0;
		//message += "Shipping Line 1\n";
		//getObj("shipping_address1").style.border = "#aa0000 solid 1px";
	//} else {
		//getObj("shipping_address1").style.border = "#A5ACB2 solid 1px";
	//}
	
	//if (formName.elements['shipping_address2'].value == "") {
		//valid = 0;
		//message += "Shipping Line 2\n";
		//getObj("shipping_address2").style.border = "#aa0000 solid 1px";
	//} else {
		//getObj("shipping_address2").style.border = "#A5ACB2 solid 1px";
	//}
	
	//if (formName.elements['shipping_address3'].value == "") {
		//valid = 0;
		//message += "Shipping Line 3\n";
		//getObj("shipping_address3").style.border = "#aa0000 solid 1px";
	//} else {
		//getObj("shipping_address3").style.border = "#A5ACB2 solid 1px";
	//}
	
	//if (formName.elements['shipping_postcode'].value == "") {
		//valid = 0;
		//message += "Shipping Postcode\n";
		//getObj("shipping_postcode").style.border = "#aa0000 solid 1px";
	//} else {
		//getObj("shipping_postcode").style.border = "#A5ACB2 solid 1px";
	//}
	
	//if (formName.elements['shipping_parish_select'].value == "0") {
		//valid = 0;
		//message += "Shipping Parish\n";
		//getObj("shipping_parish_select").style.color = "#aa0000";
	//} else {
		//getObj("shipping_parish_select").style.color = "#000000";
	//}
	
	//end shipping address
	
	if (valid == 0) {
		alert(message);
	} else {
	if (formName.elements['billing_country'].value != "Jersey" || formName.elements['billing_country'].value != "Guernsey" || formName.elements['billing_country'].value != "Alderney") {
		alert('As per our terms & conditions we can only deliver to addresses in the Channel Islands and the UK we sell on a collection only basis')
	}
		formName.submit();
	}
}

function arena_4_ecommerce_validaccaddresssave() {
valid = 1;
	message = "You have not completed all the required fields, please check:\n";
	formName = document.forms["accountaddress_details"];

	if (formName.elements['billing_address1'].value == "") {
		valid = 0;
		message += "Billing Line 1\n";
		getObj("billing_address1").style.border = "#aa0000 solid 1px";
	} else {
		getObj("billing_address1").style.border = "#A5ACB2 solid 1px";
	}
	
	if (formName.elements['billing_address2'].value == "") {
		valid = 0;
		message += "Billing Line 2\n";
		getObj("billing_address2").style.border = "#aa0000 solid 1px";
	} else {
		getObj("billing_address2").style.border = "#A5ACB2 solid 1px";
	}
	
//	if (formName.elements['billing_address3'].value == "") {
	//	valid = 0;
	//	message += "Billing Line 3\n";
	//	getObj("billing_address3").style.border = "#aa0000 solid 1px";
	//} else {
	//	getObj("billing_address3").style.border = "#A5ACB2 solid 1px";
	//}
	
	if (formName.elements['billing_postcode'].value == "") {
		valid = 0;
		message += "Billing Postcode\n";
		getObj("billing_postcode").style.border = "#aa0000 solid 1px";
	} else {
		getObj("billing_postcode").style.border = "#A5ACB2 solid 1px";
	}
	
	
	if (formName.elements['billing_parish_select'].value == "") {
		valid = 0;
		message += "Billing Parish/Town\n";
		getObj("parish_select").style.border = "#aa0000 solid 1px";
	} else {
		getObj("parish_select").style.border = "#A5ACB2 solid 1px";
	}
	
	if (formName.elements['billing_country'].value == "") {
		valid = 0;
		message += "Billing Country\n";
		getObj("billing_country").style.color = "#aa0000";
	} else {
		getObj("billing_country").style.color = "#000000";
	}
	
	if (formName.elements['day_telephone'].value == "") {
		valid = 0;
		message += "Daytime Telephone\n";
		getObj("day_telephone").style.border = "#aa0000 solid 1px";
	} else {
		getObj("day_telephone").style.border = "#A5ACB2 solid 1px";
	}
	//Shipping Address testing
	
	//if (formName.elements['shipping_address1'].value == "") {
		//valid = 0;
		//message += "Shipping Line 1\n";
		//getObj("shipping_address1").style.border = "#aa0000 solid 1px";
	//} else {
		//getObj("shipping_address1").style.border = "#A5ACB2 solid 1px";
	//}
	
	//if (formName.elements['shipping_address2'].value == "") {
		//valid = 0;
		//message += "Shipping Line 2\n";
		//getObj("shipping_address2").style.border = "#aa0000 solid 1px";
	//} else {
		//getObj("shipping_address2").style.border = "#A5ACB2 solid 1px";
	//}
	
	//if (formName.elements['shipping_address3'].value == "") {
		//valid = 0;
		//message += "Shipping Line 3\n";
		//getObj("shipping_address3").style.border = "#aa0000 solid 1px";
	//} else {
		//getObj("shipping_address3").style.border = "#A5ACB2 solid 1px";
	//}
	
	//if (formName.elements['shipping_postcode'].value == "") {
		//valid = 0;
		//message += "Shipping Postcode\n";
		//getObj("shipping_postcode").style.border = "#aa0000 solid 1px";
	//} else {
		//getObj("shipping_postcode").style.border = "#A5ACB2 solid 1px";
	//}
	
	//if (formName.elements['shipping_parish_select'].value == "0") {
		//valid = 0;
		//message += "Shipping Parish\n";
		//getObj("shipping_parish_select").style.color = "#aa0000";
	//} else {
		//getObj("shipping_parish_select").style.color = "#000000";
	//}
	
	//end shipping address
	
	if (valid == 0) {
		alert(message);
	} else {
	/*if (formName.elements['billing_country'].value != "Jersey") {
		alert('As per our terms & conditions we can only deliver to addresses in Jersey. For Guernsey and the UK we sell on a collection only basis')
	}*/
	if (formName.elements['billing_country'].value != "Jersey" || formName.elements['billing_country'].value != "Guernsey" || formName.elements['billing_country'].value != "Alderney") {
		alert('As per our terms & conditions we can only deliver to addresses in the Channel Islands and the UK we sell on a collection only basis')
	}
		formName.submit();
	}
	
}



function arena_4_ecommerce_validshippingform() {
	valid = 1;	message = "You have not completed all the required fields, please check:\n";
	formName = document.forms["checkoutShippingForm"];

	if (formName.elements['shipping_name'].value == "") {
		valid = 0;
		message += "Name\n";
		getObj("shipping_name").style.border = "#aa0000 solid 1px";
	} else {
		getObj("shipping_name").style.border = "#A5ACB2 solid 1px";
	}

	if (formName.elements["shipping_address"].value == "") {
		valid = 0;
		message += "Address\n";
		getObj("shipping_address").style.border = "#aa0000 solid 1px";
	} else {
		getObj("shipping_address").style.border = "#A5ACB2 solid 1px";
	}
	
	if (formName.elements["shipping_postcode"].value == "") {
		valid = 0;
		message += "Postcode\n";
		getObj("shipping_postcode").style.border = "#aa0000 solid 1px";
	} else {
		getObj("shipping_postcode").style.border = "#A5ACB2 solid 1px";
	}

	if (formName.elements["shipping_country"].value == "0") {
		valid = 0;
		message += "Country\n";
		getObj("shipping_country").style.color = "#aa0000";
	} else {
		getObj("shipping_country").style.color = "#000000";
	}


	if (valid == 0) {
		alert(message);
	} else {
		formName.submit();
	}
}

function arena_4_ecommerce_validaccsave() {
valid = 1;
	message = "You have not completed all the required fields, please check:\n";
	formName = document.forms["update_accdetails"];
	//alert(formName.elements['signup_firstname'].value)
	if (formName.elements['signup_firstname'].value == "") {
		valid = 0;
		message += "First Name\n";
		getObj("signup_firstname").style.border = "#aa0000 solid 1px";
	} else {
		getObj("signup_firstname").style.border = "#A5ACB2 solid 1px";
	}

	if (formName.elements["signup_lastname"].value == "") {
		valid = 0;
		message += "Last Name\n";
		getObj("signup_lastname").style.border = "#aa0000 solid 1px";
	} else {
		getObj("signup_lastname").style.border = "#A5ACB2 solid 1px";
	}
	
	if (formName.elements["signup_email"].value == "") {
		valid = 0;
		message += "E-mail Address\n";
		getObj("signup_email").style.border = "#aa0000 solid 1px";
	} else {
		getObj("signup_email").style.border = "#A5ACB2 solid 1px";
	}

	if (formName.elements["signup_password"].value == "") {
		valid = 0;
		message += "Password\n";
		getObj("signup_password").style.border = "#aa0000 solid 1px";
	} else {
		getObj("signup_password").style.border = "#A5ACB2 solid 1px";
	}

	if (formName.elements["signup_password_confirm"].value == "") {
		valid = 0;
		message += "Password Confirmation\n";
		getObj("signup_password_confirm").style.border = "#aa0000 solid 1px";
	} else {
		getObj("signup_password_confirm").style.border = "#A5ACB2 solid 1px";
	}
	
	if (formName.elements["signup_password_confirm"].value != formName.elements["signup_password"].value) {
		valid = 0;
		message += "Passwords do not Match\n";
	}
	
	if (valid == 0) {
		alert(message);
	} else {
		formName.submit();
	}
}


function arena_4_ecommerce_validsignup() {
	valid = 1;
	message = "You have not completed all the required fields, please check:\n";
	formName = document.forms["account_signup"];
	//alert(formName.elements['signup_firstname'].value)
	if (formName.elements['signup_firstname'].value == "") {
		valid = 0;
		message += "First Name\n";
		getObj("signup_firstname").style.border = "#aa0000 solid 1px";
	} else {
		getObj("signup_firstname").style.border = "#A5ACB2 solid 1px";
	}

	if (formName.elements["signup_lastname"].value == "") {
		valid = 0;
		message += "Last Name\n";
		getObj("signup_lastname").style.border = "#aa0000 solid 1px";
	} else {
		getObj("signup_lastname").style.border = "#A5ACB2 solid 1px";
	}
	
	if (checkEmail(formName.elements["signup_email"].value) == false) {
		valid = 0;
		message += "E-mail Address\n";
		getObj("signup_email").style.border = "#aa0000 solid 1px";
	} else {
		getObj("signup_email").style.border = "#A5ACB2 solid 1px";
	}

	if (formName.elements["signup_password"].value == "") {
		valid = 0;
		message += "Password\n";
		getObj("signup_password").style.border = "#aa0000 solid 1px";
	} else {
		getObj("signup_password").style.border = "#A5ACB2 solid 1px";
	}

	if (formName.elements["signup_password_confirm"].value == "") {
		valid = 0;
		message += "Password Confirmation\n";
		getObj("signup_password_confirm").style.border = "#aa0000 solid 1px";
	} else {
		getObj("signup_password_confirm").style.border = "#A5ACB2 solid 1px";
	}
	
	if (formName.elements["signup_password_confirm"].value != formName.elements["signup_password"].value) {
		valid = 0;
		message += "Passwords do not Match\n";
	}
	
	if (valid == 0) {
		alert(message);
	} else {
		formName.submit();
	}
}






function arena_4_ecommerce_validBillingForm() {
	valid = 1;
	message = "You have now completed all the required fields, please check:\n";
	formName = document.forms['checkoutBillingForm'];

	if (formName.elements["billing_name"].value == "") {
		valid = 0;
		message += "Name\n";
		getObj("billing_name").style.border = "#aa0000 solid 1px";
	} else {
		getObj("billing_name").style.border = "#A5ACB2 solid 1px";
	}

	if (formName.elements["billing_email"].value == "") {
		valid = 0;
		message += "Email Address\n";
		getObj("billing_email").style.border = "#aa0000 solid 1px";
	} else {
		if (checkEmail(formName.elements["billing_email"].value) == false) {
			valid = 0;
			message += "The e-mail address is valid\n";
			getObj("billing_email").style.border = "#aa0000 solid 1px";
		} else {
			getObj("billing_email").style.border = "#A5ACB2 solid 1px";
		}
	}

	if (formName.elements["billing_address"].value == "") {
		valid = 0;
		message += "Address\n";
		getObj("billing_address").style.border = "#aa0000 solid 1px";
	} else {
		getObj("billing_address").style.border = "#A5ACB2 solid 1px";
	}
	
	if (formName.elements["billing_postcode"].value == "") {
		valid = 0;
		message += "Postcode\n";
		getObj("billing_postcode").style.border = "#aa0000 solid 1px";
	} else {
		getObj("billing_postcode").style.border = "#A5ACB2 solid 1px";
	}

	if (formName.elements["billing_country"].value == "0") {
		valid = 0;
		message += "Country\n";
		getObj("billing_country").style.color = "#aa0000";
	} else {
		getObj("billing_country").style.color = "#000000";
	}

	if (valid == 0) {
		alert(message);
	} else {
		formName.submit();
	}
}

function checkEmail(email)
{
	email = email.toLowerCase(); 
	//rics super cool e-mail validor
	if (email.match(/^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,4})$/)) {
		return true;
	} else {
		return false;
	}
}

// evil dw stuff
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function goToSecPay() {
	document.forms["goToSecPay"].submit();
}

//function updatePostagePricesArea(priceBand) {
	//postageOption = document.forms["checkoutShippingForm"].elements["shipping_country"].value;
	//if (priceBand == 2) {
		///if (postageOption == 1) {
			//getObj("postageUK").style.display = "block";
			//updatePostagePrices(0);
		//} else {
		//	getObj("postageUK").style.display = "none";
		//	updatePostagePrices(postageOption);
	//	}
	//} else {
	//	updatePostagePrices(postageOption);
	//}
//}

//function updatePostagePrices(postageOption) {
	//postagePrices = new Array();
	//postagePrices[0] = 0;
	//postagePrices[1] = 6.50;
	//postagePrices[2] = 9.95;
	//postagePrices[3] = 30.00;
	//postagePrices[4] = 4.50;
	//postagePrices[5] = 5.50;
	
	//if (postageOption == -1) {
	//	postageOption = document.forms["checkoutShippingForm"].elements["shipping_posttype"].value;
	//}
	//document.forms["checkoutShippingForm"].elements["shipping_PostageValue"].value = postageOption;
	//showTotalPrice(postagePrices[postageOption]);
//}

function showTotalPrice(postagePrice) {
	if (postagePrice != 0) {
		getObj("totalPrice").innerHTML = "£" + postagePrice.toFixed(2);
	} else {
		getObj("totalPrice").innerHTML = "Please select your country/delivery option.";
	}
}

function addbookmark(bookmarkurl, bookmarktitle)
{
        window.external.AddFavorite(bookmarkurl, bookmarktitle);
}

function send2freind(){	
	var send2freind=window.open("send2freind.asp?pageurl=" + escape(document.location.href), "emailpage", "width=500,height=330,locationbar=0,menubar=0,personalbar=0,status=0,scrollbars=0,resizable=0");
}


function show(id) {
var d = document.getElementById(id);
	for (var i = 1; i<=20; i++) {
			if (document.getElementById('submenu'+i)) {document.getElementById('submenu'+i).style.display='none';}
			//if (document.getElementById('submenu'+i)) {document.getElementById('submenu'+i).className='hide_submenu';}
		}
if (d) {d.style.display='block';}
}


//function show_submenu(menuid) {
	//var menu = document.getElementById('submenu' + menuid)
	//for (var i = 1; i<=10; i++) {
		//if (i == menuid) {
		//	if (menu) {document.getElementById(menu).style.display='block';}
		//} else {
		//	if (document.getElementById('submenu'+i)) {document.getElementById('submenu'+i).style.display='none';}
		//}
	//}	
//}

function hide_menus() {
for (var i = 1; i<=10; i++) {
		if (document.getElementById('submenu'+i)) {document.getElementById('submenu'+i).style.display='none';}
	}

}

function printPage() {
	getObj("printHolder").style.display = "inline";
	//
	logo = "<br>&nbsp;&nbsp;<img src=\"graphics/logo_blue.gif\" alt=\"\" border=\"0\"><br>&nbsp;&nbsp;www.fotosounddirect.com";
	//
	body2 = "<table>";
	body2 += "<tr>";
	body2 += "<td valign=\"top\">" + getObj("printable_area").innerHTML + "</td></tr>";
	body2 += "<tr><td valign=\"top\"><div style=\"height: 10px; width: 590px;\" class=\"catcolor\"></div></td>";
	body2 += "</tr>";
	body2 += "</table>";
	// 
	getObj("printHolder").innerHTML = logo;
	getObj("printHolder").innerHTML += "<br><br>";
	getObj("printHolder").innerHTML += body2;
	//
	getObj("site_holder").style.display = "none";
	//
	print();
}

function printResetPage() {
	// this reset the page by making the master div visible and emptying the printholder then hidig it
	getObj("site_holder").style.display = "inline";
	getObj("printHolder").innerHTML = "";
	getObj("printHolder").style.display = "none";
}

function searchboxClear() {
	searchString = getObj("search_string").value;
	searchCat = getObj("search_cat").value;
	searchBrand = getObj("search_brand").value;
	//
	if (searchString == "search query") {
		getObj("search_string").value = "";
	}
}