var countryTerritory = [];

countryTerritory['USA'] = [];
countryTerritory['USA']['AL'] = 'Alabama';
countryTerritory['USA']['AK'] = 'Alaska';
countryTerritory['USA']['AZ'] = 'Arizona';
countryTerritory['USA']['AR'] = 'Arkansas';
countryTerritory['USA']['CA'] = 'California';
countryTerritory['USA']['CO'] = 'Colorado';
countryTerritory['USA']['CT'] = 'Connecticut';
countryTerritory['USA']['DE'] = 'Delaware';
countryTerritory['USA']['DC'] = 'District Of Columbia';
countryTerritory['USA']['FL'] = 'Florida';
countryTerritory['USA']['GA'] = 'Georgia';
countryTerritory['USA']['HI'] = 'Hawaii';
countryTerritory['USA']['ID'] = 'Idaho';
countryTerritory['USA']['IL'] = 'Illinois';
countryTerritory['USA']['IN'] = 'Indiana';
countryTerritory['USA']['IA'] = 'Iowa';
countryTerritory['USA']['KS'] = 'Kansas';
countryTerritory['USA']['KY'] = 'Kentucky';
countryTerritory['USA']['LA'] = 'Louisiana';
countryTerritory['USA']['ME'] = 'Maine';
countryTerritory['USA']['MD'] = 'Maryland';
countryTerritory['USA']['MA'] = 'Massachusetts';
countryTerritory['USA']['MI'] = 'Michigan';
countryTerritory['USA']['MN'] = 'Minnesota';
countryTerritory['USA']['MS'] = 'Mississippi';
countryTerritory['USA']['MO'] = 'Missouri';
countryTerritory['USA']['MT'] = 'Montana';
countryTerritory['USA']['NE'] = 'Nebraska';
countryTerritory['USA']['NV'] = 'Nevada';
countryTerritory['USA']['NH'] = 'New Hampshire';
countryTerritory['USA']['NJ'] = 'New Jersey';
countryTerritory['USA']['NM'] = 'New Mexico';
countryTerritory['USA']['NY'] = 'New York';
countryTerritory['USA']['NC'] = 'North Carolina';
countryTerritory['USA']['ND'] = 'North Dakota';
countryTerritory['USA']['OH'] = 'Ohio';
countryTerritory['USA']['OK'] = 'Oklahoma';
countryTerritory['USA']['OR'] = 'Oregon';
countryTerritory['USA']['PA'] = 'Pennsylvania';
countryTerritory['USA']['RI'] = 'Rhode Island';
countryTerritory['USA']['SC'] = 'South Carolina';
countryTerritory['USA']['SD'] = 'South Dakota';
countryTerritory['USA']['TN'] = 'Tennessee';
countryTerritory['USA']['TX'] = 'Texas';
countryTerritory['USA']['UT'] = 'Utah';
countryTerritory['USA']['VT'] = 'Vermont';
countryTerritory['USA']['VA'] = 'Virginia';
countryTerritory['USA']['WA'] = 'Washington';
countryTerritory['USA']['WV'] = 'West Virginia';
countryTerritory['USA']['WI'] = 'Wisconsin';
countryTerritory['USA']['WY'] = 'Wyoming';


countryTerritory['CANADA'] = [];
countryTerritory['CANADA']['AB'] = 'Alberta';
countryTerritory['CANADA']['BC'] = 'British Columbia';
countryTerritory['CANADA']['MB'] = 'Manitoba';
countryTerritory['CANADA']['NB'] = 'New Brunswick';
countryTerritory['CANADA']['NL'] = "Newfoundland";
countryTerritory['CANADA']['NS'] = "Nova Scotia";
countryTerritory['CANADA']['NU'] = "Nunavut";
countryTerritory['CANADA']['ON'] = 'Ontario';
countryTerritory['CANADA']['PE'] = "Prince Edward Island";
countryTerritory['CANADA']['QC'] = 'Quebec';
countryTerritory['CANADA']['SK'] = "Saskatchewan";
countryTerritory['CANADA']['YT'] = "Yukon";


