<!--
function checkRegistration() 
{
//function to check details for a the one off purchase form on login page
var testEmail  = /^[a-z0-9]([a-z0-9_\-\.]*)@([a-z0-9_\-\.]*)(\.[a-z]{2,3}(\.[a-z]{2}){0,2})$/i;
var testTelephone = /^[0-9]\d*\s?\d*$/;

incorrectEntry = "";
incorrectSelection = "";

strCardholderEmail = document.customerDetails.strCardholderEmail.value;
strCardholderTelephone = document.customerDetails.strCardholderTelephone.value;

strCardholderName = document.customerDetails.strCardholderName.value;
strCardholderAddress1 = document.customerDetails.strCardholderAddress1.value; 
strCardholderAddress2 = document.customerDetails.strCardholderAddress2.value;
strCardholderTown = document.customerDetails.strCardholderTown.value;
strCardholderPostcode = document.customerDetails.strCardholderPostcode.value;
strCardholderCountry  = document.customerDetails.strCardholderCountry.selectedIndex;

strDeliveryName = document.customerDetails.strDeliveryName.value;
strDeliveryAddress1 = document.customerDetails.strDeliveryAddress1.value; 
strDeliveryAddress2 = document.customerDetails.strDeliveryAddress2.value;
strDeliveryTown = document.customerDetails.strDeliveryTown.value;
strDeliveryPostcode = document.customerDetails.strDeliveryPostcode.value;
strDeliveryCountry  = document.customerDetails.strDeliveryCountry.selectedIndex;

booVATExempt = document.customerDetails.booVATExempt.value;
strVATNumber = document.customerDetails.strVATNumber.value;
strVATCompanyName = document.customerDetails.strVATCompanyName.value;
strVATCompanyAddress1 = document.customerDetails.strVATCompanyAddress1.value; 
strVATCompanyAddress2 = document.customerDetails.strVATCompanyAddress2.value;
strVATCompanyTown = document.customerDetails.strVATCompanyTown.value;
strVATCompanyPostcode = document.customerDetails.strVATCompanyPostcode.value;
strVATCompanyCountry  = document.customerDetails.strVATCompanyCountry.selectedIndex;

strCardType  = document.customerDetails.strCardType.selectedIndex;
strCardNumber  = document.customerDetails.strCardNumber.value;
strIssueNumber  = document.customerDetails.strIssueNumber.selectedIndex;
strStartDateMonth  = document.customerDetails.strStartDateMonth.selectedIndex;
strStartDateYear  = document.customerDetails.strStartDateYear.selectedIndex;
strExpiryDateMonth  = document.customerDetails.strExpiryDateMonth.selectedIndex;
strExpiryDateYear  = document.customerDetails.strExpiryDateYear.selectedIndex;


if (strCardholderEmail.length == 0) 
	{
		incorrectEntry += "\n - Please enter your e-mail address.";
	}

if (strCardholderEmail.length != 0) 
	{
		if (testEmail.test(strCardholderEmail) == false)
		{
			incorrectEntry += "\n - Please enter a valid e-mail address.";
		}
	}


if (strCardholderTelephone.length == 0)
{	
			incorrectEntry += "\n   Please enter a valid telephone number.";
}

if (strCardholderName.length == 0)
{
	incorrectEntry += "\n - Enter your  name";
}

if (strCardholderAddress1.length == 0)
{
	incorrectEntry += "\n - Enter your Address";
}

if (strCardholderTown.length == 0)
{
	incorrectEntry += "\n - Enter your Town";
}

if (document.customerDetails.strCardholderCountry.options[strCardholderCountry].value == "select") {
incorrectSelection += "\n     -  Select a Country";
}

if (strDeliveryName.length == 0)
{
	incorrectEntry += "\n - Enter your Delivery name";
}

if (strDeliveryAddress1.length == 0)
{
	incorrectEntry += "\n - Enter your Delivery Address";
}

if (strDeliveryTown.length == 0)
{
	incorrectEntry += "\n - Enter your Delivery Town";
}


if (document.customerDetails.strDeliveryCountry.options[strDeliveryCountry].value == "select") {
incorrectSelection += "\n     -  Select a Country";
}




if (incorrectEntry != "") {
incorrectEntry ="_____________________________\n" +
"Please amend the following fields :-\n" +
incorrectEntry + "\n_____________________________" +
"\n  Please re-enter and submit again!";
alert(incorrectEntry);
return false;
}
if (incorrectSelection != "") {
incorrectSelection ="_________________________________________\n" +
"Please select an option from the menu :-\n" +
incorrectSelection + "\n_________________________________________" +
"\n  Please select options and submit again!";
alert(incorrectSelection);
return false;
}
else return true;
}



