// This script written by Abdul Hafeez and Khaleequu-ur-Rehman.
// AHK Soft have copyright of this script.
// URL: http://www.ahksoft.com
// JavaScript Document for Multiheathrowcars.
// This script for New Taxi Hire page
<!-- Begin
function Code_AHK(P_Code, Add_Msg){ //check postcode format is valid
 test = P_Code.value; size = test.length
	test = test.toUpperCase(); //Change to uppercase
	 while (test.slice(0,1) == " ") //Strip leading spaces
	  {test = test.substr(1,size-1);size = test.length
	  }
	 while(test.slice(size-1,size)== " ") //Strip trailing spaces
	  {test = test.substr(0,size-1);size = test.length
	  }
 P_Code.value = test; //write back to form field
 if (size < 6 || size > 8){ //Code length rule
  alert(test + " * wrong length of " + Add_Msg);
  P_Code.focus();
  return false;
  }
 if (!(isNaN(test.charAt(0)))){ //leftmost character must be alpha character rule
   alert(Add_Msg + test + " is not a valid postcode - cannot start with a number");
   P_Code.focus();
   return false;
  }
 if (isNaN(test.charAt(size-3))){ //first character of inward code must be numeric rule
   alert(Add_Msg + test + " is not a valid postcode - alpha character in wrong position");
   P_Code.focus();
   return false;
  }
 if (!(isNaN(test.charAt(size-2)))){ //second character of inward code must be alpha rule
   alert(Add_Msg + test + " is not a valid postcode - number in wrong position");
   P_Code.focus();
   return false;
  }
 if (!(isNaN(test.charAt(size-1)))){ //third character of inward code must be alpha rule
   alert(Add_Msg + test + " is not a valid postcode - number in wrong position");
   P_Code.focus();
   return false;
  }
	if (!(test.charAt(size-4) == " ")){//space in position length-3 rule
	   alert(test + " is not a valid postcode - no space or space in wrong position");
	   P_Code.focus();
	   return false;
	   }

count1 = test.indexOf(" ");count2 = test.lastIndexOf(" ");
 if (count1 != count2){//only one space rule
   alert(Add_Msg + test + " is not a valid postcode - only one space allowed");
   P_Code.focus();
   return false;
  }
//alert("Postcode Format OK");
return true;
}
//  End -->

	//Below function Updated code by third party
	function CompCode(pick_add, drop_add)
	{
		if (pick_add.value == drop_add.value)
		{
		   alert("Invalid request due to both postal code are same");
		   pick_add.focus();
		   return false;
		  }
		return true;
	}




/* Removal code here
function rif(){
	if (!(test.charAt(size-4) == " ")){//space in position length-3 rule
	   alert(test + " is not a valid postcode - no space or space in wrong position");
	   P_Code.focus();
	   return false;
	   }
	}
*/