countryTerritory['UK'] = [];
countryTerritory['UK']['ABC'] = 'Aberdeen City';
countryTerritory['UK']['ABD'] = 'Aberdeenshire';
countryTerritory['UK']['ANS'] = 'Angus';
countryTerritory['UK']['ANT'] = 'Antrim';
countryTerritory['UK']['AYR'] = 'Argyll and Bute';
countryTerritory['UK']['ARM'] = 'Armagh';
countryTerritory['UK']['AVN'] = 'Avon';
countryTerritory['UK']['BDF'] = 'Bedfordshire';
countryTerritory['UK']['BUG'] = 'Blaena Gwent';
countryTerritory['UK']['BRD'] = 'Bridgend';
countryTerritory['UK']['BTL'] = 'Bristol, City of';
countryTerritory['UK']['BKM'] = 'Buckinghamshire';
countryTerritory['UK']['CPY'] = 'Caerphilly';
countryTerritory['UK']['CAM'] = 'Cambridgeshire';
countryTerritory['UK']['CFF'] = 'Cardiff';
countryTerritory['UK']['CMS'] = 'Carmarthenshire';
countryTerritory['UK']['CDG'] = 'Ceredigion';
countryTerritory['UK']['CIS'] = 'Channel Islands';
countryTerritory['UK']['CHS'] = 'Cheshire';
countryTerritory['UK']['CLK'] = 'Clackmannanshire';
countryTerritory['UK']['CWY'] = 'Conwy';
countryTerritory['UK']['CON'] = 'Cornwall';
countryTerritory['UK']['CUM'] = 'Cumbria';
countryTerritory['UK']['DEN'] = 'Denbighshire';
countryTerritory['UK']['DBY'] = 'Derbyshire';
countryTerritory['UK']['DEV'] = 'Devon';
countryTerritory['UK']['DOR'] = 'Dorset';
countryTerritory['UK']['DOW'] = 'Down';
countryTerritory['UK']['DGY'] = 'Dumfries and Galloway';
countryTerritory['UK']['DUR'] = 'Durham';
countryTerritory['UK']['EAY'] = 'East Ayrshire';
countryTerritory['UK']['EDB'] = 'East Dunbartonshire';
countryTerritory['UK']['ELN'] = 'East Lothian';
countryTerritory['UK']['ERF'] = 'East Renfrewshire';
countryTerritory['UK']['ERY'] = 'East Riding of Yorkshire';
countryTerritory['UK']['ESS'] = 'East Sussex';
countryTerritory['UK']['EDC'] = 'Edinburgh, City of';
countryTerritory['UK']['FKK'] = 'Falkirk';
countryTerritory['UK']['FER'] = 'Fermanagh';
countryTerritory['UK']['FIF'] = 'Fife';
countryTerritory['UK']['FLN'] = 'Flintshire';
countryTerritory['UK']['GGW'] = 'Glasgow City';
countryTerritory['UK']['GLS'] = 'Gloucestershire';
countryTerritory['UK']['GNT'] = 'Gwynedd';
countryTerritory['UK']['HAM'] = 'Hampshire';
countryTerritory['UK']['HEF'] = 'Herefordshire';
countryTerritory['UK']['HRT'] = 'Hertfordshire';
countryTerritory['UK']['HLD'] = 'Highland';
countryTerritory['UK']['HUM'] = 'Humberside';
countryTerritory['UK']['IVY'] = 'Inverclyde';
countryTerritory['UK']['IOA'] = 'Isle of Anglesey';
countryTerritory['UK']['IOM'] = 'Isle of Man';
countryTerritory['UK']['IOW'] = 'Isle of Wight';
countryTerritory['UK']['IOS'] = 'Isles of Scilly';
countryTerritory['UK']['KEN'] = 'Kent';
countryTerritory['UK']['LAN'] = 'Lancashire';
countryTerritory['UK']['LEI'] = 'Leicestershire';
countryTerritory['UK']['LIN'] = 'Lincolnshire';
countryTerritory['UK']['LON'] = 'London, City of';
countryTerritory['UK']['LDY'] = 'Londonerry';
countryTerritory['UK']['GTM'] = 'Manchester';
countryTerritory['UK']['MYS'] = 'Merseyside';
countryTerritory['UK']['MYT'] = 'Merthyr Tydfil';
countryTerritory['UK']['MDX'] = 'Middlesex';
countryTerritory['UK']['MLN'] = 'Midlothian';
countryTerritory['UK']['MON'] = 'Monmouthshire';
countryTerritory['UK']['MOR'] = 'Moray';
countryTerritory['UK']['NPT'] = 'Neath Port Talbot';
countryTerritory['UK']['NWP'] = 'Newport';
countryTerritory['UK']['NFK'] = 'Norfolk';
countryTerritory['UK']['NAY'] = 'North Ayrshire';
countryTerritory['UK']['NLK'] = 'North Lanarkshire';
countryTerritory['UK']['NRY'] = 'North Yorkshire';
countryTerritory['UK']['NTH'] = 'Northamptonshire';
countryTerritory['UK']['NBL'] = 'Northumberland';
countryTerritory['UK']['NTT'] = 'Nottinghamshire';
countryTerritory['UK']['OKI'] = 'Orkney';
countryTerritory['UK']['OXF'] = 'Oxfordshire';
countryTerritory['UK']['PEM'] = 'Pembrokeshire';
countryTerritory['UK']['PAK'] = 'Perth and Kinross';
countryTerritory['UK']['POW'] = 'Powys';
countryTerritory['UK']['CLV'] = 'Redcar and Cleveland';
countryTerritory['UK']['RFW'] = 'Renfrewshire';
countryTerritory['UK']['RCT'] = 'Rhondda Cynon Taff';
countryTerritory['UK']['ROX'] = 'Roxburghshire';
countryTerritory['UK']['RUT'] = 'Rutland';
countryTerritory['UK']['BOR'] = 'Scottish Borders, The';
countryTerritory['UK']['SHI'] = 'Shetland Islands';
countryTerritory['UK']['SAL'] = 'Shropshire';
countryTerritory['UK']['SOM'] = 'Somerset';
countryTerritory['UK']['SAY'] = 'South Ayrshire';
countryTerritory['UK']['SLK'] = 'South Lanarkshire';
countryTerritory['UK']['SYK'] = 'South Yorkshire';
countryTerritory['UK']['STS'] = 'Staffordshire';
countryTerritory['UK']['STI'] = 'Stirling';
countryTerritory['UK']['SFK'] = 'Suffolk';
countryTerritory['UK']['SRY'] = 'Surrey';
countryTerritory['UK']['SWA'] = 'Swansea';
countryTerritory['UK']['TFN'] = 'Torfaen';
countryTerritory['UK']['TWR'] = 'Tyne and Wear';
countryTerritory['UK']['TYR'] = 'Tyrone';
countryTerritory['UK']['VOG'] = 'Vale of Glamorgan';
countryTerritory['UK']['WAR'] = 'Warwickshire';
countryTerritory['UK']['BEW'] = 'West Berkshire';
countryTerritory['UK']['WDB'] = 'West Dunbartonshire';
countryTerritory['UK']['WLN'] = 'West Lothian';
countryTerritory['UK']['WMD'] = 'West Midlands';
countryTerritory['UK']['WSX'] = 'West Sussex';
countryTerritory['UK']['WYK'] = 'West Yorkshire';
countryTerritory['UK']['WIS'] = 'Western Isles';
countryTerritory['UK']['WIL'] = 'Wiltshire';
countryTerritory['UK']['WOR'] = 'Worcestershire';
countryTerritory['UK']['WXM'] = 'Wrexham';


