function validate_country(thisform){ 
        
  var newInput; 
  var cCountry; 
  var dSeparate; 
  var dPostcode; 
  var dCountry; 
  var cML = "United Kingdom - Mainland"; 
  var cHL = "United Kingdom - Scottish Highlands"; 
  var cNI = "United Kingdom - Northern Ireland"; 
  var cCI = "United Kingdom - Channel Islands"; 
  var cOS = "United Kingdom - Offshore"; 
  var oPC = new Array(); 
  var cISO = new Array(); 
  
  cISO['United Kingdom - Mainland'] = "UK"; 
  cISO['United Kingdom - Northern Ireland'] = "UK1"; 
  cISO['United Kingdom - Scottish Highlands'] = "UK2"; 
  cISO['United Kingdom - Channel Islands'] = "UK3"; 
  cISO['United Kingdom - Offshore'] = "UK4"; 
// Scottish Highlands 
  oPC["HS1"]=cHL; 
  oPC["HS2"]=cHL; 
  oPC["HS3"]=cHL; 
  oPC["HS4"]=cHL; 
  oPC["HS5"]=cHL; 
  oPC["HS6"]=cHL; 
  oPC["HS7"]=cHL; 
  oPC["HS8"]=cHL; 
  oPC["HS9"]=cHL; 
  oPC["IV3"]=cHL; 
  oPC["IV4"]=cHL; 
  oPC["IV5"]=cHL; 
  oPC["IV6"]=cHL; 
  oPC["IV7"]=cHL; 
  oPC["IV8"]=cHL; 
  oPC["IV9"]=cHL; 
  oPC["IV10"]=cHL; 
  oPC["IV11"]=cHL; 
  oPC["IV12"]=cHL;  
  oPC["IV13"]=cHL; 
  oPC["IV14"]=cHL; 
  oPC["IV15"]=cHL; 
  oPC["IV17"]=cHL; 
  oPC["IV19"]=cHL; 
  oPC["IV20"]=cHL; 
  oPC["IV21"]=cHL; 
  oPC["IV22"]=cHL; 
  oPC["IV23"]=cHL; 
  oPC["IV24"]=cHL; 
  oPC["IV25"]=cHL; 
  oPC["IV26"]=cHL; 
  oPC["IV27"]=cHL; 
  oPC["IV28"]=cHL; 
  oPC["IV29"]=cHL; 
  oPC["IV30"]=cHL; 
  oPC["IV31"]=cHL; 
  oPC["IV32"]=cHL; 
  oPC["IV33"]=cHL; 
  oPC["IV34"]=cHL; 
  oPC["IV35"]=cHL; 
  oPC["IV36"]=cHL; 
  oPC["IV37"]=cHL; 
  oPC["IV38"]=cHL; 
  oPC["IV39"]=cHL; 
  oPC["IV40"]=cHL; 
  oPC["IV41"]=cHL; 
  oPC["IV42"]=cHL; 
  oPC["IV43"]=cHL; 
  oPC["IV44"]=cHL; 
  oPC["IV45"]=cHL; 
  oPC["IV46"]=cHL; 
  oPC["IV47"]=cHL; 
  oPC["IV48"]=cHL; 
  oPC["IV49"]=cHL; 
  oPC["IV50"]=cHL; 
  oPC["IV51"]=cHL; 
  oPC["IV52"]=cHL; 
  oPC["IV53"]=cHL; 
  oPC["IV54"]=cHL; 
  oPC["IV55"]=cHL; 
  oPC["IV56"]=cHL; 
  oPC["IV63"]=cHL; 
  oPC["KA27"]=cHL; 
  oPC["KA28"]=cHL; 
  oPC["KW1"]=cHL; 
  oPC["KW2"]=cHL;  
  oPC["KW3"]=cHL; 
  oPC["KW4"]=cHL; 
  oPC["KW5"]=cHL; 
  oPC["KW6"]=cHL;  
  oPC["KW7"]=cHL; 
  oPC["KW8"]=cHL; 
  oPC["KW9"]=cHL; 
  oPC["KW10"]=cHL; 
  oPC["KW11"]=cHL; 
  oPC["KW12"]=cHL; 
  oPC["KW13"]=cHL; 
  oPC["KW14"]=cHL; 
  oPC["KW15"]=cHL; 
  oPC["KW16"]=cHL; 
  oPC["KW17"]=cHL; 
  oPC["PA20"]=cHL; 
  oPC["PA21"]=cHL; 
  oPC["PA22"]=cHL; 
  oPC["PA23"]=cHL; 
  oPC["PA24"]=cHL; 
  oPC["PA25"]=cHL; 
  oPC["PA26"]=cHL; 
  oPC["PA27"]=cHL; 
  oPC["PA28"]=cHL; 
  oPC["PA29"]=cHL; 
  oPC["PA30"]=cHL; 
  oPC["PA31"]=cHL; 
  oPC["PA32"]=cHL; 
  oPC["PA33"]=cHL; 
  oPC["PA34"]=cHL; 
  oPC["PA35"]=cHL; 
  oPC["PA36"]=cHL; 
  oPC["PA37"]=cHL; 
  oPC["PA38"]=cHL; 
  oPC["PA39"]=cHL; 
  oPC["PA40"]=cHL; 
  oPC["PA41"]=cHL; 
  oPC["PA42"]=cHL; 
  oPC["PA43"]=cHL; 
  oPC["PA44"]=cHL; 
  oPC["PA45"]=cHL; 
  oPC["PA46"]=cHL; 
  oPC["PA47"]=cHL; 
  oPC["PA48"]=cHL; 
  oPC["PA49"]=cHL; 
  oPC["PA60"]=cHL; 
  oPC["PA61"]=cHL; 
  oPC["PA62"]=cHL; 
  oPC["PA63"]=cHL; 
  oPC["PA64"]=cHL; 
  oPC["PA65"]=cHL; 
  oPC["PA66"]=cHL; 
  oPC["PA67"]=cHL; 
  oPC["PA68"]=cHL; 
  oPC["PA69"]=cHL; 
  oPC["PA70"]=cHL; 
  oPC["PA71"]=cHL; 
  oPC["PA72"]=cHL; 
  oPC["PA73"]=cHL; 
  oPC["PA74"]=cHL; 
  oPC["PA75"]=cHL; 
  oPC["PA76"]=cHL; 
  oPC["PA77"]=cHL; 
  oPC["PA78"]=cHL; 
  oPC["PH19"]=cHL; 
  oPC["PH20"]=cHL; 
  oPC["PH21"]=cHL; 
  oPC["PH22"]=cHL; 
  oPC["PH23"]=cHL; 
  oPC["PH24"]=cHL; 
  oPC["PH25"]=cHL; 
  oPC["PH26"]=cHL; 
  oPC["PH27"]=cHL; 
  oPC["PH28"]=cHL; 
  oPC["PH29"]=cHL; 
  oPC["PH30"]=cHL; 
  oPC["PH31"]=cHL; 
  oPC["PH32"]=cHL; 
  oPC["PH33"]=cHL; 
  oPC["PH34"]=cHL; 
  oPC["PH35"]=cHL; 
  oPC["PH36"]=cHL; 
  oPC["PH37"]=cHL; 
  oPC["PH38"]=cHL; 
  oPC["PH39"]=cHL; 
  oPC["PH40"]=cHL; 
  oPC["PH41"]=cHL; 
  oPC["PH42"]=cHL; 
  oPC["PH43"]=cHL; 
  oPC["PH44"]=cHL; 
  oPC["PH50"]=cHL; 
  oPC["ZE1"]=cHL; 
  oPC["ZE2"]=cHL; 
  oPC["ZE3"]=cHL; 
// Isle of Scilly 
  oPC["TR21"]=cOS; 
  oPC["TR22"]=cOS; 
  oPC["TR23"]=cOS; 
  oPC["TR24"]=cOS; 
  oPC["TR25"]=cOS; 
          
// Isle of Man 
  oPC["IM1"]=cOS; 
  oPC["IM2"]=cOS; 
  oPC["IM3"]=cOS; 
  oPC["IM4"]=cOS; 
  oPC["IM5"]=cOS; 
  oPC["IM6"]=cOS; 
  oPC["IM7"]=cOS; 
  oPC["IM8"]=cOS; 
  oPC["IM9"]=cOS; 
  oPC["IM86"]=cOS; 
  oPC["IM87"]=cOS; 
  oPC["IM99"]=cOS; 
        
// Isle of Wight 
  oPC["PO30"]=cOS; 
  oPC["PO31"]=cOS; 
  oPC["PO32"]=cOS; 
  oPC["PO33"]=cOS; 
  oPC["PO34"]=cOS; 
  oPC["PO35"]=cOS; 
  oPC["PO36"]=cOS; 
  oPC["PO37"]=cOS; 
  oPC["PO38"]=cOS; 
  oPC["PO39"]=cOS; 
  oPC["PO40"]=cOS; 
  oPC["PO41"]=cOS; 
        
// Jersey 
  oPC["JE1"]=cCI; 
  oPC["JE2"]=cCI; 
  oPC["JE3"]=cCI; 
  oPC["JE4"]=cCI; 
// Guernsey, Herm, Sark 
  oPC["GY1"]=cCI; 
  oPC["GY2"]=cCI; 
  oPC["GY3"]=cCI; 
  oPC["GY4"]=cCI; 
  oPC["GY5"]=cCI; 
  oPC["GY6"]=cCI; 
  oPC["GY7"]=cCI; 
  oPC["GY8"]=cCI; 
  oPC["GY9"]=cCI; 
  
// Northern Ireland 
  oPC["BT1"]=cNI; 
  oPC["BT2"]=cNI; 
  oPC["BT3"]=cNI; 
  oPC["BT4"]=cNI; 
  oPC["BT5"]=cNI; 
  oPC["BT6"]=cNI; 
  oPC["BT7"]=cNI; 
  oPC["BT8"]=cNI; 
  oPC["BT9"]=cNI; 
  oPC["BT10"]=cNI; 
  oPC["BT11"]=cNI; 
  oPC["BT12"]=cNI; 
  oPC["BT13"]=cNI; 
  oPC["BT14"]=cNI; 
  oPC["BT15"]=cNI; 
  oPC["BT16"]=cNI; 
  oPC["BT17"]=cNI; 
  oPC["BT18"]=cNI; 
  oPC["BT19"]=cNI; 
  oPC["BT20"]=cNI; 
  oPC["BT21"]=cNI; 
  oPC["BT22"]=cNI; 
  oPC["BT23"]=cNI; 
  oPC["BT24"]=cNI; 
  oPC["BT25"]=cNI; 
  oPC["BT26"]=cNI; 
  oPC["BT27"]=cNI; 
  oPC["BT28"]=cNI; 
  oPC["BT29"]=cNI; 
  oPC["BT30"]=cNI; 
  oPC["BT31"]=cNI; 
  oPC["BT32"]=cNI; 
  oPC["BT33"]=cNI; 
  oPC["BT34"]=cNI; 
  oPC["BT35"]=cNI; 
  oPC["BT36"]=cNI; 
  oPC["BT37"]=cNI; 
  oPC["BT38"]=cNI; 
  oPC["BT39"]=cNI; 
  oPC["BT40"]=cNI; 
  oPC["BT41"]=cNI; 
  oPC["BT42"]=cNI; 
  oPC["BT43"]=cNI; 
  oPC["BT44"]=cNI; 
  oPC["BT45"]=cNI; 
  oPC["BT46"]=cNI; 
  oPC["BT47"]=cNI; 
  oPC["BT48"]=cNI; 
  oPC["BT49"]=cNI; 
  oPC["BT50"]=cNI; 
  oPC["BT51"]=cNI; 
  oPC["BT52"]=cNI; 
  oPC["BT53"]=cNI; 
  oPC["BT54"]=cNI; 
  oPC["BT55"]=cNI; 
  oPC["BT56"]=cNI; 
  oPC["BT57"]=cNI; 
  oPC["BT58"]=cNI; 
  oPC["BT59"]=cNI; 
  oPC["BT60"]=cNI; 
  oPC["BT61"]=cNI; 
  oPC["BT62"]=cNI; 
  oPC["BT63"]=cNI; 
  oPC["BT64"]=cNI; 
  oPC["BT65"]=cNI; 
  oPC["BT66"]=cNI; 
  oPC["BT67"]=cNI; 
  oPC["BT68"]=cNI; 
  oPC["BT69"]=cNI; 
  oPC["BT70"]=cNI; 
  oPC["BT71"]=cNI; 
  oPC["BT72"]=cNI; 
  oPC["BT73"]=cNI; 
  oPC["BT74"]=cNI; 
  oPC["BT75"]=cNI; 
  oPC["BT76"]=cNI; 
  oPC["BT77"]=cNI; 
  oPC["BT78"]=cNI; 
  oPC["BT79"]=cNI; 
  oPC["BT80"]=cNI; 
  oPC["BT81"]=cNI; 
  oPC["BT82"]=cNI; 
  oPC["BT83"]=cNI; 
  oPC["BT84"]=cNI; 
  oPC["BT85"]=cNI; 
  oPC["BT86"]=cNI; 
  oPC["BT87"]=cNI; 
  oPC["BT88"]=cNI; 
  oPC["BT89"]=cNI; 
  oPC["BT90"]=cNI; 
  oPC["BT91"]=cNI; 
  oPC["BT92"]=cNI; 
  oPC["BT93"]=cNI; 
  oPC["BT94"]=cNI; 
  oPC["BT95"]=cNI; 
  oPC["BT96"]=cNI; 
  oPC["BT97"]=cNI; 
  oPC["BT98"]=cNI; 
  oPC["BT99"]=cNI; 
        
  if (btnNextButton == true){ 
    if(thisform.SEQUENCE.value == "1" && thisform.INVOICEPOSTALCODE){ 
      with (thisform.INVOICEEMAIL) 
                { 
                        var re = new RegExp("^[_a-zA-Z0-9-]+(\\.[_a-zA-Z0-9-]+)*@[a-zA-Z0-9-]+(\\.[a-zA-Z0-9-]+)*\\.(([0-9]{1,3})|([a-zA-Z]{2,3})|(aero|coop|info|museum|travel|name))$");
                        if (!value.match(re)){alert("Your email address is not valid.\nPlease check and try again.");return false;}
                } 
      dSeparate = thisform.SEPARATESHIP.value; 
      if (!dSeparate){ 
        dPostcode = thisform.INVOICEPOSTALCODE.value.toUpperCase(); 
        dCountry = thisform.INVOICECOUNTRY.value; 
        dPostcode = dPostcode.replace(/ /,""); 
        dPostcode = dPostcode.replace(dPostcode.substr(dPostcode.length-3, 3),""); 
        cCountry = oPC[dPostcode]; 
        if(!cCountry){cCountry = cML;} 
                  createfield(thisform, "LocationDeliveryCountry", cISO[cCountry]); 
                  createfield(thisform, "LocationDeliveryRegion", "UndefinedRegion"); 
                  thisform.INVOICECOUNTRY.value = cCountry; 
                  return true; 
      }else{ 
        return true; 
      } 
    } 
    if(thisform.SEQUENCE.value == "2" && thisform.DELIVERPOSTALCODE){ 
        dPostcode = thisform.DELIVERPOSTALCODE.value.toUpperCase(); 
        dCountry = thisform.DELIVERCOUNTRY.value; 
        dPostcode = dPostcode.replace(/ /,""); 
        dPostcode = dPostcode.replace(dPostcode.substr(dPostcode.length-3, 3),""); 
        cCountry = oPC[dPostcode]; 
        if(!cCountry){cCountry = cML;} 
                  createfield(thisform, "LocationDeliveryCountry", cISO[cCountry]); 
                  createfield(thisform, "LocationDeliveryRegion", "UndefinedRegion"); 
                  thisform.DELIVERCOUNTRY.value = cCountry; 
                  return true; 
     }else{ 
        return true; 
     }   
  } 
} 
function createfield(formname, fieldname, ecValue) { 
    var newInputElem = document.createElement("input"); 
    newInputElem.style.visibility = "hidden"; 
    formname.appendChild(newInputElem); 
    newInputElem.id = newInputElem.uniqueID; 
    newInputElem.name = fieldname; 
    newInputElem.value = ecValue; 
    
} 
