//This version is for 3rd party compatibility only!
//New version is availability-en.js
//Other languages available by changing the 2 character code in the file name.

var countryListID = '';
var regionListID = '';

function makeCountryList(theSiteId,theCountryGroup,siteFilterOnly,countryGroupFilterOnly,siteFilterNot,countryGroupFilterNot,fullList) {
	
document.getElementById(countryListID).options.length = 0;
document.getElementById(countryListID).options[0] = new Option('Choose a country', 'none', false, false);
var countryListArray;
var siteId;
var countryGroup;
var countryName;
var sendValue;
var arrayCounter = 1;
for(var i=0; i<=countryList.length-1; i++)
	{
	countryListArray = countryList[i].split('|');
	siteId = countryListArray[0];
	countryGroup = countryListArray[1];
	countryName = countryListArray[2];
	sendValue = siteId + '|' + countryGroup;
	//Filter results

	if(siteFilterOnly!='' && countryGroupFilterOnly!='' && siteFilterNot=='' && countryGroupFilterNot=='')//Limit to a countryGroup
		{
		if(siteId==siteFilterOnly && countryGroup==countryGroupFilterOnly)
			{
			if(theSiteId==countryListArray[0] && theCountryGroup==countryListArray[1])
				{
				document.getElementById(countryListID).options[arrayCounter]=new Option(countryName,sendValue,false,true);
				}
			else
				{
				document.getElementById(countryListID).options[arrayCounter]=new Option(countryName,sendValue,false,false);
				}
			arrayCounter++;
			}
		}

	if(siteFilterOnly!='' && countryGroupFilterOnly=='' && siteFilterNot=='' && countryGroupFilterNot=='')//Limit to a siteId
		{
		if(siteId==siteFilterOnly)
			{
			if(theSiteId==countryListArray[0] && theCountryGroup==countryListArray[1])
				{
				document.getElementById(countryListID).options[arrayCounter]=new Option(countryName,sendValue,false,true);
				}
			else
				{
				document.getElementById(countryListID).options[arrayCounter]=new Option(countryName,sendValue,false,false);
				}
			arrayCounter++;
			}
		}

	if(siteFilterOnly!='' && countryGroupFilterOnly=='' && siteFilterNot=='' && countryGroupFilterNot!='')//Limit to a siteId excluding a country
		{
		if(siteId==siteFilterOnly && countryGroup!=countryGroupFilterNot)
			{
			if(theSiteId==countryListArray[0] && theCountryGroup==countryListArray[1])
				{
				document.getElementById(countryListID).options[arrayCounter]=new Option(countryName,sendValue,false,true);
				}
			else
				{
				document.getElementById(countryListID).options[arrayCounter]=new Option(countryName,sendValue,false,false);
				}
			arrayCounter++;
			}
		}
		
	if(siteFilterOnly=='' && countryGroupFilterOnly=='' && siteFilterNot!='' && countryGroupFilterNot!='')//Everything except Not
		{
		if(siteId!=siteFilterNot && countryGroup!=countryGroupFilterNot)
			{
			if(theSiteId==countryListArray[0] && theCountryGroup==countryListArray[1])
				{
				document.getElementById(countryListID).options[arrayCounter]=new Option(countryName,sendValue,false,true);
				}
			else
				{
				document.getElementById(countryListID).options[arrayCounter]=new Option(countryName,sendValue,false,false);
				}
			arrayCounter++;
			}
		}

	if(siteFilterOnly=='' && countryGroupFilterOnly=='' && siteFilterNot!='' && countryGroupFilterNot=='')//Everything except Not
		{
		if(siteId!=siteFilterNot)
			{
			if(theSiteId==countryListArray[0] && theCountryGroup==countryListArray[1])
				{
				document.getElementById(countryListID).options[arrayCounter]=new Option(countryName,sendValue,false,true);
				}
			else
				{
				document.getElementById(countryListID).options[arrayCounter]=new Option(countryName,sendValue,false,false);
				}
			arrayCounter++;
			}
		}

	if(siteFilterOnly=='' && countryGroupFilterOnly=='' && siteFilterNot=='' && countryGroupFilterNot=='')
		{
		if(theSiteId==countryListArray[0] && theCountryGroup==countryListArray[1])
			{
			document.getElementById(countryListID).options[arrayCounter]=new Option(countryName,sendValue,false,true);
			}
		else
			{
			document.getElementById(countryListID).options[arrayCounter]=new Option(countryName,sendValue,false,false);
			}
		arrayCounter++;
		}
	
	}

    //To remove All Europe excl. UK from Destinations page country list.
    if(fullList!='Full'){
        document.getElementById(countryListID).remove(1);
    }
}

