	
// <form name="frm" method="post" action="" onsubmit="return verifyme(document.frm);">	

	// login.asp
	function verifyLogin(frm) {
		var str = frm.strLoginName.value;
		if( str.length == 0 || str == "" ) {
			alert("Login name required.");
			frm.strLoginName.focus();
			return false;
		}
		var str = frm.strPassword.value;
		if( str.length == 0 || str == "" ) {
			alert("Password required.");
			frm.strPassword.focus();
			return false;
		}
	}

	// registration.asp
	function verifyRegistration(frm) {
		var str = frm.strFirstName.value;
		if( str.length == 0 || str == "" ) {
			alert("First name required.");
			frm.strFirstName.focus();
			return false;
		}
		var str = frm.strLastName.value;
		if( str.length == 0 || str == "" ) {
			alert("Last name required.");
			frm.strLastName.focus();
			return false;
		}
		var str = frm.strEmailAddress.value;
		if( str.length == 0 || str == "" ) {
			alert("Email address required.");
			frm.strEmailAddress.focus();
			return false;
		}
		if(!IsEmail(str)) {
			alert("Email address invalid.");
			frm.strEmailAddress.focus();
			return false;
		}
		if(!frm.strEmailAddress.value == frm.strEmailAddressConfirm.value) {
			alert("Confirmed Email address does not match.");
			frm.strEmailAddress.focus();
			return false;
		}
		var str = frm.strLoginName.value;
		if( str.length == 0 || str == "" ) {
			alert("Login name required.");
			frm.strLoginName.focus();
			return false;
		}
		var str = frm.strPassword.value;
		if( str.length == 0 || str == "" ) {
			alert("Password required.");
			frm.strPassword.focus();
			return false;
		}
		var str2 = frm.strPasswordConfirmation.value;
		if( str2.length == 0 || str2 == "" ) {
			alert("Password confirmation required.");
			frm.strPasswordConfirmation.focus();
			return false;
		}
		if( str.length < 5 || str.length > 8  ) {
			alert("Password length invalid (5-8 characters).");
			frm.strPassword.focus();
			return false;
		}
		if( str != str2) {
			alert("The passwords entered don't match.");
			frm.strPassword.focus();
			return false;
		}
		/*
		if( frm.chkTAC.checked == false) {
			alert("Please accept our T&C to continue.");
			frm.chkTAC.focus();
			return false;
		}
		*/
	}

	// subscription.asp
	function verifySubscription(frm) {

	}

	// customerdetails.asp
	function verifyCustomerRegistration(frm) {
			var str = frm.strFirstName.value;
		if( str.length == 0 || str == "" ) {
			alert("First name required.");
			frm.strFirstName.focus();
			return false;
		}
		var str = frm.strLastName.value;
		if( str.length == 0 || str == "" ) {
			alert("Last name required.");
			frm.strLastName.focus();
			return false;
		}
		var str = frm.strEmailAddress.value;
		if( str.length == 0 || str == "" ) {
			alert("Email address required.");
			frm.strEmailAddress.focus();
			return false;
		}
		if(!IsEmail(str)) {
			alert("Email address invalid.");
			frm.strEmailAddress.focus();
			return false;
		}
	}

	//customerpref.asp
	function verifySubsPrefForm(frm) {
	
	}

	//passwordupdate.asp
	function verifyPasswordUpdForm(frm) {
		
		var str = frm.strPassword.value;
		if( str.length == 0 || str == "" ) {
			alert("Password required.");
			frm.strPassword.focus();
			return false;
		}

		var str = frm.strNewPassword.value;
		if( str.length == 0 || str == "" ) {
			alert("New Password required.");
			frm.strNewPassword.focus();
			return false;
		}

		var str2 = frm.strNewPasswordConfirmation.value;
		if( str2.length == 0 || str2 == "" ) {
			alert("New Password confirmation required.");
			frm.strNewPasswordConfirmation.focus();
			return false;
		}

		if( str.length < 5 || str.length > 8  ) {
			alert("Password length invalid (5-8 characters).");
			frm.strNewPassword.focus();
			return false;
		}
		if( str != str2) {
			alert("The passwords entered don't match.");
			frm.strNewPassword.focus();
			return false;
		}
	}

	// passwordrecovery.asp
	function verifyPasswordRecoveryForm(frm) {
		
		var str = frm.strEmailAddress.value;
		if( str.length == 0 || str == "" ) {
			alert("Email address required.");
			frm.strEmailAddress.focus();
			return false;
		}
		if(!IsEmail(str)) {
			alert("Email address invalid.");
			frm.strEmailAddress.focus();
			return false;
		}
	}


	
	
	function verifyOrderDelivery(frm) {
		// AR - 14/07/2010 - its and array so we have to loop through to find the selected value
		var str = frm.intOrderBillingAddressId;
		for (var i=0; i < str.length; i++)
		{
			if (str[i].checked){
				var str_val = str[i].value;
			}
		}
		//AR - 05/08/2010 - if there are no addresses, frm.intOrderBillingAddressId is a hidden field, so were checking for an undefined!
		if (str_val == undefined)
		{
			str_val = str.value;
		}


		// billing form;
		if (str_val == 0){

			var str = frm.strOrderBillingFirstName.value;
			if( str.length == 0 || str == "" ) {
				alert("First name required.");
				frm.strOrderBillingFirstName.focus();
				return false;
			}
			var str = frm.strOrderBillingLastName.value;
			if( str.length == 0 || str == "" ) {
				alert("Last name required.");
				frm.strOrderBillingLastName.focus();
				return false;
			}
			var str = frm.strOrderBillingAddress1.value;
			if( str.length == 0 || str == "" ) {
				alert("Address Line 1 required.");
				frm.strOrderBillingAddress1.focus();
				return false;
			}
			var str = frm.strOrderBillingTown.value;
			if( str.length == 0 || str == "" ) {
				alert("City/Town required.");
				frm.strOrderBillingTown.focus();
				return false;
			}
			var str = frm.strOrderBillingPostCode.value;
			if( str.length == 0 || str == "" ) {
				alert("Post Code required.");
				frm.strOrderBillingPostCode.focus();
				return false;
			}
			if (trim(str).indexOf(" ")==-1)
			{
				alert("Post Code should include a space.");
				frm.strOrderBillingPostCode.focus();
				return false;
			}
			var str = frm.strOrderBillingCountry.value;
			if( str.length == 0 || str == "" ) {
				alert("Country required.");
				frm.strOrderBillingCountry.focus();
				return false;
			}
			var str = frm.strOrderBillingTelephoneNbr.value;
			if( str.length == 0 || str == "" ) {
				alert("Telephone number required.");
				frm.strOrderBillingTelephoneNbr.focus();
				return false;
			}
			if( str.length > 20) {
				alert("Telephone number exceeds 20 characters.");
				frm.strOrderBillingTelephoneNbr.focus();
				return false;
			}	
			if(!IsNumeric(str)) {
				alert("Telephone number can only contain numbers.");
				frm.strOrderBillingTelephoneNbr.focus();
				return false;
			}
			var str = frm.strOrderBillingMobilePhoneNbr.value;
			if( str.length > 20) {
				alert("Mobile number exceeds 20 characters.");
				frm.strOrderBillingMobilePhoneNbr.focus();
				return false;
			}
			if(!IsNumeric(str)) {
				alert("Telephone number can only contain numbers.");
				frm.strOrderBillingMobilePhoneNbr.focus();
				return false;
			}
		}
		//shipping form;
		if (frm.strOrderSameDeliveryAddress.checked == false)
		{
			var str = frm.strOrderShippingFirstName.value;
			if( str.length == 0 || str == "" ) {
				alert("First name required.");
				frm.strOrderShippingFirstName.focus();
				return false;
			}
			var str = frm.strOrderShippingLastName.value;
			if( str.length == 0 || str == "" ) {
				alert("Last name required.");
				frm.strOrderShippingLastName.focus();
				return false;
			}
			var str = frm.strOrderShippingAddress1.value;
			if( str.length == 0 || str == "" ) {
				alert("Address Line 1 required.");
				frm.strOrderShippingAddress1.focus();
				return false;
			}
			var str = frm.strOrderShippingTown.value;
			if( str.length == 0 || str == "" ) {
				alert("City/Town required.");
				frm.strOrderShippingTown.focus();
				return false;
			}
			var str = frm.strOrderShippingPostCode.value;
			if( str.length == 0 || str == "" ) {
				alert("Post Code required.");
				frm.strOrderShippingPostCode.focus();
				return false;
			}
			if (trim(str).indexOf(" ")==-1)
			{
				alert("Post Code should include a space.");
				frm.strOrderShippingPostCode.focus();
				return false;
			}
			var str = frm.strOrderShippingCountry.value;
			if( str.length == 0 || str == "" ) {
				alert("Country required.");
				frm.strOrderShippingCountry.focus();
				return false;
			}
			var str = frm.strOrderShippingTelephoneNbr.value;
			if( str.length == 0 || str == "" ) {
				alert("Telephone number required.");
				frm.strOrderShippingTelephoneNbr.focus();
				return false;
			}
			if( str.length > 20) {
				alert("Telephone number exceeds 20 characters.");
				frm.strOrderShippingTelephoneNbr.focus();
				return false;
			}
			var str = frm.strOrderShippingMobilePhoneNbr.value;
			if( str.length > 20) {
				alert("Mobile number exceeds 20 characters.");
				frm.strOrderShippingMobilePhoneNbr.focus();
				return false;
			}
		}
	}

	// orderpayment.asp