countryTerritory['Australia'] = [];
countryTerritory['Australia']['CT'] = 'Australian Capital Territory';
countryTerritory['Australia']['SW'] = 'New South Wales';
countryTerritory['Australia']['NT'] = 'Northern Territory';
countryTerritory['Australia']['QL'] = 'Queensland';
countryTerritory['Australia']['SA'] = 'South Australia';
countryTerritory['Australia']['TM'] = 'Tasmania';
countryTerritory['Australia']['VC'] = 'Victoria';
countryTerritory['Australia']['WA'] = 'Western Australia';

/* ***Extra UK counties***
countryTerritory['UK']['Ards'] = 'Ards';
countryTerritory['UK']['Ballymena'] = 'Ballymena';
countryTerritory['UK']['Ballymoney'] = 'Ballymoney';
countryTerritory['UK']['Banbridge'] = 'Banbridge';
countryTerritory['UK']['Barking and Dagenham'] = 'Barking and Dagenham';
countryTerritory['UK']['Barnet'] = 'Barnet';
countryTerritory['UK']['Barnsley'] = 'Barnsley';
countryTerritory['UK']['Bath and North East Somerset'] = 'Bath and North East Somerset';
countryTerritory['UK']['Belfast'] = 'Belfast';
countryTerritory['UK']['Bexley'] = 'Bexley';
countryTerritory['UK']['Birmingham'] = 'Birmingham';
countryTerritory['UK']['Blackburn with Darwen'] = 'Blackburn with Darwen';
countryTerritory['UK']['Blackpool'] = 'Blackpool';
countryTerritory['UK']['Bolton'] = 'Bolton';
countryTerritory['UK']['Bournemouth'] = 'Bournemouth';
countryTerritory['UK']['Bracknell Forest'] = 'Bracknell Forest';
countryTerritory['UK']['Bradford'] = 'Bradford';
countryTerritory['UK']['Brent'] = 'Brent';
countryTerritory['UK']['Brighton and Hove'] = 'Brighton and Hove';
countryTerritory['UK']['Bromley'] = 'Bromley';
countryTerritory['UK']['Bury'] = 'Bury';
countryTerritory['UK']['Calderdale'] = 'Calderdale';
countryTerritory['UK']['Camden'] = 'Camden';
countryTerritory['UK']['Carrickfergus'] = 'Carrickfergus';
countryTerritory['UK']['Castlereagh'] = 'Castlereagh';
countryTerritory['UK']['Clwyd'] = 'Clwyd';
countryTerritory['UK']['Coleraine'] = 'Coleraine';
countryTerritory['UK']['Cookstown'] = 'Cookstown';
countryTerritory['UK']['Coventry'] = 'Coventry';
countryTerritory['UK']['Craigavon'] = 'Craigavon';
countryTerritory['UK']['Croydon'] = 'Croydon';
countryTerritory['UK']['Darlington'] = 'Darlington';
countryTerritory['UK']['Derby'] = 'Derby';
countryTerritory['UK']['Derry'] = 'Derry';
countryTerritory['UK']['Doncaster'] = 'Doncaster';
countryTerritory['UK']['Dudley'] = 'Dudley';
countryTerritory['UK']['Dundee City'] = 'Dundee City';
countryTerritory['UK']['Dungannon'] = 'Dungannon';
countryTerritory['UK']['Dyfed'] = 'Dyfed';
countryTerritory['UK']['Ealing'] = 'Ealing';
countryTerritory['UK']['Eilean Siar'] = 'Eilean Siar';
countryTerritory['UK']['Enfield'] = 'Enfield';
countryTerritory['UK']['England'] = 'England';
countryTerritory['UK']['Essex'] = 'Essex';
countryTerritory['UK']['Gateshead'] = 'Gateshead';
countryTerritory['UK']['Grampian'] = 'Grampian';
countryTerritory['UK']['Greater London'] = 'Greater London';
countryTerritory['UK']['Greenwich'] = 'Greenwich';
countryTerritory['UK']['Gwent'] = 'Gwent';
countryTerritory['UK']['Hackney'] = 'Hackney';
countryTerritory['UK']['Halton'] = 'Halton';
countryTerritory['UK']['Hammersmith and Fulham'] = 'Hammersmith and Fulham';
countryTerritory['UK']['Haringey'] = 'Haringey';
countryTerritory['UK']['Harrow'] = 'Harrow';
countryTerritory['UK']['Hartlepool'] = 'Hartlepool';
countryTerritory['UK']['Havering'] = 'Havering';
countryTerritory['UK']['Hillingdon'] = 'Hillingdon';
countryTerritory['UK']['Hounslow'] = 'Hounslow';
countryTerritory['UK']['Islington'] = 'Islington';
countryTerritory['UK']['Kensington and Chelsea'] = 'Kensington and Chelsea';
countryTerritory['UK']['Kingston upon Hull, City of'] = 'Kingston upon Hull, City of';
countryTerritory['UK']['Kingston upon Thames'] = 'Kingston upon Thames';
countryTerritory['UK']['Kirklees'] = 'Kirklees';
countryTerritory['UK']['Knowsley'] = 'Knowsley';
countryTerritory['UK']['Lambeth'] = 'Lambeth';
countryTerritory['UK']['Larne'] = 'Larne';
countryTerritory['UK']['Leeds'] = 'Leeds';
countryTerritory['UK']['Leicester'] = 'Leicester';
countryTerritory['UK']['Lewisham'] = 'Lewisham';
countryTerritory['UK']['Limavady'] = 'Limavady';
countryTerritory['UK']['Lisburn'] = 'Lisburn';
countryTerritory['UK']['Liverpool'] = 'Liverpool';
countryTerritory['UK']['Lothian'] = 'Lothian';
countryTerritory['UK']['Luton'] = 'Luton';
countryTerritory['UK']['Magherafelt'] = 'Magherafelt';
countryTerritory['UK']['Medway'] = 'Medway';
countryTerritory['UK']['Merton'] = 'Merton';
countryTerritory['UK']['Middlesbrough'] = 'Middlesbrough';
countryTerritory['UK']['Milton Keynes'] = 'Milton Keynes';
countryTerritory['UK']['Moyle'] = 'Moyle';
countryTerritory['UK']['Newcastle upon Tyne'] = 'Newcastle upon Tyne';
countryTerritory['UK']['Newham'] = 'Newham';
countryTerritory['UK']['Newry and Mourne'] = 'Newry and Mourne';
countryTerritory['UK']['Newtownabbey'] = 'Newtownabbey';
countryTerritory['UK']['North Down'] = 'North Down';
countryTerritory['UK']['North East Lincolnshire'] = 'North East Lincolnshire';
countryTerritory['UK']['North Lincolnshire'] = 'North Lincolnshire';
countryTerritory['UK']['North Somerset'] = 'North Somerset';
countryTerritory['UK']['North Tyneside'] = 'North Tyneside';
countryTerritory['UK']['Northern Ireland'] = 'Northern Ireland';
countryTerritory['UK']['Nottingham'] = 'Nottingham';
countryTerritory['UK']['Oldham'] = 'Oldham';
countryTerritory['UK']['Omagh'] = 'Omagh';
countryTerritory['UK']['Peterborough'] = 'Peterborough';
countryTerritory['UK']['Plymouth'] = 'Plymouth';
countryTerritory['UK']['Poole'] = 'Poole';
countryTerritory['UK']['Portsmouth'] = 'Portsmouth';
countryTerritory['UK']['Reading'] = 'Reading';
countryTerritory['UK']['Redbridge'] = 'Redbridge';
countryTerritory['UK']['Richmond upon Thames'] = 'Richmond upon Thames';
countryTerritory['UK']['Rochdale'] = 'Rochdale';
countryTerritory['UK']['Rotherham'] = 'Rotherham';
countryTerritory['UK']['Salford'] = 'Salford';
countryTerritory['UK']['Sandwell'] = 'Sandwell';
countryTerritory['UK']['Scotland'] = 'Scotland';
countryTerritory['UK']['Sefton'] = 'Sefton';
countryTerritory['UK']['Sheffield'] = 'Sheffield';
countryTerritory['UK']['Slough'] = 'Slough';
countryTerritory['UK']['Solihull'] = 'Solihull';
countryTerritory['UK']['South Glamorgan'] = 'South Glamorgan';
countryTerritory['UK']['South Gloucestershire'] = 'South Gloucestershire';
countryTerritory['UK']['South Tyneside'] = 'South Tyneside';
countryTerritory['UK']['Southampton'] = 'Southampton';
countryTerritory['UK']['Southend-on-Sea'] = 'Southend-on-Sea';
countryTerritory['UK']['Southwark'] = 'Southwark';
countryTerritory['UK']['St. Helens'] = 'St. Helens';
countryTerritory['UK']['Stockport'] = 'Stockport';
countryTerritory['UK']['Stockton-on-Tees'] = 'Stockton-on-Tees';
countryTerritory['UK']['Stoke-on-Trent'] = 'Stoke-on-Trent';
countryTerritory['UK']['Strabane'] = 'Strabane';
countryTerritory['UK']['Strathclyde'] = 'Strathclyde';
countryTerritory['UK']['Sunderland'] = 'Sunderland';
countryTerritory['UK']['Sutton'] = 'Sutton';
countryTerritory['UK']['Swindon'] = 'Swindon';
countryTerritory['UK']['Tameside'] = 'Tameside';
countryTerritory['UK']['Tayside'] = 'Tayside';
countryTerritory['UK']['Telford and Wrekin'] = 'Telford and Wrekin';
countryTerritory['UK']['Thurrock'] = 'Thurrock';
countryTerritory['UK']['Torbay'] = 'Torbay';
countryTerritory['UK']['Tower Hamlets'] = 'Tower Hamlets';
countryTerritory['UK']['Trafford'] = 'Trafford';
countryTerritory['UK']['Wakefield'] = 'Wakefield';
countryTerritory['UK']['Wales'] = 'Wales';
countryTerritory['UK']['Walsall'] = 'Walsall';
countryTerritory['UK']['Waltham Forest'] = 'Waltham Forest';
countryTerritory['UK']['Wandsworth'] = 'Wandsworth';
countryTerritory['UK']['Warrington'] = 'Warrington';
countryTerritory['UK']['Westminster'] = 'Westminster';
countryTerritory['UK']['Wigan'] = 'Wigan';
countryTerritory['UK']['Windsor and Maidenhead'] = 'Windsor and Maidenhead';
countryTerritory['UK']['Wirral'] = 'Wirral';
countryTerritory['UK']['Wokingham'] = 'Wokingham';
countryTerritory['UK']['Wolverhampton'] = 'Wolverhampton';
countryTerritory['UK']['York'] = 'York';
*/