function makeRegionList(theCountry,searchType)
{
//searchType is "Full" or "Bonus"
document.getElementById(regionListID).disabled = false;
document.getElementById(regionListID).options.length = 0;
document.getElementById(regionListID).options[0]=new Option('Then a region','none',false,false);
var theCountryArray = theCountry.split('|');
var theSite = theCountryArray[0];
var theCountryGroup = theCountryArray[1];
var regionName;
var siteId;
var countryGroup;
var countryId;
var sendValue
var arrayCounter = 0;
for(var i=0; i<=regionList.length-1; i++)
	{	
	/*if(document.getElementById(countryListID))*/
	if (searchType=='Full')
		{
		// handle 'ex Egypt, Israel, Lebanon for Middle East, All
		if(i==0 && document.getElementById(countryListID)[document.getElementById(countryListID).selectedIndex].value == 'ASA|H' )
			{
			document.getElementById(regionListID).options[0]=new Option('All ex. Egypt, Israel, Lebanon','ALL',false,false); //Sending "ALL" instead of "?" on purpose[C.S.]
			arrayCounter++;
			}
		else
			{	
			if(i==0 && document.getElementById(countryListID)[document.getElementById(countryListID).selectedIndex].value != 'none' )
				{
				document.getElementById(regionListID).options[0]=new Option('All','ALL',false,false); //Sending "ALL" instead of "?" on purpose[C.S.]
				arrayCounter++;
				}
			}
		}
	else
		{
		//For bonus week searches.
		if(i==0)
            {
            	/*
            	//Inserted to disable Regions dropdown for LH Bonus searches.[07/10/10 C.S.]
            	if((theSite!='EUR') && (theSite != '')) {
            	document.getElementById(regionListID).disabled = true;
            	}
            	*/
			
			document.getElementById(regionListID).options[0]=new Option('All regions','ALL',false,false); //Sending "ALL" instead of "?" on purpose[C.S.]
			arrayCounter++;
			}		
		}
	regionListArray = regionList[i].split('|');
	siteId = regionListArray[0]
	countryGroup = regionListArray[1];
	countryId = regionListArray[2];	
	if(siteId==theSite && countryGroup==theCountryGroup)
		{
		sendValue = siteId + '|' + countryGroup + '|' + countryId;
		regionName = regionListArray[3];
		if(sendValue==theCountry)
			{
			document.getElementById(regionListID).options[arrayCounter]=new Option(regionName,sendValue,false,true);
			arrayCounter++;		
			}
		else
			{
			document.getElementById(regionListID).options[arrayCounter]=new Option(regionName,sendValue,false,false);
			arrayCounter++;		
			}
		}
	}
}

function selectRegionList(region) {
	for(var i=0;i<document.getElementById('Region').length;i++) {
		if(document.getElementById('Region').options[i].value==region) {
			document.getElementById('Region').selectedIndex = i;
		}
	}
}

//CountryGroup List (used for the countryId parameter)
var i = 0;
var countryList = new Array();
countryList[i] = 'EUR||All Europe excl. UK'; i++;
countryList[i] = 'ASA|P|Asia'; i++;
countryList[i] = 'AUS|A|Australia'; i++;
countryList[i] = 'USA|C|Canada'; i++;
countryList[i] = 'USA|I|Central America & Caribbean'; i++;
countryList[i] = 'EUR|C|Central Europe'; i++;
countryList[i] = 'EUR|S|Eastern Europe'; i++;
countryList[i] = 'EUR|17|France'; i++;
countryList[i] = 'EUR|E|Ireland'; i++;
countryList[i] = 'USA|M|Mexico'; i++;
countryList[i] = 'ASA|H|Middle East'; i++;
countryList[i] = 'AUS|N|New Zealand & Pacific'; i++;
countryList[i] = 'EUR|N|North Africa'; i++;
countryList[i] = 'AUS|F|Pacific Islands'; i++;
countryList[i] = 'EUR|1|Portugal'; i++;
countryList[i] = 'USA|B|South America'; i++;
countryList[i] = 'ZAR|S|South Africa'; i++;
countryList[i] = 'ZAR|D|Southern Africa'; i++;
countryList[i] = 'EUR|2|Spain'; i++;
countryList[i] = 'EUR|G|UK'; i++;
countryList[i] = 'USA|U|USA'; i++;
countryList[i] = 'EUR|W|Western Europe Other'; i++;
i = 0;