function checkPaymentMethod(val) {

	if (val == 1)
	{
		document.getElementById("frmCreditCardPayment").className = "";
	}else{

		document.getElementById("frmCreditCardPayment").className = "hide";
	}
	
}

	
	
	
	function verifyOrderPayment(frm) {
		var str = frm.intOrderPaymentMethod.value;
		if ( str == 1)
		{
			var str = frm.strOrderPaymentCardHolderName.value;
			if( str.length == 0 || str == "" ) {
				alert("Card holder name required.");
				frm.strOrderPaymentCardHolderName.focus();
				return false;
			}
			var str = frm.strOrderPaymentCardNumber.value;
			if( str.length == 0 || str == "" ) {
				alert("Card number required.");
				frm.strOrderPaymentCardNumber.focus();
				return false;
			}
			if( str.length <= 13 || str.length > 19) {
				alert("Card number length invalid.");
				frm.strOrderPaymentCardNumber.focus();
				return false;
			}
			if(!(IsNumeric(str))) {
				alert("Card number invalid.");
				frm.strOrderPaymentCardNumber.focus();
				return false;
			}
			var str = frm.strOrderPaymentCardStartDate.value;
			if( str.length > 0 && str.length != 4 ) {
				alert("Start date length invalid.");
				frm.strOrderPaymentCardStartDate.focus();
				return false;
			}
			if(!(IsNumeric(str))) {
				alert("Start date invalid.");
				frm.strOrderPaymentCardStartDate.focus();
				return false;
			}
			var str = frm.strOrderPaymentCardExpiryDate.value;
			if( str.length == 0 || str == "" ) {
				alert("Expiry date required.");
				frm.strOrderPaymentCardExpiryDate.focus();
				return false;
			}
			if( str.length != 4 ) {
				alert("Expiry date length invalid.");
				frm.strOrderPaymentCardExpiryDate.focus();
				return false;
			}
			if(!(IsNumeric(str))) {
				alert("Expiry date invalid.");
				frm.strOrderPaymentCardExpiryDate.focus();
				return false;
			}
			var str = frm.strOrderPaymentCardIssueNbr.value;
			if (str.length > 2) {
				alert("Issue number length invalid.");
				frm.strOrderPaymentCardIssueNbr.focus();
				return false;
			}
			if(!(IsNumeric(str))) {
				alert("Issue number invalid.");
				frm.strOrderPaymentCardIssueNbr.focus();
				return false;
			}
			var str = frm.strOrderPaymentCardCV2.value;
			if( str.length == 0 || str == "" ) {
				alert("Card verification value required.");
				frm.strOrderPaymentCardCV2.focus();
				return false;
			}
			if ( str.length < 3 || str.length > 4 ){
				alert("Card verification value length invalid.");
				frm.strOrderPaymentCardCV2.focus();
				return false;
			}		
			if(!(IsNumeric(str))) {
				alert("Card verification value invalid.");
				frm.strOrderPaymentCardCV2.focus();
				return false;
			}
		}
	}


	// tellafriend.asp
	function verifyTellAFriend(frm) {
		var str = frm.strFriendsName.value;
		if( str.length == 0 || str == "" ) {
			alert("Friend's name required.");
			frm.strFriendsName.focus();
			return false;
		}

		var str = frm.strFriendsEmail.value;
		if( str.length == 0 || str == "" ) {
			alert("Friend's email required.");
			frm.strFriendsEmail.focus();
			return false;
		}

		if(!IsEmail(str)) {
			alert("Friend's email address invalid.");
			frm.strFriendsEmail.focus();
			return false;
		}

		
		var str = frm.strUserName.value;
		if( str.length == 0 || str == "" ) {
			alert("Your name is required.");
			frm.strUserName.focus();
			return false;
		}

		var str = frm.strUserEmail.value;
		if( str.length == 0 || str == "" ) {
			alert("Your email is required.");
			frm.strUserEmail.focus();
			return false;
		}

		if(!IsEmail(str)) {
			alert("Your email address is invalid.");
			frm.strUserEmail.focus();
			return false;
		}
		
		return true;
	}

	// affiliate.asp
	function verifyAffiliateForm(frm) {
		var str = frm.strCompanyName.value;
		if( str.length == 0 || str == "" ) {
			alert("Company or a reference name for this account (your surname for example) is required.");
			frm.strCompanyName.focus();
			return false;
		}
		var str = frm.strWebsite.value;
		if( str.length == 0 || str == "" ) {
			alert("Website required.");
			frm.strWebsite.focus();
			return false;
		}
		var str = frm.strFirstName.value;
		if( str.length == 0 || str == "" ) {
			alert("First name required.");
			frm.strFirstName.focus();
			return false;
		}
		var str = frm.strLastName.value;
		if( str.length == 0 || str == "" ) {
			alert("Last name required.");
			frm.strLastName.focus();
			return false;
		}
		var str = frm.strEmailAddress.value;
		if( str.length == 0 || str == "" ) {
			alert("Email address required.");
			frm.strEmailAddress.focus();
			return false;
		}
		if(!IsEmail(str)) {
			alert("Email address invalid.");
			frm.strEmailAddress.focus();
			return false;
		}
		var str = frm.strTelephoneNbr.value;
		if( str.length == 0 || str == "" ) {
			alert("Telephone number required.");
			frm.strTelephoneNbr.focus();
			return false;
		}
		var str = frm.strLoginName.value;
		if( str.length == 0 || str == "" ) {
			alert("Login name required.");
			frm.strLoginName.focus();
			return false;
		}
		var str = frm.strPassword.value;
		if( str.length == 0 || str == "" ) {
			alert("Password required.");
			frm.strPassword.focus();
			return false;
		}
		var str2 = frm.strPasswordConfirmation.value;
		if( str2.length == 0 || str2 == "" ) {
			alert("Password confirmation required.");
			frm.strPasswordConfirmation.focus();
			return false;
		}
		if( str.length < 5 || str.length > 8  ) {
			alert("Password length invalid (5-8 characters).");
			frm.strPassword.focus();
			return false;
		}
		if( str != str2) {
			alert("The passwords entered don't match.");
			frm.strPassword.focus();
			return false;
		}

		if( frm.chkTAC.checked == false) {
			alert("Please accept our T&C to continue.");
			frm.chkTAC.focus();
			return false;
		}

		return true;
	}

	function verifyMySchemeForm(frm) {
		var str = frm.strRequestedDomain.value;
		if( str.length == 0 || str == "" ) {
			alert("Domain URL required.");
			frm.strRequestedDomain.focus();
			return false;
		}
		return true;
	}

	function verifyReportsForm(frm) {
		var str = frm.datReportFrom.value;
		if( str.length == 0 || str == "" ) {
			alert("Date required.");
			frm.datReportFrom.focus();
			return false;
		}
		if( !IsValidDate(str)) {
			alert("Please enter valid date (dd/mm/yyyy).");
			frm.datReportFrom.focus();
			return false;
		}
		var str = frm.datReportTo.value;
		if( str.length == 0 || str == "" ) {
			alert("Date required.");
			frm.datReportTo.focus();
			return false;
		}
		if( !IsValidDate(str)) {
			alert("Please enter valid date (dd/mm/yyyy.)");
			frm.datReportTo.focus();
			return false;
		}
		return true;
	}