/*
var countryTerritory = new Object;

countryTerritory.USA.AL = 'Alabama';
countryTerritory.USA.AK = 'Alaska';
countryTerritory.USA.AZ = 'Arizona';
countryTerritory.USA.AR = 'Arkansas';
countryTerritory.USA.CA = 'California';
countryTerritory.USA.CO = 'Colorado';
countryTerritory.USA.CT = 'Connecticut';
countryTerritory.USA.DE = 'Delaware';
countryTerritory.USA.DC = 'District Of Columbia';
countryTerritory.USA.FL = 'Florida';
countryTerritory.USA.GA = 'Georgia';
countryTerritory.USA.HI = 'Hawaii';
countryTerritory.USA.ID = 'Idaho';
countryTerritory.USA.IL = 'Illinois';
countryTerritory.USA.IN = 'Indiana';
countryTerritory.USA.IA = 'Iowa';
countryTerritory.USA.KS = 'Kansas';
countryTerritory.USA.KY = 'Kentucky';
countryTerritory.USA.LA = 'Louisiana';
countryTerritory.USA.ME = 'Maine';
countryTerritory.USA.MD = 'Maryland';
countryTerritory.USA.MA = 'Massachusetts';
countryTerritory.USA.MI = 'Michigan';
countryTerritory.USA.MN = 'Minnesota';
countryTerritory.USA.MS = 'Mississippi';
countryTerritory.USA.MO = 'Missouri';
countryTerritory.USA.MT = 'Montana';
countryTerritory.USA.NE = 'Nebraska';
countryTerritory.USA.NV = 'Nevada';
countryTerritory.USA.NH = 'New Hampshire';
countryTerritory.USA.NJ = 'New Jersey';
countryTerritory.USA.NM = 'New Mexico';
countryTerritory.USA.NY = 'New York';
countryTerritory.USA.NC = 'North Carolina';
countryTerritory.USA.ND = 'North Dakota';
countryTerritory.USA.OH = 'Ohio';
countryTerritory.USA.OK = 'Oklahoma';
countryTerritory.USA.OR = 'Oregon';
countryTerritory.USA.PA = 'Pennsylvania';
countryTerritory.USA.RI = 'Rhode Island';
countryTerritory.USA.SC = 'South Carolina';
countryTerritory.USA.SD = 'South Dakota';
countryTerritory.USA.TN = 'Tennessee';
countryTerritory.USA.TX = 'Texas';
countryTerritory.USA.UT = 'Utah';
countryTerritory.USA.VT = 'Vermont';
countryTerritory.USA.VA = 'Virginia';
countryTerritory.USA.WA = 'Washington';
countryTerritory.USA.WV = 'West Virginia';
countryTerritory.USA.WY = 'Wyoming';

countryTerritory.CANADA.AB = 'Alberta';
countryTerritory.CANADA.BC = 'British Columbia';
countryTerritory.CANADA.MB = 'Manitoba';
countryTerritory.CANADA.NB = 'New Brunswick';
countryTerritory.CANADA.ON = 'Ontario';
countryTerritory.CANADA.QC = 'Quebec';
*/