var j = 0;
//SiteGroupCodeCountry/Region
var regionList = new Array();
regionList[j] = 'USA|M|3|Acapulco'; j++;
//regionList[j] = 'EUR|S|C118|Albania'; j++;
regionList[j] = 'USA|C|A|Alberta'; j++;
regionList[j] = 'EUR|1|76|Algarve'; j++;
//regionList[j] = 'EUR|N|C128|Algeria'; j++;
regionList[j] = 'EUR|W|C109|Andorra'; j++;
regionList[j] = 'USA|B|2|Argentina'; j++;
regionList[j] = 'USA|I|7|Aruba'; j++;
regionList[j] = 'EUR|C|C8|Austria'; j++;
regionList[j] = 'USA|I|2|Bahamas'; j++;
regionList[j] = 'EUR|2|38|Balearic Islands'; j++;
regionList[j] = 'USA|I|1|Barbados'; j++;
//regionList[j] = 'EUR|S|C101|Belarus '; j++;
regionList[j] = 'EUR|W|C35|Belgium'; j++;
regionList[j] = 'USA|I|B|Belize'; j++;
regionList[j] = 'USA|I|9|Bermuda'; j++;
//regionList[j] = 'EUR|S|C119|Bosnia & Herzegovina'; j++;
regionList[j] = 'USA|B|1|Brazil'; j++;
regionList[j] = 'USA|C|B|British Columbia'; j++;
regionList[j] = 'EUR|S|C81|Bulgaria'; j++;
regionList[j] = 'USA|M|2|Cabo San Lucas'; j++;
regionList[j] = 'USA|U|L|California'; j++;
regionList[j] = 'EUR|2|36|Canary Islands'; j++;
regionList[j] = 'USA|M|4|Cancun'; j++;
regionList[j] = 'EUR|N|C31|Cape Verde'; j++
regionList[j] = 'ZAR|S|0|Cape Town'; j++;
regionList[j] = 'USA|I|8|Cayman Islands'; j++;
regionList[j] = 'USA|B|4|Chile'; j++;
regionList[j] = 'ASA|P|C|China'; j++;
regionList[j] = 'USA|B|5|Colombia'; j++;
regionList[j] = 'AUS|F|Y|Cook Islands'; j++;
regionList[j] = 'EUR|17|75|Corsica'; j++;
regionList[j] = 'USA|I|C|Costa Rica'; j++;
regionList[j] = 'USA|M|6|Cozumel'; j++;
regionList[j] = 'EUR|S|C79|Croatia'; j++;
regionList[j] = 'EUR|S|C10|Cyprus'; j++;
regionList[j] = 'EUR|C|C19|Czech Republic'; j++;
regionList[j] = 'EUR|W|C20|Denmark'; j++;
regionList[j] = 'USA|I|4|Dominican Republic'; j++;
regionList[j] = 'ZAR|S|5|Drakensberg'; j++;
regionList[j] = 'EUR|17|34|East'; j++;
regionList[j] = 'EUR|E|28|Eastern'; j++;
regionList[j] = 'ZAR|S|1|Eastern Cape'; j++;
regionList[j] = 'EUR|N|C48|Egypt'; j++;
regionList[j] = 'EUR|G|C68|England'; j++;
//regionList[j] = 'EUR|S|C120|Estonia '; j++;
regionList[j] = 'AUS|F|F|Fiji'; j++;
regionList[j] = 'EUR|S|C75|Finland'; j++;
regionList[j] = 'USA|U|50|Florida'; j++; //EUR DB
regionList[j] = 'USA|U|F|Florida Other'; j++;
regionList[j] = 'EUR|N|C23|Gambia'; j++;
regionList[j] = 'ZAR|S|8|Garden Route'; j++;
regionList[j] = 'ZAR|S|B|Gauteng'; j++;
regionList[j] = 'EUR|C|C7|Germany'; j++;
//regionList[j] = 'EUR|W|C108|Gibraltar'; j++;
regionList[j] = 'EUR|S|C3|Greece'; j++;
regionList[j] = 'USA|I|G|Guatemala'; j++;
regionList[j] = 'USA|U|H|Hawaiian Islands'; j++;
regionList[j] = 'USA|I|H|Honduras'; j++;
//regionList[j] = 'ASA|P|F|Hong Kong'; j++;
regionList[j] = 'EUR|S|C52|Hungary'; j++;
//regionList[j] = 'EUR|W|C111|Iceland'; j++;
regionList[j] = 'ASA|P|G|India'; j++;
regionList[j] = 'ASA|P|B|Indonesia'; j++;
regionList[j] = 'EUR|S|C24|Israel'; j++;
regionList[j] = 'EUR|C|C6|Italy'; j++;
regionList[j] = 'USA|M|7|Ixtapa'; j++;
regionList[j] = 'USA|I|0|Jamaica'; j++;
//regionList[j] = 'ASA|P|J|Japan'; j++;
regionList[j] = 'ZAR|D|2|Kenya'; j++;
regionList[j] = 'ZAR|S|7|Kwazulu Natal Durban'; j++;
regionList[j] = 'ZAR|S|C|Kwazulu Natal Far North Coast'; j++;
regionList[j] = 'ZAR|S|A|Kwazulu Natal North'; j++;
regionList[j] = 'ZAR|S|4|Kwazulu Natal South'; j++;
regionList[j] = 'USA|M|X|La Paz'; j++;
//regionList[j] = 'EUR|S|C115|Latvia '; j++;
regionList[j] = 'EUR|S|C99|Lebanon'; j++;
//regionList[j] = 'EUR|N|C148|Libya'; j++;
//regionList[j] = 'EUR|C|C90|Liechtenstein'; j++;
regionList[j] = 'ZAR|S|6|Limpopo Province'; j++;
//regionList[j] = 'EUR|S|C142|Lithuania'; j++;
//regionList[j] = 'EUR|W|C94|Luxembourg'; j++;
//regionList[j] = 'EUR|S|C117|Macedonia'; j++;
regionList[j] = 'EUR|1|77|Madeira'; j++;
regionList[j] = 'EUR|2|37|Mainland'; j++;
regionList[j] = 'ASA|P|M|Malaysia'; j++;
regionList[j] = 'EUR|C|C9|Malta'; j++;
regionList[j] = 'USA|C|M|Manitoba'; j++;
regionList[j] = 'USA|M|8|Mazanillo'; j++;
regionList[j] = 'USA|M|5|Mazatlan'; j++;
regionList[j] = 'USA|U|M|Mid West'; j++;
//regionList[j] = 'EUR|S|C143|Moldova'; j++;
//regionList[j] = 'EUR|W|C110|Monaco'; j++;
regionList[j] = 'EUR|N|C76|Morocco'; j++;
regionList[j] = 'ZAR|D|5|Mozambique'; j++;
regionList[j] = 'ZAR|S|9|Mpumalanga'; j++;
regionList[j] = 'ZAR|D|6|Namibia'; j++;
//regionList[j] = 'ASA|P|N|Nepal'; j++;
regionList[j] = 'USA|U|A|Nevada'; j++;
regionList[j] = 'AUS|A|N|New South Wales'; j++;
regionList[j] = 'EUR|17|33|North East'; j++;
regionList[j] = 'USA|U|N|North East'; j++;
regionList[j] = 'AUS|N|N|North Island'; j++;
regionList[j] = 'EUR|17|31|North West'; j++;
regionList[j] = 'ZAR|S|D|North West Province'; j++;
regionList[j] = 'EUR|E|C89|Northern'; j++;
regionList[j] = 'ZAR|S|3|Northern Cape'; j++;
regionList[j] = 'AUS|A|P|Northern Territory'; j++;
regionList[j] = 'EUR|W|C54|Norway'; j++;
regionList[j] = 'USA|C|O|Ontario'; j++;
regionList[j] = 'USA|C|X|Other Canada'; j++;
regionList[j] = 'USA|I|D|Other Caribbean'; j++;
regionList[j] = 'EUR|1|14|Other Portugal'; j++;
regionList[j] = 'USA|U|P|Pacific Coast'; j++;
//regionList[j] = 'ASA|P|D|Pakistan'; j++;
regionList[j] = 'ASA|P|P|Philippines'; j++;
regionList[j] = 'EUR|S|C60|Poland'; j++;
regionList[j] = 'USA|M|B|Puerto Penasco'; j++;
regionList[j] = 'USA|I|P|Puerto Rico'; j++;
regionList[j] = 'USA|M|1|Puerto Vallarta'; j++;
regionList[j] = 'USA|C|Q|Quebec'; j++;
regionList[j] = 'AUS|A|Q|Queensland'; j++;
regionList[j] = 'USA|U|R|Rocky Mountains'; j++;
regionList[j] = 'EUR|S|C53|Romania'; j++;
regionList[j] = 'USA|M|9|Rosarito Beach'; j++;
regionList[j] = 'EUR|S|C93|Russian Federation'; j++;
regionList[j] = 'AUS|F|U|Samoa'; j++;
regionList[j] = 'USA|M|0|San Carlos'; j++;
//regionList[j] = 'EUR|C|C112|San Marino'; j++;
regionList[j] = 'EUR|G|C69|Scotland'; j++;
regionList[j] = 'EUR|S|C122|Serbia & Montenegro'; j++;
//regionList[j] = 'ASA|P|S|Singapore'; j++;
regionList[j] = 'EUR|S|C114|Slovakia'; j++;
//regionList[j] = 'EUR|C|C95|Slovenia'; j++;
regionList[j] = 'EUR|17|35|South'; j++;
regionList[j] = 'AUS|A|S|South Australia'; j++;
regionList[j] = 'USA|U|S|South East'; j++;
regionList[j] = 'AUS|N|S|South Island'; j++;
//regionList[j] = 'ASA|P|E|South Korea'; j++;
regionList[j] = 'USA|U|W|South West'; j++;
regionList[j] = 'EUR|E|30|South West'; j++;
regionList[j] = 'EUR|17|32|South West'; j++;
regionList[j] = 'ZAR|D|8|Southern Africa Other'; j++;
//regionList[j] = 'ASA|P|H|Sri Lanka'; j++;
regionList[j] = 'USA|I|N|St. Maarten (Dutch)'; j++;
regionList[j] = 'USA|I|S|St. Martin (French)'; j++;
regionList[j] = 'USA|B|6|Suriname'; j++;
regionList[j] = 'ZAR|D|4|Swaziland'; j++;
regionList[j] = 'EUR|W|C62|Sweden'; j++;
regionList[j] = 'EUR|C|C16|Switzerland'; j++;
regionList[j] = 'AUS|F|T|Tahiti'; j++;
//regionList[j] = 'ASA|P|K|Taiwan'; j++;
regionList[j] = 'AUS|A|T|Tasmania'; j++;
regionList[j] = 'ASA|P|T|Thailand'; j++;
regionList[j] = 'EUR|W|C56|The Netherlands'; j++;
regionList[j] = 'USA|M|A|Tijuana'; j++;
regionList[j] = 'EUR|N|C86|Tunisia'; j++;
regionList[j] = 'EUR|S|C64|Turkey'; j++;
//regionList[j] = 'EUR|S|C116|Ukraine'; j++;
regionList[j] = 'USA|I|3|Us Virgin Islands'; j++;
regionList[j] = 'USA|B|3|Venezuela'; j++;
regionList[j] = 'AUS|A|V|Victoria'; j++;
regionList[j] = 'EUR|G|C70|Wales'; j++;
regionList[j] = 'EUR|E|29|West'; j++;
regionList[j] = 'AUS|A|W|Western Australia'; j++;
regionList[j] = 'ZAR|S|2|Western Cape'; j++;
regionList[j] = 'ZAR|D|1|Zimbabwe'; j++;
j = 0;