// /ssl/customeraddresses.asp

	function verifyDeleteAddress() {	
		if (confirm("Are you sure you wish to delete this address.")) {
		   return true;
		} else {
		   return false;
		}
	}



	// printondemand.asp
	function verifyPrintOnDemand(frm){
		var arrTextboxs = document.getElementsByTagName("input");
		var FinalValidataion = "";

		/*Roy of the Rovers validation*/
		if (document.frmPod.strHobbsElementId.value == "RotRComic")
		{
			if (document.frmPod.POD_FirstName.value.length >10)
			{
				alert("Your character's first name can have a maximum of 10 characters");
				return false;
			}
			if (document.frmPod.POD_LastName.value.length >12)
			{
				alert("Your character's last name can have a maximum of 12 characters");
				return false;
			}
		}

		for (i=0;i<arrTextboxs.length;i++){
			if(arrTextboxs[i].id.match('POD_')){
				var Obj = arrTextboxs[i];// document.getElementById(arrTextboxs[i])
				var str = trim(Obj.value);
				if( str.length == 0 || str == "" ) {
					alert("Please enter " + Obj.getAttribute('rel'));
					Obj.focus();
					return false;
				}else{
					FinalValidataion += '\n' +  Obj.getAttribute('rel') + ': ' + str;
				}
				/*
				else if (IsRude(str))
				{
					alert("Please amend " + Obj.getAttribute('rel'));
					Obj.focus();
					return false;
				}
				*/
			}
			
		}
		
		FinalValidataion	= 'Names will be printed exactly as they are displayed below '
							+ '\nincluding capital letters, punctuation etc:\n' + FinalValidataion;
		var action = confirm(FinalValidataion);
		
		return action;
	}

	function trim(str){
		s = str.replace(/^(\s)*/, '');
		s = s.replace(/(\s)*$/, '');
		return s;
	}

	function IsRude(word) {
		var page_request = false
		if (window.XMLHttpRequest) // if Mozilla, Safari etc
			page_request = new XMLHttpRequest()
		else if (window.ActiveXObject){ // if IE
			try {
				page_request = new ActiveXObject("Msxml2.XMLHTTP")
			} 
			catch (e){
				try{
					page_request = new ActiveXObject("Microsoft.XMLHTTP")
				}
				catch (e){
				}
			}
		}
		else return false
		page_request.open('GET',  "/common/asp/blockwordlist.txt", false) //get file synchronously 
		page_request.send(null)

		var badBadBad = page_request.responseText

		if(badBadBad.indexOf("|" + word.toLowerCase() + "|") > -1)
		{
			return true;	
		}
		return false;
	}

	function IsValidDate(val) {
		var RegExPattern = /^((((0?[1-9]|[12]\d|3[01])[\.\-\/](0?[13578]|1[02])[\.\-\/]((1[6-9]|[2-9]\d)?\d{2}))|((0?[1-9]|[12]\d|30)[\.\-\/](0?[13456789]|1[012])[\.\-\/]((1[6-9]|[2-9]\d)?\d{2}))|((0?[1-9]|1\d|2[0-8])[\.\-\/]0?2[\.\-\/]((1[6-9]|[2-9]\d)?\d{2}))|(29[\.\-\/]0?2[\.\-\/]((1[6-9]|[2-9]\d)?(0[48]|[2468][048]|[13579][26])|((16|[2468][048]|[3579][26])00)|00)))|(((0[1-9]|[12]\d|3[01])(0[13578]|1[02])((1[6-9]|[2-9]\d)?\d{2}))|((0[1-9]|[12]\d|30)(0[13456789]|1[012])((1[6-9]|[2-9]\d)?\d{2}))|((0[1-9]|1\d|2[0-8])02((1[6-9]|[2-9]\d)?\d{2}))|(2902((1[6-9]|[2-9]\d)?(0[48]|[2468][048]|[13579][26])|((16|[2468][048]|[3579][26])00)|00))))$/;
		if ((val.match(RegExPattern)) && (val!='')) {
			return true;
		} 
		return false;
	}