function determineCountry(selectedCountry)
{

	if(!selectedCountry || selectedCountry== 0)
		return;
		
	if(!document.getElementById)
		return;
		
	var selState = document.getElementById('selState');
	
	selState.options.length = 0;
	if(selectedCountry == "USA" || selectedCountry == "US" || selectedCountry == "CANADA" || selectedCountry == "CA" || selectedCountry == "UK" || selectedCountry == "Australia")
	{		
		selState.options[0] = new Option('-Please Select-', 0);
		var i = 1;
		for(var territory in countryTerritory[selectedCountry])
		{
			selState.options[i] = new Option(countryTerritory[selectedCountry][territory], territory);
			i++;
		}
	}/*
	else if (selectedCountry == "Australia" || selectedCountry == "UK")
	{
		selState.options[0] = new Option('-- Please Specify Below --', 'sp');
	}*/
	
	if(selectedCountry == "USA" || selectedCountry == "US")
	{
		document.getElementById('selState').style.display = 'block';
		document.getElementById('stateText').innerHTML= "State *";
	}
	else if(selectedCountry == "CANADA" || selectedCountry == "CA")
	{
		document.getElementById('selState').style.display = 'block';
		document.getElementById('stateText').innerHTML= "Province *";
			
	}
	else if(selectedCountry == "UK")
	{
		document.getElementById('selState').style.display = 'block';
		document.getElementById('stateText').innerHTML= "County *";
			
	}
	else if(selectedCountry == "Australia")
	{
		document.getElementById('selState').style.display = 'block';
		document.getElementById('stateText').innerHTML= "State *";
			
	}/*
	else if(selectedCountry == "UK" || selectedCountry == "Australia")
	{
		document.getElementById('txtProv').style.display = 'block';
		document.getElementById('selState').style.display = 'none';
		document.getElementById('stateText').innerHTML= "Province *";
			
	}*/
}