/// copy fields from one part of a form to another
/// remember to put all hidden variables at the bottom of the form
function copyAddressFields()
{
 if (!document.customerDetails.sameDelivery.checked)
 {   	       		   
   for (var i = 0; i<document.customerDetails.elements.length; i++) {
        var x = document.customerDetails.elements[i].name;
				
		if (x.indexOf("strDeliveryName") != -1) {
			document.customerDetails.elements[i].value = "";
		} else if (x.indexOf("strDeliveryAddress1") != -1) {   
  		     document.customerDetails.elements[i].value = "";
  		} else if (x.indexOf("strDeliveryAddress2") != -1) {
          	 document.customerDetails.elements[i].value = "";
       	} else if (x.indexOf("strDeliveryTown") != -1) {
          	 document.customerDetails.elements[i].value = "";
       	} else if (x.indexOf("strDeliveryPostcode") != -1) {
          	 document.customerDetails.elements[i].value = "";
       	} else if (x.indexOf("strDeliveryCountry") != -1) {
          	 document.customerDetails.elements[i].value = "0";
		} else {
		     //do nothing 
		} //end if 
	} //end for	
 }else{
    for (var i = 0; i<document.customerDetails.elements.length; i++) {
		 var x = document.customerDetails.elements[i].name;
		 var loggedIn = "true";
         var selValue = "";
		 
        if (loggedIn == "false"){//value form dropdown Country
            selValue = document.customerDetails.strCardholderCountry.value;
        }else{
	        selValue = document.customerDetails.strCardholderCountry.options[document.customerDetails.strCardholderCountry.selectedIndex].text;
  			} //endif  
		   			       
        if (x.indexOf("strDeliveryCountry") != -1) {
      	    for(var j=0;j<document.customerDetails.strDeliveryCountry.options.length;j++){
      		       if(document.customerDetails.strDeliveryCountry.options[j].text==selValue){
         		           document.customerDetails.strDeliveryCountry.selectedIndex=j; 
      		       }
                          }
		
			        } else if (x.indexOf("strDeliveryName") != -1) {
			             document.customerDetails.elements[i].value = document.customerDetails.elements[0].value;
			        } else if (x.indexOf("strDeliveryAddress1") != -1) {
			             document.customerDetails.elements[i].value = document.customerDetails.elements[2].value;
			        } else if (x.indexOf("strDeliveryAddress2") != -1) {
			             document.customerDetails.elements[i].value = document.customerDetails.elements[4].value;
			        } else if (x.indexOf("strDeliveryTown") != -1) {
			             document.customerDetails.elements[i].value = document.customerDetails.elements[6].value;
			        } else if (x.indexOf("strDeliveryPostcode") != -1) {
			             document.customerDetails.elements[i].value = document.customerDetails.elements[8].value;
			        			        
			        } else {
		             //do nothing 
		        	} //end if 
		   		} //end for	
				//window.alert(document.customerDetails.elements.length); 
     		} //end if 
} //end function
function DeliveryAddressChanged()
{
	customerDetails.pDelAddrChanged.value="Y";
}

function checkaddgear() 
{
//function to check details for a the one off purchase form on login page
var testEmail  = /^[a-z0-9]([a-z0-9_\-\.]*)@([a-z0-9_\-\.]*)(\.[a-z]{2,3}(\.[a-z]{2}){0,2})$/i;

incorrectEntry = "";

strUsedName = document.formusedgear.strUsedName.value;
strUsedEmail = document.formusedgear.strUsedEmail.value;
strUsedText = document.formusedgear.strUsedText.value;


if (strUsedName.length == 0) 
	{
		incorrectEntry += "\n - Please enter your name.";
	}

if (strUsedEmail.length == 0) 
	{
		incorrectEntry += "\n - Please enter your e-mail address.";
	}

if (strUsedEmail.length != 0) 
	{
		if (testEmail.test(strUsedEmail) == false)
		{
			incorrectEntry += "\n - Please enter a valid e-mail address.";
		}
	}

if (strUsedText.length == 0)
{
	incorrectEntry += "\n - Enter your Description";
}

if (incorrectEntry != "") {
incorrectEntry ="_____________________________\n" +
"Please amend the following fields :-\n" +
incorrectEntry + "\n_____________________________" +
"\n  Please re-enter and submit again!";
alert(incorrectEntry);
return false;
}
else return true;
}