function verifyAddress(frm) {


			var str = frm.strFirstName.value;
			if( str.length == 0 || str == "" ) {
				alert("First name required.");
				frm.strFirstName.focus();
				return false;
			}
			var str = frm.strLastName.value;
			if( str.length == 0 || str == "" ) {
				alert("Last name required.");
				frm.strLastName.focus();
				return false;
			}
			var str = frm.strAddress1.value;
			if( str.length == 0 || str == "" ) {
				alert("Address Line 1 required.");
				frm.strAddress1.focus();
				return false;
			}
			var str = frm.strTown.value;
			if( str.length == 0 || str == "" ) {
				alert("City/Town required.");
				frm.strTown.focus();
				return false;
			}
			var str = frm.strPostCode.value;
			if( str.length == 0 || str == "" ) {
				alert("Post Code required.");
				frm.strPostCode.focus();
				return false;
			}
			if (trim(str).indexOf(" ")==-1)
			{
				alert("Post Code should include a space.");
				frm.strPostCode.focus();
				return false;
			}
			var str = frm.strCountry.value;
			if( str.length == 0 || str == "" ) {
				alert("Country required.");
				frm.strCountry.focus();
				return false;
			}
			var str = frm.strTelephoneNbr.value;
			if( str.length == 0 || str == "" ) {
				alert("Telephone number required.");
				frm.strTelephoneNbr.focus();
				return false;
			}
			if( str.length > 20) {
				alert("Telephone number exceeds 20 characters.");
				frm.strTelephoneNbr.focus();
				return false;
			}	
			if(!IsNumeric(str)) {
				alert("Telephone number can only contain numbers.");
				frm.strTelephoneNbr.focus();
				return false;
			}
			var str = frm.strMobilePhoneNbr.value;
			if( str.length > 20) {
				alert("Mobile number exceeds 20 characters.");
				frm.strMobilePhoneNbr.focus();
				return false;
			}
			if(!IsNumeric(str)) {
				alert("Telephone number can only contain numbers.");
				frm.strMobilePhoneNbr.focus();
				return false;
			}
		
}