function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

function validateCreate() 
{
	function IsNumeric(sText)
	{	
	    var ValidChars = "0123456789.";
	    var IsNumber=true;
	    var Char;
	
	 
	    for (i = 0; i < sText.length && IsNumber == true; i++) 
	    { 
	   		Char = sText.charAt(i); 
	      	if (ValidChars.indexOf(Char) == -1) 
         	{
         		IsNumber = false;
         	}
	   	}
	   	return IsNumber;
	   
	 }

	    //define validation status and form regular expressions
		var validate_ok = true;
		var error_str   = "Error Processing Form: \n\n";
		
		var txtFName = document.getElementById('txtFName').value;
		var txtLName = document.getElementById('txtLName').value;
		var selCountry = document.getElementById('selCountry').value;
		var selState = document.getElementById('selState').value;
		var txtDayPhone = document.getElementById('txtDayPhone').value;
		var txtEmail = document.getElementById('txtEmail').value;
		var txtEmailC = document.getElementById('txtEmailC').value;
	    var name_regex = /^[\w]+[\s\w]*$/;
	       
	    if( txtFName.length == 0 || !name_regex.exec(txtFName) ){
	    	validate_ok = false;
	    	error_str += "First Name Field must only have " + 
	    				 "alphanumeric characters (A-Z,0-9).\n\n"; 		
	    }
	    if(txtLName.length == 0 || !name_regex.exec(txtLName) )
	    {
	    	validate_ok = false;
	    	error_str += "Last Name Field must only have " + 
	    				 "alphanumeric characters (A-Z,0-9).\n\n"; 	
	    }
	    if(selCountry == 0)
	    {
	    	validate_ok = false;
	    	error_str += "You Must Select A Country \n\n"; 	
	    }
	    
	    if(selState == 0)
	    {
	    	validate_ok = false;
	    	error_str += "You Must Select A State/Province \n\n";
	    }
	    /*
	    if(selCountry=="USA" && selState ==0)
	    {
	    	validate_ok = false;
	    	error_str += "You Must Select A State \n\n"; 
	    }
	    else if(selCountry=="CANADA" && selState == 0)
	    {
	    	validate_ok = false;
	    	error_str += "You Must Select A Province \n\n"; 
	    }
	    else if((selCountry=="UK" || selCountry=="Australia") && txtProv == '')
	    {
	    	validate_ok = false;
	    	error_str += "You Must Specify A Province \n\n"; 
	    }
	    */
	    txtDayPhone = txtDayPhone.replace(/[^0-9]/g, '');
	    if(!IsNumeric(txtDayPhone) || txtDayPhone.length == 0)
	    {
	    	validate_ok = false;
	    	error_str += "Phone Number Must Be a Numeric Value \n\n"; 	
	    }
	    
	    if(txtDayPhone.length < 10 || txtDayPhone.length > 20)
	    {
	    	validate_ok = false;
	    	error_str += "Please Supply A Valid Phone Number. \n\n";
	    }

	    /*
	    if(regexPhone.match(/\d*\d{3}\d{3}\d{4})
	    {
	    		//ex: 1 234 567 8901 (without spaces)
	    	if(regexPhone.length == 11)
	    		regexPhone = '(' + regexPhone.substr(1,3) + ') ' + regexPhone.substr(4,6) + " " + regexPhone.substr(7,10);
	    	else //ex: 123 456 7890 (without spaces)
	    		regexPhone = '(' + regexPhone.substr(0,2) + ') ' + regexPhone.substr(3,5) + " " + regexPhone.substr(6,9);
	    }
	    else if(regexPhone.match(/^0[0-9][0-9]{8,9}$/)
	    {
	    	
	    }
	    */
	    if(txtEmail.length == 0)
	    {
	    	validate_ok = false;
	    	error_str += "Email Must be filled in \n\n"; 	
	    }
	    if(txtEmail != txtEmailC)
	    {
	    	validate_ok = false;
	    	error_str += "Email confirmation does not match Email Adress \n\n"; 	
	    }
	    
	
	
		if(!validate_ok) 
		{
			  window.alert(error_str);
			  
		}
		else 
		{
			//alert("contact Added");	
			document.getElementById('leadForm').submit();
		}
			
		return false;
}

function validateCreateFreeVideo() 
{
	function IsNumeric(sText)
	{	
	    var ValidChars = "0123456789.";
	    var IsNumber=true;
	    var Char;
	
	 
	    for (i = 0; i < sText.length && IsNumber == true; i++) 
	    { 
	   		Char = sText.charAt(i); 
	      	if (ValidChars.indexOf(Char) == -1) 
         	{
         		IsNumber = false;
         	}
	   	}
	   	return IsNumber;
	   
	 }

	    //define validation status and form regular expressions
		var validate_ok = true;
		var error_str   = "Error Processing Form: \n\n";
		
		var txtFName = document.getElementById('txtFName').value;
		var txtLName = document.getElementById('txtLName').value;
		var txtDayPhone = document.getElementById('txtDayPhone').value;
		var txtEmail = document.getElementById('txtEmail').value;
		var name_regex = /^[\w]+[\s\w]*$/;
	       
	    if( txtFName.length == 0 || !name_regex.exec(txtFName) )
	    {
	    	validate_ok = false;
	    	error_str += "First Name Field must only have " + 
	    				 "alphanumeric characters (A-Z,0-9).\n\n"; 		
	    }
	    if(txtLName.length == 0 || !name_regex.exec(txtLName) )
	    {
	    	validate_ok = false;
	    	error_str += "Last Name Field must only have " + 
	    				 "alphanumeric characters (A-Z,0-9).\n\n"; 	
	    }
	    	    txtDayPhone = txtDayPhone.replace(/[^0-9]/g, '');
	    if(!IsNumeric(txtDayPhone) || txtDayPhone.length == 0)
	    {
	    	validate_ok = false;
	    	error_str += "Phone Number Must Be a Numeric Value \n\n"; 	
	    }
	    
	    if(txtDayPhone.length < 10 || txtDayPhone.length > 20)
	    {
	    	validate_ok = false;
	    	error_str += "Please Supply A Valid Phone Number. \n\n";
	    }
	    if(txtEmail.length == 0)
	    {
	    	validate_ok = false;
	    	error_str += "Email Must be filled in \n\n"; 	
	    }
	   	if(!validate_ok) 
		{
			  window.alert(error_str);
			  
		}
		else 
		{
			//alert("contact Added");	
			document.getElementById('leadForm').submit();
		}
			
		return false;
}

function validateCreateJodi() 
{
	function IsNumeric(sText)
	{	
	    var ValidChars = "0123456789.";
	    var IsNumber=true;
	    var Char;
	
	 
	    for (i = 0; i < sText.length && IsNumber == true; i++) 
	    { 
	   		Char = sText.charAt(i); 
	      	if (ValidChars.indexOf(Char) == -1) 
         	{
         		IsNumber = false;
         	}
	   	}
	   	return IsNumber;
	   
	 }

	    //define validation status and form regular expressions
		var validate_ok = true;
		var error_str   = "Error Processing Form: \n\n";
		
		var txtFName = document.getElementById('txtFName').value;
		var txtLName = document.getElementById('txtLName').value;
		var txtDayPhone = document.getElementById('txtDayPhone').value;
		var txtEmail = document.getElementById('txtEmail').value;
		var txtEmailC = document.getElementById('txtEmailC').value;
	    var name_regex = /^[\w]+[\s\w]*$/;
	       
	    if( txtFName.length == 0 || !name_regex.exec(txtFName) ){
	    	validate_ok = false;
	    	error_str += "Name Field must only have " + 
	    				 "alphanumeric characters (A-Z,0-9).\n\n"; 		
	    }
	    if(txtLName.length == 0 || !name_regex.exec(txtLName) )
	    {
	    	validate_ok = false;
	    	error_str += "Last Name Field must only have " + 
	    				 "alphanumeric characters (A-Z,0-9).\n\n"; 	
	    }
	    
	    txtDayPhone = txtDayPhone.replace(/[^0-9]/g, '');
	    if(!IsNumeric(txtDayPhone) || txtDayPhone.length == 0)
	    {
	    	validate_ok = false;
	    	error_str += "Phone Number Must Be a Numeric Value \n\n"; 	
	    }
	    
	    if(txtDayPhone.length < 10)
	    {
	    	validate_ok = false;
	    	error_str += "Please Supply A Valid Phone Number. \n\n";
	    }

	    if(txtEmail.length == 0)
	    {
	    	validate_ok = false;
	    	error_str += "Email Must be filled in \n\n"; 	
	    }
	    if(txtEmail != txtEmailC)
	    {
	    	validate_ok = false;
	    	error_str += "Email confirmation does not match Email Adress \n\n"; 	
	    }

		if(!validate_ok) 
		{
			  window.alert(error_str);
			  
		}
		else 
		{
			//alert("contact Added");	
			document.getElementById('leadForm').submit();
		}
			
		return false;
}
function validateCreateFS() 
{
	function IsNumeric(sText)
	{	
	    var ValidChars = "0123456789.";
	    var IsNumber=true;
	    var Char;
	
	 
	    for (i = 0; i < sText.length && IsNumber == true; i++) 
	    { 
	   		Char = sText.charAt(i); 
	      	if (ValidChars.indexOf(Char) == -1) 
         	{
         		IsNumber = false;
         	}
	   	}
	   	return IsNumber;
	   
	 }

	    //define validation status and form regular expressions
		var validate_ok = true;
		var error_str   = "Error Processing Form: \n\n";
		
		var txtFName = document.getElementById('txtFName').value;
		var txtLName = document.getElementById('txtLName').value;
		// var selCountry = document.getElementById('selCountry').value;
		// var selState = document.getElementById('selState').value;
		var txtDayPhone = document.getElementById('txtDayPhone').value;
		var txtEmail = document.getElementById('txtEmail').value;
		// var txtEmailC = document.getElementById('txtEmailC').value;
	    var name_regex = /^[\w]+[\s\w]*$/;
	       
	    if( txtFName.length == 0 || !name_regex.exec(txtFName) ){
	    	validate_ok = false;
	    	error_str += "First Name Field must only have " + 
	    				 "alphanumeric characters (A-Z,0-9).\n\n"; 		
	    }
	    if(txtLName.length == 0 || !name_regex.exec(txtLName) )
	    {
	    	validate_ok = false;
	    	error_str += "Last Name Field must only have " + 
	    				 "alphanumeric characters (A-Z,0-9).\n\n"; 	
	    }
	    /*
	    if(selCountry == 0)
	    {
	    	validate_ok = false;
	    	error_str += "You Must Select A Country \n\n"; 	
	    }
	    
	    if(selState == 0)
	    {
	    	validate_ok = false;
	    	error_str += "You Must Select A State/Province \n\n";
	    }
	    if(selCountry=="USA" && selState ==0)
	    {
	    	validate_ok = false;
	    	error_str += "You Must Select A State \n\n"; 
	    }
	    else if(selCountry=="CANADA" && selState == 0)
	    {
	    	validate_ok = false;
	    	error_str += "You Must Select A Province \n\n"; 
	    }
	    else if((selCountry=="UK" || selCountry=="Australia") && txtProv == '')
	    {
	    	validate_ok = false;
	    	error_str += "You Must Specify A Province \n\n"; 
	    }
	    */
	    txtDayPhone = txtDayPhone.replace(/[^0-9]/g, '');
	    if(!IsNumeric(txtDayPhone) || txtDayPhone.length == 0)
	    {
	    	validate_ok = false;
	    	error_str += "Phone Number Must Be a Numeric Value \n\n"; 	
	    }
	    
	    if(txtDayPhone.length < 10 || txtDayPhone.length > 20)
	    {
	    	validate_ok = false;
	    	error_str += "Please Supply A Valid Phone Number. \n\n";
	    }

	    /*
	    if(regexPhone.match(/\d*\d{3}\d{3}\d{4})
	    {
	    		//ex: 1 234 567 8901 (without spaces)
	    	if(regexPhone.length == 11)
	    		regexPhone = '(' + regexPhone.substr(1,3) + ') ' + regexPhone.substr(4,6) + " " + regexPhone.substr(7,10);
	    	else //ex: 123 456 7890 (without spaces)
	    		regexPhone = '(' + regexPhone.substr(0,2) + ') ' + regexPhone.substr(3,5) + " " + regexPhone.substr(6,9);
	    }
	    else if(regexPhone.match(/^0[0-9][0-9]{8,9}$/)
	    {
	    	
	    }
	    */
	    if(txtEmail.length == 0)
	    {
	    	validate_ok = false;
	    	error_str += "Email Must be filled in \n\n"; 	
	    }
	    /*
	    if(txtEmail != txtEmailC)
	    {
	    	validate_ok = false;
	    	error_str += "Email confirmation does not match Email Adress \n\n"; 	
	    }
	    */
	
	
		if(!validate_ok) 
		{
			  window.alert(error_str);
			  
		}
		else 
		{
			//alert("contact Added");	
			document.getElementById('leadForm').submit();
		}
			
		return false;
}
