var domain = 'www.hoteldirect.co.uk';
//var domain = '';

var availableCities = ["Amsterdam", "Aberdeen", "Abu Dhabi", "Algarve","Andover","Ashford", "Athens", "Athlone", "Aviemore",
	"Barcelona", "Bayswater, London", "Bloomsbury, London", "Ballsbridge, Dublin", "Bali", "Bangkok", "Basingstoke", "Bath", "Bedford","Bedfordshire","Belfast", "Beijing", "Berlin", "Bilbao", "Birmingham", "Blackpool", "Boston", "Bournemouth", "Bracknell", "Bradford", "Braintree","Brighton", "Bristol", "Brussels", "Budapest","Bude",
	"Covent Garden, London", "Camden, London","Chelsea, London", "Champs Elysees, Paris", "Colosseum, Rome", "Cairns", "Cairo", "Cambridge", "Canterbury", "Cardiff", "Carlisle","Casablanca", "Chatham","Chelmsford","Cheltenham","Cheshire","Chester", "Chicago", "Copenhagen", "Cork", "Cornwall","Coventry", "Charles de Gaulle", "Crawley",
	"Dublin","Derby", "Derry", "Devon","Disneyland", "Doncaster","Dorset","Douglas","Dover","Dubai", "Dubrovnik","Dundee","Durham",
	"Edinburgh", "Euston, London", "Eiffel Tower, Paris", "Eastbourne", "Ennis", "Essex","Exeter",
	"Falmouth","Florence", "Fuerteventura",
	"Glasgow", "Grafton Street, Dublin", "Greenwich, London", "Galway", "Gatwick", "Glastonbury","Gloucester","Goa",
	"Hyde Park, London", "Hampstead, London", "Hammersmith, London", "Harrods, London", "Halifax","Hampshire","Hastings","Hong Kong", "Heathrow","Hull",
	"Ibiza", "Inverness", "Ipswich","Ireland", "Istanbul",
	"Jerusalem",
	"Kensington, London", "Kings Cross, London", "Knightsbridge, London", "Kent","Kilkenny", "Killarney", "Krakow", "Kuala Lumpur", "Kingston",
	"London", "Las Ramblas, Barcelona", "Leicester Square, London", "Louvre, Paris", "Leeds", "Liverpool", "Lancaster","Lanzarote", "Las Vegas", "Leicester","Limerick", "Lincoln","Lisbon", "Los Angeles", "Ludlow","Luton", "Luxor","Lyme",
	"Marble Arch, London", "Mayfair, London", "Madrid", "Montparnasse, Paris", "Maidstone","Majorca", "Malaga", "Malvern","Manchester", "Marrakech", "Melbourne", "Menorca", "Miami ", "Milan", "Moscow", "Mumbai", "Munich", "Manhattan","Marlborough",
	"New Orleans", "New York", "Newcastle", "Newport","Nice", "Norfolk","Northampton","Norwich","Nottingham",
	"O'Connell Street, Dublin", "O Connell Street, Dublin", "Orlando", "Oxford",
	"Paris", "Paddington, London", "Piccadilly, London", "Princes Street, Edinburgh", "Pantheon, Rome", "Peterborough","Petersham","Phuket", "Pitlochry", "Plymouth","Portsmouth","Prague","Preston",
	"Rome", "Ramblas, Barcelona", "Royal Mile, Edinburgh", "Reading", "Reyjavik",
	"St Stephens Green, Dublin", "Salzburg", "San Diego", "San Francisco", "Scarborough","Sheffield", "Shrewsbury","Sicily", "Singapore", "Sligo", "Somerset","Southampton","St Helier", "St Petersburg", "Stockholm", "Stradford","Stratford-upon-Avon", "Suffolk","Surrey","Swansea","Sydney", "Sitges", "Stansted",
	"Temple Bar, Dublin", "Trafalgar Square, London", "Termini, Rome", "Trinity College, Dublin", "Taunton","Tel Aviv", "Tenerife", "Tokyo", "Toronto", "Toulouse", "Tralee", "Tuscany",
	"Victoria, London", "Via Veneto, Rome", "Valencia", "Vancouver", "Venice", "Vienna", "Vatican",	"West End , London", "Westminster, London", "Wakefield","Warsaw", "Warwick","Washington DC", "Waterford", "Westport", "Weymouth","Wexford", "Wilton","Windermere", "Wimbledon", "Windsor",
	"York"];

var checkCities = ["aberdeen", "amsterdam", "athlone", "aviemore",
	"barcelona", "basingstoke", "bath", "belfast", "birmingham", "blackpool", "bournemouth", "bracknell", "bradford", "brighton", "bristol",
	"cambridge", "canterbury", "cardiff", "chester","cork", "coventry",
	"derby", "derry", "dubai", "dublin",
	"eastbourne", "edinburgh", "ennis", "exeter",
	"galway", "gatwick", "glasgow",
	"inverness", "ireland",
	"kilkenny", "killarney",
	"lanzarote", "leeds", "limerick", "liverpool", "london", "luton",
	"madrid", "majorca", "manchester", "menorca",
	"newcastle", "nottingham",
	"oxford",
	"paris", "pitlochry", "prague",
	"reading", "rome",
	"sheffield", "sligo", "st helier", "stratford-upon-avon",
	"toulouse", "tralee",
	"waterford", "westport", "wexford", "windermere",
	"york"];

var ukCities = ["Malvern","Andover","Colchester","Glastonbury","Norwich","Dover","Falmouth","Chelmsford","Braintree","Douglas","Peterborough","Preston","Doncaster","Hastings","Ludlow","Warwick","Stafford","Marlborough","Petersham","Rochester","Taunton","Wakefield","Weymouth","Bude","Bedford","Shrewsbury","Chatham","Lyme","Wilton","Scarborough","Hampshire","Kent","Lincoln","Norfolk","Essex","Durham","Northampton","Suffolk","Surrey","Newport","Swansea","Winchester","Maidstone","Ipswich","Ashford","Carlisle","Gloucester","Southampton","Plymouth","Portsmouth","Stratford","Dundee","Leicester","Cheltenham","Hull","Cornwall","Devon","Somerset","Dorset","Lancaster","Bedfordshire","Cheshire","Halifax","Jersey","Southport","Chester"];	

var cityLocations = [];
cityLocations[0] = new Object();
cityLocations[0].location = 'Charles de Gaulle';
cityLocations[0].location_alt = '';
cityLocations[0].city = 'Paris';
cityLocations[0].page = 'Charles-de-Gaulle-hotels';
cityLocations[1] = new Object();
cityLocations[1].location = 'Crawley';
cityLocations[1].location_alt = '';
cityLocations[1].city = 'Gatwick';
cityLocations[1].page = 'Crawley-hotels';
cityLocations[2] = new Object();
cityLocations[2].location = 'Heathrow';
cityLocations[2].location_alt = '';
cityLocations[2].city = 'London';
cityLocations[2].page = 'Heathrow-hotels';
cityLocations[3] = new Object();
cityLocations[3].location = 'Hounslow';
cityLocations[3].location_alt = '';
cityLocations[3].city = 'London';
cityLocations[3].page = 'Hounslow-hotels';
cityLocations[4] = new Object();
cityLocations[4].location = 'Kingston';
cityLocations[4].location_alt = '';
cityLocations[4].city = 'London';
cityLocations[4].page = 'Kingston-hotels';
cityLocations[5] = new Object();
cityLocations[5].location = 'Docklands';
cityLocations[5].location_alt = '';
cityLocations[5].city = 'London';
cityLocations[5].page = 'Docklands-hotels';
cityLocations[6] = new Object();
cityLocations[6].location = 'Sitges';
cityLocations[6].location_alt = '';
cityLocations[6].city = 'Barcelona';
cityLocations[6].page = 'Sitges-hotels';
cityLocations[7] = new Object();
cityLocations[7].location = 'Stansted';
cityLocations[7].location_alt = '';
cityLocations[7].city = 'London';
cityLocations[7].page = 'Stansted-hotels';
cityLocations[8] = new Object();
cityLocations[8].location = 'Vatican';
cityLocations[8].location_alt = '';
cityLocations[8].city = 'Rome';
cityLocations[8].page = 'Vatican-hotels';
cityLocations[9] = new Object();
cityLocations[9].location = 'Wimbledon';
cityLocations[9].location_alt = '';
cityLocations[9].city = 'London';
cityLocations[9].page = 'Wimbledon-hotels';
cityLocations[10] = new Object();
cityLocations[10].location = 'Windsor';
cityLocations[10].location_alt = '';
cityLocations[10].city = 'London';
cityLocations[10].page = 'Windsor-hotels';
cityLocations[11] = new Object();
cityLocations[11].location = 'Disneyland';
cityLocations[11].location_alt = 'Near Disneyland';
cityLocations[11].city = 'Paris';
cityLocations[11].page = 'Near-Disneyland-hotels';
cityLocations[12] = new Object();
cityLocations[12].location = 'Covent Garden';
cityLocations[12].location_alt = '';
cityLocations[12].attraction = '1';
cityLocations[12].city = 'London';
cityLocations[12].page = 'hotels-near-covent-garden';
cityLocations[13] = new Object();
cityLocations[13].location = 'Hyde Park';
cityLocations[13].location_alt = '';
cityLocations[13].attraction = '214';
cityLocations[13].city = 'London';
cityLocations[13].page = 'hotels-near-hyde-park';
cityLocations[14] = new Object();
cityLocations[14].location = 'Victoria';
cityLocations[14].location_alt = 'London Victoria';
cityLocations[14].attraction = '208';
cityLocations[14].city = 'London';
cityLocations[14].page = 'hotels-near-london-victoria';
cityLocations[15] = new Object();
cityLocations[15].location = 'Kensington';
cityLocations[15].location_alt = '';
cityLocations[15].attraction = '32';
cityLocations[15].city = 'London';
cityLocations[15].page = 'hotels-near-kensington';
cityLocations[16] = new Object();
cityLocations[16].location = 'Mayfair';
cityLocations[16].location_alt = '';
cityLocations[16].attraction = '212';
cityLocations[16].city = 'London';
cityLocations[16].page = 'hotels-near-mayfair';
cityLocations[17] = new Object();
cityLocations[17].location = 'Euston';
cityLocations[17].location_alt = 'Euston';
cityLocations[17].attraction = '4';
cityLocations[17].city = 'London';
cityLocations[17].page = 'hotels-near-euston';
cityLocations[18] = new Object();
cityLocations[18].location = 'West End';
cityLocations[18].location_alt = '';
cityLocations[18].city = 'London';
cityLocations[18].page = 'west-end-hotels';
cityLocations[19] = new Object();
cityLocations[19].location = 'Kings Cross';
cityLocations[19].location_alt = '';
cityLocations[19].attraction = '5';
cityLocations[19].city = 'London';
cityLocations[19].page = 'hotels-near-kings-cross';
cityLocations[20] = new Object();
cityLocations[20].location = 'Bloomsbury';
cityLocations[20].location_alt = '';
cityLocations[20].attraction = '210';
cityLocations[20].city = 'London';
cityLocations[20].page = 'hotels-near-bloomsbury';
cityLocations[21] = new Object();
cityLocations[21].location = 'Hammersmith';
cityLocations[21].location_alt = '';
cityLocations[21].attraction = '215';
cityLocations[21].city = 'London';
cityLocations[21].page = 'hotels-near-hammersmith';
cityLocations[22] = new Object();
cityLocations[22].location = 'Paddington';
cityLocations[22].location_alt = '';
cityLocations[22].attraction = '6';
cityLocations[22].city = 'London';
cityLocations[22].page = 'hotels-near-paddington';
cityLocations[23] = new Object();
cityLocations[23].location = 'Bayswater';
cityLocations[23].location_alt = '';
cityLocations[23].city = 'London';
cityLocations[23].page = 'bayswater-hotels';
cityLocations[24] = new Object();
cityLocations[24].location = 'Marble Arch';
cityLocations[24].location_alt = '';
cityLocations[24].attraction = '11';
cityLocations[24].city = 'London';
cityLocations[24].page = 'hotels-near-marble-arch';
cityLocations[25] = new Object();
cityLocations[25].location = 'Knightsbridge';
cityLocations[25].location_alt = '';
cityLocations[25].attraction = '194';
cityLocations[25].city = 'London';
cityLocations[25].page = 'hotels-near-knightsbridge';
cityLocations[26] = new Object();
cityLocations[26].location = 'Harrods';
cityLocations[26].location_alt = '';
cityLocations[26].attraction = '55';
cityLocations[26].city = 'London';
cityLocations[26].page = 'hotels-near-harrods';
cityLocations[27] = new Object();
cityLocations[27].location = 'Piccadilly';
cityLocations[27].location_alt = '';
cityLocations[27].attraction = '192';
cityLocations[27].city = 'London';
cityLocations[27].page = 'hotels-near-piccadilly';
cityLocations[28] = new Object();
cityLocations[28].location = 'Trafalgar Square';
cityLocations[28].location_alt = '';
cityLocations[28].attraction = '28';
cityLocations[28].city = 'London';
cityLocations[28].page = 'hotels-near-trafalgar-square';
cityLocations[29] = new Object();
cityLocations[29].location = 'Leicester Square';
cityLocations[29].location_alt = '';
cityLocations[29].attraction = '29';
cityLocations[29].city = 'London';
cityLocations[29].page = 'hotels-near-leicester-square';
cityLocations[30] = new Object();
cityLocations[30].location = 'Las Ramblas';
cityLocations[30].location_alt = '';
cityLocations[30].attraction = '50';
cityLocations[30].city = 'Barcelona';
cityLocations[30].page = 'hotels-near-las-ramblas';
cityLocations[31] = new Object();
cityLocations[31].location = 'Ramblas';
cityLocations[31].location_alt = 'Las Ramblas';
cityLocations[31].attraction = '50';
cityLocations[31].city = 'Barcelona';
cityLocations[31].page = 'hotels-near-las-ramblas';
cityLocations[32] = new Object();
cityLocations[32].location = 'Temple Bar';
cityLocations[32].location_alt = '';
cityLocations[32].attraction = '39';
cityLocations[32].city = 'Dublin';
cityLocations[32].page = 'hotels-near-temple-bar';
cityLocations[33] = new Object();
cityLocations[33].location = 'O Connell Street';
cityLocations[33].location_alt = 'O`Connell Street';
cityLocations[33].attraction = '43';
cityLocations[33].city = 'Dublin';
cityLocations[33].page = 'hotels-near-o`connell-street';
cityLocations[34] = new Object();
cityLocations[34].location = 'Grafton Street';
cityLocations[34].location_alt = '';
cityLocations[34].attraction = '42';
cityLocations[34].city = 'Dublin';
cityLocations[34].page = 'hotels-near-grafton-street';
cityLocations[35] = new Object();
cityLocations[35].location = 'St Stephens Green';
cityLocations[35].location_alt = '';
cityLocations[35].attraction = '195';
cityLocations[35].city = 'Dublin';
cityLocations[35].page = 'hotels-near-st-stephen%60s-green';
cityLocations[36] = new Object();
cityLocations[36].location = 'Ballsbridge';
cityLocations[36].location_alt = '';
cityLocations[36].city = 'Dublin';
cityLocations[36].page = 'ballsbridge-hotels';
cityLocations[37] = new Object();
cityLocations[37].location = 'Trinity College';
cityLocations[37].location_alt = '';
cityLocations[37].attraction = '40';
cityLocations[37].city = 'Dublin';
cityLocations[37].page = 'hotels-near-trinity-college';
cityLocations[38] = new Object();
cityLocations[38].location = 'Champs Elysees';
cityLocations[38].location_alt = 'Champs-Elysees';
cityLocations[38].attraction = '203';
cityLocations[38].city = 'Paris';
cityLocations[38].page = 'hotels-near-champs-elysees';
cityLocations[39] = new Object();
cityLocations[39].location = 'Eiffel Tower';
cityLocations[39].location_alt = '';
cityLocations[39].attraction = '13';
cityLocations[39].city = 'Paris';
cityLocations[39].page = 'hotels-near-eiffel-tower';
cityLocations[40] = new Object();
cityLocations[40].location = 'Louvre';
cityLocations[40].location_alt = 'The Louvre';
cityLocations[40].attraction = '12';
cityLocations[40].city = 'Paris';
cityLocations[40].page = 'hotels-near-the-louvre';
cityLocations[41] = new Object();
cityLocations[41].location = 'Montparnasse';
cityLocations[41].location_alt = '';
cityLocations[41].city = 'Paris';
cityLocations[41].page = 'montparnasse-hotels';
cityLocations[42] = new Object();
cityLocations[42].location = 'Princes Street';
cityLocations[42].location_alt = '';
cityLocations[42].attraction = '207';
cityLocations[42].city = 'Edinburgh';
cityLocations[42].page = 'hotels-near-princes-street';
cityLocations[43] = new Object();
cityLocations[43].location = 'Royal Mile';
cityLocations[43].location_alt = '';
cityLocations[43].attraction = '206';
cityLocations[43].city = 'Edinburgh';
cityLocations[43].page = 'hotels-near-royal-mile';
cityLocations[44] = new Object();
cityLocations[44].location = 'Pantheon';
cityLocations[44].location_alt = '';
cityLocations[44].attraction = '77';
cityLocations[44].city = 'Rome';
cityLocations[44].page = 'hotels-near-pantheon';
cityLocations[45] = new Object();
cityLocations[45].location = 'Termini';
cityLocations[45].location_alt = '';
cityLocations[45].attraction = '87';
cityLocations[45].city = 'Rome';
cityLocations[45].page = 'hotels-near-termini';
cityLocations[46] = new Object();
cityLocations[46].location = 'Colosseum';
cityLocations[46].location_alt = '';
cityLocations[46].attraction = '76';
cityLocations[46].city = 'Rome';
cityLocations[46].page = 'hotels-near-colosseum';
cityLocations[47] = new Object();
cityLocations[47].location = 'Via Veneto';
cityLocations[47].location_alt = '';
cityLocations[47].attraction = '232';
cityLocations[47].city = 'Rome';
cityLocations[47].page = 'hotels-near-via-veneto';
cityLocations[48] = new Object();
cityLocations[48].location = "O'Connell Street";
cityLocations[48].location_alt = 'O`Connell Street';
cityLocations[48].attraction = '43';
cityLocations[48].city = 'Dublin';
cityLocations[48].page = 'hotels-near-o`connell-street';
cityLocations[49] = new Object();
cityLocations[49].location = 'Chelsea';
cityLocations[49].location_alt = '';
cityLocations[49].attraction = '213';
cityLocations[49].city = 'London';
cityLocations[49].page = 'hotels-near-chelsea';
cityLocations[50] = new Object();
cityLocations[50].location = 'Camden';
cityLocations[50].location_alt = 'North London';
cityLocations[50].city = 'London';
cityLocations[50].page = 'north-london-hotels';
cityLocations[51] = new Object();
cityLocations[51].location = 'Hampstead';
cityLocations[51].location_alt = 'North London';
cityLocations[51].city = 'London';
cityLocations[51].page = 'north-london-hotels';
cityLocations[52] = new Object();
cityLocations[52].location = 'Greenwich';
cityLocations[52].location_alt = 'City of London';
cityLocations[52].city = 'London';
cityLocations[52].page = 'city-of-london-hotels';
cityLocations[53] = new Object();
cityLocations[53].location = 'Westminster';
cityLocations[53].location_alt = '';
cityLocations[53].city = 'London';
cityLocations[53].page = 'westminster-hotels';
cityLocations[54] = new Object();
cityLocations[54].location = 'Theatreland';
cityLocations[54].location_alt = '';
cityLocations[54].city = 'London';
cityLocations[54].page = 'Theatreland-hotels';
cityLocations[55] = new Object();
cityLocations[55].location = 'Holborn';
cityLocations[55].location_alt = '';
cityLocations[55].city = 'London';
cityLocations[55].page = 'Holborn-hotels';
cityLocations[56] = new Object();
cityLocations[56].location = 'The Strand';
cityLocations[56].location_alt = '';
cityLocations[56].attraction = '199';
cityLocations[56].city = 'London';
cityLocations[56].page = 'hotels-near-The-Strand';
cityLocations[57] = new Object();
cityLocations[57].location = 'Strand';
cityLocations[57].location_alt = 'The Strand';
cityLocations[57].attraction = '199';
cityLocations[57].city = 'London';
cityLocations[57].page = 'hotels-near-The-Strand';
cityLocations[58] = new Object();
cityLocations[58].location = "British Museum";
cityLocations[58].location_alt = 'British Museum';
cityLocations[58].attraction = '33';
cityLocations[58].city = 'London';
cityLocations[58].page = 'hotels-near-british-museum';
cityLocations[59] = new Object();
cityLocations[59].location = "Science Museum";
cityLocations[59].location_alt = 'Science Museum';
cityLocations[59].attraction = '35';
cityLocations[59].city = 'London';
cityLocations[59].page = 'hotels-near-science-museum';
cityLocations[60] = new Object();
cityLocations[60].location = "Pancras";
cityLocations[60].location_alt = 'St Pancras - Eurostar';
cityLocations[60].attraction = '218';
cityLocations[60].city = 'London';
cityLocations[60].page = 'hotels-near-St-Pancras---Eurostar';
cityLocations[61] = new Object();
cityLocations[61].location = "Natural History Museum";
cityLocations[61].location_alt = '';
cityLocations[61].attraction = '32';
cityLocations[61].city = 'London';
cityLocations[61].page = 'hotels-near-Natural-History-Museum';
cityLocations[62] = new Object();
cityLocations[62].location = "Pauls";
cityLocations[62].location_alt = 'St Paul`s Cathedral';
cityLocations[62].attraction = '31';
cityLocations[62].city = 'London';
cityLocations[62].page = 'hotels-near-St-Paul`s-Cathedral';
cityLocations[63] = new Object();
cityLocations[63].location = "Buckingham Palace";
cityLocations[63].location_alt = '';
cityLocations[63].attraction = '25';
cityLocations[63].city = 'London';
cityLocations[63].page = 'hotels-near-Buckingham-Palace';
cityLocations[64] = new Object();
cityLocations[64].location = "Royal Albert Hall";
cityLocations[64].location_alt = '';
cityLocations[64].attraction = '196';
cityLocations[64].city = 'London';
cityLocations[64].page = 'hotels-near-Royal-Albert-Hall';
cityLocations[65] = new Object();
cityLocations[65].location = "Arc de Triomphe";
cityLocations[65].location_alt = '';
cityLocations[65].attraction = '7';
cityLocations[65].city = 'Paris';
cityLocations[65].page = 'hotels-near-Arc-de-Triomphe';
cityLocations[66] = new Object();
cityLocations[66].location = "Sacre Coeur";
cityLocations[66].location_alt = 'Sacre-Coeur';
cityLocations[66].attraction = '16';
cityLocations[66].city = 'Paris';
cityLocations[66].page = 'hotels-near-Sacre-Coeur';
cityLocations[67] = new Object();
cityLocations[67].location = "Latin Quarter";
cityLocations[67].location_alt = '';
cityLocations[67].city = 'Paris';
cityLocations[67].page = 'Latin-Quarter-hotels';
cityLocations[68] = new Object();
cityLocations[68].location = "Montmartre";
cityLocations[68].location_alt = 'Montmartre-Sacre-Cr';
cityLocations[68].city = 'Paris';
cityLocations[68].page = 'Montmartre-Sacre Cr-hotels';
cityLocations[69] = new Object();
cityLocations[69].location = "Gothic Quarter";
cityLocations[69].location_alt = '';
cityLocations[69].city = 'Barcelona';
cityLocations[69].page = 'Gothic-Quarter-hotels';
cityLocations[70] = new Object();
cityLocations[70].location = "Notre Dame";
cityLocations[70].location_alt = 'Notre-Dame';
cityLocations[70].attraction = '17';
cityLocations[70].city = 'Paris';
cityLocations[70].page = 'hotels-near-Notre-Dame';
cityLocations[71] = new Object();
cityLocations[71].location = "Green Park";
cityLocations[71].location_alt = '';
cityLocations[71].attraction = '197';
cityLocations[71].city = 'London';
cityLocations[71].page = 'hotels-near-green-park';
cityLocations[72] = new Object();
cityLocations[72].location = "Oxford Street";
cityLocations[72].location_alt = '';
cityLocations[72].attraction = '193';
cityLocations[72].city = 'London';
cityLocations[72].page = 'hotels-near-oxford-street';
cityLocations[73] = new Object();
cityLocations[73].location = "City of London";
cityLocations[73].location_alt = '';
cityLocations[73].city = 'London';
cityLocations[73].page = 'City-of-London-hotels';
cityLocations[74] = new Object();
cityLocations[74].location = "London Eye";
cityLocations[74].location_alt = '';
cityLocations[74].attraction = '8';
cityLocations[74].city = 'London';
cityLocations[74].page = 'hotels-near-london-eye';
cityLocations[75] = new Object();
cityLocations[75].location = "London City Centre";
cityLocations[75].location_alt = '';
cityLocations[75].attraction = '200';
cityLocations[75].city = 'London';
cityLocations[75].page = 'hotels-near-london-city-centre';
cityLocations[76] = new Object();
cityLocations[76].location = "Dublin City Centre";
cityLocations[76].location_alt = '';
cityLocations[76].attraction = '201';
cityLocations[76].city = 'Dublin';
cityLocations[76].page = 'hotels-near-dublin-city-centre';
cityLocations[77] = new Object();
cityLocations[77].location = "Edinburgh City Centre";
cityLocations[77].location_alt = '';
cityLocations[77].attraction = '205';
cityLocations[77].city = 'Edinburgh';
cityLocations[77].page = 'hotels-near-edinburgh-city-centre';
cityLocations[78] = new Object();
cityLocations[78].location = "Paris City Centre";
cityLocations[78].location_alt = '';
cityLocations[78].attraction = '202';
cityLocations[78].city = 'Paris';
cityLocations[78].page = 'hotels-near-paris-city-centre';
cityLocations[79] = new Object();
cityLocations[79].location = "Barcelona City Centre";
cityLocations[79].location_alt = '';
cityLocations[79].attraction = '204';
cityLocations[79].city = 'Barcelona';
cityLocations[79].page = 'hotels-near-barcelona-city-centre';
cityLocations[80] = new Object();
cityLocations[80].location = "Rome City Centre";
cityLocations[80].location_alt = '';
cityLocations[80].attraction = '279';
cityLocations[80].city = 'Rome';
cityLocations[80].page = 'hotels-near-rome-city-centre';
cityLocations[81] = new Object();
cityLocations[81].location = "Leeds City Centre";
cityLocations[81].location_alt = '';
cityLocations[81].attraction = '453';
cityLocations[81].city = 'Leeds';
cityLocations[81].page = 'hotels-near-leeds-city-centre';
cityLocations[82] = new Object();
cityLocations[82].location = "Belfast City Centre";
cityLocations[82].location_alt = '';
cityLocations[82].attraction = '458';
cityLocations[82].city = 'Belfast';
cityLocations[82].page = 'hotels-near-belfast-city-centre';
cityLocations[83] = new Object();
cityLocations[83].location = "Central London";
cityLocations[83].location_alt = '';
cityLocations[83].city = 'London';
cityLocations[83].page = 'Central-London-hotels';
cityLocations[84] = new Object();
cityLocations[84].location = "Central Dublin";
cityLocations[84].location_alt = 'Dublin City Centre';
cityLocations[84].city = 'Dublin';
cityLocations[84].page = 'Dublin-City-Centre-hotels';
cityLocations[85] = new Object();
cityLocations[85].location = "Central Edinburgh";
cityLocations[85].location_alt = '';
cityLocations[85].city = 'Edinburgh';
cityLocations[85].page = 'Central-Edinburgh-hotels';
cityLocations[86] = new Object();
cityLocations[86].location = "Central Paris";
cityLocations[86].location_alt = '';
cityLocations[86].city = 'Paris';
cityLocations[86].page = 'Central-Paris-hotels';
cityLocations[87] = new Object();
cityLocations[87].location = "Central Barcelona";
cityLocations[87].location_alt = '';
cityLocations[87].city = 'Barcelona';
cityLocations[87].page = 'Central-Barcelona-hotels';
cityLocations[88] = new Object();
cityLocations[88].location = "Central Rome";
cityLocations[88].location_alt = '';
cityLocations[88].city = 'Rome';
cityLocations[88].page = 'Central-Rome-hotels';
cityLocations[89] = new Object();
cityLocations[89].location = "Central Leeds";
cityLocations[89].location_alt = '';
cityLocations[89].city = 'Leeds';
cityLocations[89].page = 'Central-Leeds-hotels';
cityLocations[90] = new Object();
cityLocations[90].location = "Central Belfast";
cityLocations[90].location_alt = 'Belfast City';
cityLocations[90].city = 'Belfast';
cityLocations[90].page = 'Belfast-City-hotels';
cityLocations[91] = new Object();
cityLocations[91].location = "Waterloo";
cityLocations[91].location_alt = '';
cityLocations[91].attraction = '3';
cityLocations[91].city = 'London';
cityLocations[91].page = 'hotels-near-waterloo';
cityLocations[92] = new Object();
cityLocations[92].location = "Marylebone";
cityLocations[92].location_alt = '';
cityLocations[92].attraction = '190';
cityLocations[92].city = 'London';
cityLocations[92].page = 'hotels-near-Marylebone';
cityLocations[93] = new Object();
cityLocations[93].location = "Dartford";
cityLocations[93].location_alt = 'Dartford Bridge';
cityLocations[93].city = 'London';
cityLocations[93].page = 'dartford-bridge-hotels';


function testIt() {
	theStatus.Home = 'mouseover';
	theStatus['Place'] = 'click';
	for (var i in theStatus)
	{
		alert('theStatus[\''+i+'\'] is ' + theStatus[i])
	}
}

$(function()
{
	$(".default_button, .default_button_120, .default_button_150").mouseover(function(){
		$(this).addClass("over");
	}).mouseout(function(){
		$(this).removeClass("over");
	});
	
	$('div#telephone a').click(function(){
		if (!$(this).hasClass('selected')) {
			setCurrency($(this).attr('id'), '');
		}
		return false;
	});

	$('div#overview a').click(function(){
		if (!$(this).hasClass('selected')) {
			setCurrency($(this).attr('id'), '#hotel-dates');
		}
		return false;
	});
});

function createDropdown(b,e,s)
{
	for (i=b; i<=e; i++)
	{
		if (i==s)
			document.write('<option value="'+i+'" selected="selected">'+i+'</option>');
		else
			document.write('<option value="'+i+'">'+i+'</option>');
	}
}

function openCalendar(url)
{
  var params="menubar=no,toolbar=no,location=no,directories=no,status=yes,scrollbars=no,resizable=no,dependent,top=0,left=0,width=680,height=210";
  popupWin = window.open(url, 'calendar',params);
  popupWin.focus();
}

function setGuests(br)
{
	var new_kids = true;
	if ($('input[name="kidsage"]').is(':text'))
	{
		new_kids = false;
	}
	
	f = document.form;
	adults = 0;
	children = 0;
	kidsage = '';
	m = f.rooms.options[f.rooms.selectedIndex].value;
	lb = "";
	if (br==1)
		lb = "<br />";
	
	for (i = 1; i <= m; i++)
	{
		if (new_kids === true)
		{
			$room = $("#roomtype" + i);
			kids = parseInt($('option:selected', $room).attr('data-kids'), 10);
			room = $('option:selected', $room).val();
			
			if ((room == 'doubleroom') || (room == 'family3'))
			{
				adults = adults + 2;
			}
			if (room == 'twin')
			{
				if (kids == 1)
				{
					adults = adults + 1;
					children = children + 1
				}
				else
				{
					adults = adults + 2;
				}
			}
			if (room == 'single')
			{
				adults = adults + 1;
			}
			if (room == 'triple')
			{
				adults = adults + 3;
			}
			if (room == 'family1')
			{
				if (kids == 2)
				{
					adults = adults + 1;
				}
				if (kids == 1)
				{
					adults = adults + 2;
				}
				children = children + kids;
			}
			if (room == 'family2')
			{
				if (kids == 3)
				{
					adults = adults + 1;
				}
				if (kids == 2)
				{
					adults = adults + 2;
				}
				children = children + kids;
			}
			for (x = 1; x <= kids; x++)
			{
				if ($room.parent().find('select[name="r' + i + 'kidsage' + x + '"]').val() != '')
				{
					kidsage = kidsage + $room.parent().find('select[name="r' + i + 'kidsage' + x + '"]').val() + ',';
				}
			}
		}
		else
		{
			if ((f['roomtype'+i].options[f['roomtype'+i].selectedIndex].value=='doubleroom')||(f['roomtype'+i].options[f['roomtype'+i].selectedIndex].value=='twin')||(f['roomtype'+i].options[f['roomtype'+i].selectedIndex].value=='family3'))
				adults = adults + 2;
			if (f['roomtype'+i].options[f['roomtype'+i].selectedIndex].value=='single')
				adults = adults + 1;
			if (f['roomtype'+i].options[f['roomtype'+i].selectedIndex].value=='triple')
				adults = adults + 3;
			if (f['roomtype'+i].options[f['roomtype'+i].selectedIndex].value=='family1')
			{
				adults = adults + 2;
				children = children + 1;
			}
			if (f['roomtype'+i].options[f['roomtype'+i].selectedIndex].value=='family2')
			{
				adults = adults + 2;
				children = children + 2;
			}
		}
	}
	
	if (new_kids === true)
	{
		kidsage = kidsage.substring(0, kidsage.length - 1);
	
		var str_adult = ' adults',
			str_children = ' children',
			str_age = 'ages';
		
		if (adults == 1)
		{
			str_adult = ' adult';
		}
		if (children == 1)
		{
			str_children = ' child';
			str_age = 'age';
		}
		
		if (br != 2)
		{
			if ((children == 0) && (adults > 0))
				$('#guestText').html(adults + str_adult);
			else if (adults > 0)
				$('#guestText').html(adults + str_adult + ', ' + lb + children + str_children +' (' + str_age + ':' + kidsage + ')');
			else
				$('#guestText').html('');
		}
		f.adults.value = adults;
		f.children.value = children;
		f.kidsage.value = kidsage;
	}
	else
	{
		if (br!=2)
		{
			if ((children==0)&&(adults>0))
				document.getElementById('guestText').innerHTML = adults + ' adults';
			else if (adults>0)
				document.getElementById('guestText').innerHTML = adults + ' adults, ' + lb + children + ' children (age:' + f.kidsage.value + ')';
			else
				document.getElementById('guestText').innerHTML = '';
		}
		f.adults.value = adults;
		f.children.value = children;
	}
}

function showKidsAge()
{
	var new_kids = true;
	if ($('input[name="kidsage"]').is(':text'))
	{
		new_kids = false;
	}
	if (new_kids === false)
	{
		f = document.form;
		s = document.getElementById('kidsage_row');
		r1 = document.form.roomtype1.options[document.form.roomtype1.selectedIndex].value;
		r2 = document.form.roomtype2.options[document.form.roomtype2.selectedIndex].value;
		r3 = document.form.roomtype3.options[document.form.roomtype3.selectedIndex].value;
		r4 = document.form.roomtype4.options[document.form.roomtype4.selectedIndex].value;
		r5 = document.form.roomtype5.options[document.form.roomtype5.selectedIndex].value;
		r = document.form.rooms.options[document.form.rooms.selectedIndex].value;
	
		if ((r1.indexOf('family1')>-1) || (r2.indexOf('family1')>-1) || (r3.indexOf('family1')>-1) || (r4.indexOf('family1')>-1) || (r5.indexOf('family1')>-1) || (r1.indexOf('family2')>-1) || (r2.indexOf('family2')>-1) || (r3.indexOf('family2')>-1) || (r4.indexOf('family2')>-1) || (r5.indexOf('family2')>-1))
		{
			s.style.display = 'block';
			kidspace=31;
		}
		else
		{
			s.style.display = 'none';
			kidspace=0;
		}
	}
}

function showKidsAge2()
{
	var new_kids = true;
	if ($('input[name="kidsage"]').is(':text'))
	{
		new_kids = false;
	}
	if (new_kids === false)
	{
		f = document.form;
		s = document.getElementById('kidsage_row');
		r1 = document.form.roomtype1.options[document.form.roomtype1.selectedIndex].value;
		r2 = document.form.roomtype2.options[document.form.roomtype2.selectedIndex].value;
		r3 = document.form.roomtype3.options[document.form.roomtype3.selectedIndex].value;
		r4 = document.form.roomtype4.options[document.form.roomtype4.selectedIndex].value;
		r5 = document.form.roomtype5.options[document.form.roomtype5.selectedIndex].value;
	
		if ((r1.indexOf('family1')>-1) || (r2.indexOf('family1')>-1) || (r3.indexOf('family1')>-1) || (r4.indexOf('family1')>-1) || (r5.indexOf('family1')>-1) || (r1.indexOf('family2')>-1) || (r2.indexOf('family2')>-1) || (r3.indexOf('family2')>-1) || (r4.indexOf('family2')>-1) || (r5.indexOf('family2')>-1))
		{
			s.style.display = 'block';
		}
		else
		{
			s.style.display = 'none';
		}
	}
}

function resetAdvancedSearch(x)
{
	f = document.form;
	cookie = document.cookie;
	broken_cookie = cookie.split(";");
	m = broken_cookie.length;

	for (i=0; i<m; i++)
	{
		broken_cookie[i] = trimCookie(broken_cookie[i]);
		if (broken_cookie[i] == 'advanced=0')
		{
			//clearAdvanced();
		}
		else if (broken_cookie[i] == 'advanced=1')
		{
			showAdvanced(0);
		}
	}
	advancedLinkCookie(x);
}

function trimCookie(str)
{
	return str.replace(/^\s+/,"").replace(/\s+$/,"").replace(/\s+/g," ");
}

function showAdvanced(c)
{
	f = document.form;
	s = document.getElementById('advanced_search');
	r = document.form.rooms.options[document.form.rooms.selectedIndex].value;
	kids = document.form.kidsage.value;
	if (kids == '')
	{
		kidspace = 0;
	}
	else
	{
		kidspace = 31;
	}

	if ((s.style.display=='')||(s.style.display=='none'))
	{
		s.style.display = 'block';
		document.cookie = "advanced=1";
	}
	else
	{
		s.style.display = 'none';
		f.price.selectedIndex = 0;
		f.category.selectedIndex = 0;
		f.location.selectedIndex = 0;
		f.hotelname.selectedIndex = 0;
		f.facilities.selectedIndex = 0;
		document.cookie = "advanced=0";
	}
}

function advancedLinkCookie(x)
{
	f = document.form;
	cookie = document.cookie;
	broken_cookie = cookie.split(";");
	m = broken_cookie.length;

	for (i=0; i<m; i++)
	{
		if ((broken_cookie[i] == 'advancedLink=1') && (x == 1))
		{
			showAdvancedLink();
		}
	}
}

function checkHotelcookiecitypage(thiscity)
{
	cookie = document.cookie;
	broken_cookie = cookie.split(";");
	m = broken_cookie.length;
	hotelid=0;hname='';thumbnail='';hotelcurrency='';city='';

	for (i=0; i<m; i++)
	{
		broken_cookie[i] = trimCookie(broken_cookie[i]);
		if (broken_cookie[i].indexOf('hotelid=')>-1) hotelid=broken_cookie[i].substring(8);
		if (broken_cookie[i].indexOf('hname=')>-1) hname=broken_cookie[i].substring(6);
		if (broken_cookie[i].indexOf('city=')>-1) city=broken_cookie[i].substring(5);
		if (broken_cookie[i].indexOf('thumbnail=')>-1) thumbnail=broken_cookie[i].substring(10);
		if (broken_cookie[i].indexOf('hotelcurrency=')>-1) hotelcurrency=broken_cookie[i].substring(14);
		if (hotelid!=0 && hname!='' && city!='' && thumbnail!='' && hotelcurrency!='') 
		{
			if (city==thiscity) break;
			else 
			{
				hotelid=0;hname='';thumbnail='';hotelcurrency='';city='';
			}
		}
	}
}

function sameAddress()
{
	f = document.form;
	if ($('input#copy_address').is(':checked'))
	{
		f.ccaddress.value = f.address.value;
		f.cccity.value = f.custcity.value;
		f.ccstate.value = f.county.value;
		f.ccpostcode.value = f.postcode.value;
		f.cccountry.selectedIndex = f.country.selectedIndex;
	}
	else
	{
		f.ccaddress.value = '';
		f.cccity.value = '';
		f.ccstate.value = '';
		f.ccpostcode.value = '';
	}
}

function openWindow(url, w, h, s)
{
    if (s == 'y')
    {
        s = 'yes';
    }
	var params="menubar=no, toolbar=no, location=no, directories=no, status=no, scrollbars=" + s + ", resizable=yes, dependent, top=0, left=0, width=" + w + ", height=" + h;
	popupWin = window.open(url, 'popup', params);
	popupWin.focus();
}

function setHotelcookie(hotelid,hname,city,thumbnail,hotelcurrency)
{
	var now = new Date();
	now.setTime(now.getTime() + 7 * 24 * 60 * 60 * 1000);
	document.cookie = "hotelid=" + hotelid+"; domain=" + domain + "; path=/;expires="+now.toGMTString()+";";
	document.cookie = "hname=" + hname+"; domain=" + domain + "; path=/;expires="+now.toGMTString()+";";
	document.cookie = "city=" + city+"; domain=" + domain + "; path=/;expires="+now.toGMTString()+";";
	document.cookie = "thumbnail=" + thumbnail+"; domain=" + domain + "; path=/;expires="+now.toGMTString()+";";
	document.cookie = "hotelcurrency=" + hotelcurrency+"; domain=" + domain + "; path=/;expires="+now.toGMTString()+";";
}

function getHotelcookie(page,thiscity)
{
	cookie = document.cookie;
	broken_cookie = cookie.split(";");
	m = broken_cookie.length;
	hotelid=0;hname='';thumbnail='';hotelcurrency='';city='';
	for (i=0; i<m; i++)
	{
		broken_cookie[i] = trimCookie(broken_cookie[i]);
		if (broken_cookie[i].indexOf('hotelid=')>-1) hotelid=broken_cookie[i].substring(8);
		if (broken_cookie[i].indexOf('hname=')>-1) hname=broken_cookie[i].substring(6);
		if (broken_cookie[i].indexOf('city=')>-1) city=broken_cookie[i].substring(5);
		if (broken_cookie[i].indexOf('thumbnail=')>-1) thumbnail=broken_cookie[i].substring(10);
		if (broken_cookie[i].indexOf('hotelcurrency=')>-1) hotelcurrency=broken_cookie[i].substring(14);
		if (hotelid!=0 && hname!='' && city!='' && thumbnail!='' && hotelcurrency!='') 
		{
		   if (page=='city') 
		   {
			if (city==thiscity) break;
			else 
			{
				hotelid=0;hname='';thumbnail='';hotelcurrency='';city='';
			}
		   }
		   else break;
		}
	}
	if (hotelid!=0 && hname!='' && city!='' && thumbnail!='' && hotelcurrency!='')
	{
		document.write("<div id=\"last_viewed\"><h2>Recently viewed</h2><p class=\"grey\"><strong>You recently viewed this hotel...</strong></p><div class=\"last_pic\"><a href=\"http://www.hoteldirect.co.uk/webapp/hoteldirect/servlet/HDViewPage?web=yes&purpose=hotel&hotelid="+hotelid+"&city="+city+"&currency="+hotelcurrency+"\"><img src=\""+thumbnail+"\" width=\"72\" height=\"47\" onclick=\"logOCPV('isconv=0|pover=Browsing_History');\" alt=\""+hname+"\" /></a></div><div class=\"last_text\"><h3><a onclick=\"logOCPV('isconv=0|pover=Browsing_History');\" href=\"http://www.hoteldirect.co.uk/webapp/hoteldirect/servlet/HDViewPage?web=yes&purpose=hotel&hotelid="+hotelid+"&city="+city+"&currency="+hotelcurrency+"\">"+hname+"</a></h3><p><a onclick=\"logOCPV('isconv=0|pover=Browsing_History');\" href=\"http://www.hoteldirect.co.uk/webapp/hoteldirect/servlet/HDViewPage?web=yes&purpose=hotel&hotelid="+hotelid+"&city="+city+"&currency="+hotelcurrency+"\">"+city+"</a></p><ul><li><a onclick=\"logOCPV('isconv=0|pover=Browsing_History');\" href=\"http://www.hoteldirect.co.uk/webapp/hoteldirect/servlet/HDViewPage?web=yes&purpose=hotel&hotelid="+hotelid+"&city="+city+"&currency="+hotelcurrency+"\">Hotel details</a></li></ul></div>");
		//document.write("<p><a href=\"\">View more hotels like this</a></p>");
		document.write("</div>");
	}
}

function showYear()
{
	now = new Date();
	document.write(now.getFullYear()); 
}

function setCurrency(c, anchor)
{
	if (c=='usdollar') c='usd';
	document.cookie = "currency=" + c;
	url = document.URL;
	pos=url.indexOf('?_$ja=');
	if (pos>-1)
	{
		pos2=url.indexOf('&');
		if (pos2>-1) url=url.substring(0,pos)+"?"+url.substring(pos2+1);
		else url=url.substring(0,pos);
	}
	if (url.indexOf('?')>-1)
	{
		pos=url.indexOf('currency=');
		if (pos>-1)
		{
			url=url.replace('currency=','currency2=');
			document.location = url + "&currency=" + c + anchor;
		}
		else document.location = url + "&currency=" + c + anchor;
	}
	else if (url.indexOf('?')==-1 && url.indexOf('HDFront')>-1)
	{
		if (c=='usd') c='usdollar';
		document.newform.currency.value=c;
		document.newform.submit();
	}
	else if (url.indexOf('?')==-1 && url.indexOf('HDSearchDate')>-1)
	{
		if (c=='usd') c='usdollar';
		document.mainform.currency.value=c;
		document.mainform.submit();
	}
	else
	{
		if (url.indexOf('currency=')>-1)
			document.location = url.substring(0, url.indexOf('currency=')) + "currency=" + c + anchor;
		else
		{
		  lastchar=url.length;
		  if (url.indexOf('.htm')==-1 && url.indexOf('servlet')==-1)
			document.location = url + "index_" + c+".htm" + anchor;
		  else
		  {
		    if (url.indexOf('index_')>-1)
		    {
				if (c=='gbp')
				{
				   pos=url.indexOf('index_');
				   document.location = url.substring(0,pos);		  	   
				}
				else
				{
				   pos=url.indexOf('index_');
				   document.location = url.substring(0,pos)+ "index_" + c+".htm" + anchor;
				}
		    }
		    else if (url.indexOf('.htm')>-1)
		    {
				pos=url.indexOf(".htm");
				if (c=='gbp')
				{
				   pos2=url.indexOf('_usd.htm');
				   if (pos2>-1) document.location = url.substring(0,pos2)+".htm" + anchor;
				   else 
				   {	
					pos2=url.indexOf('_euro.htm');
					if (pos2>-1) document.location = url.substring(0,pos2)+".htm" + anchor;
				   }
				}
				else
				{
				   pos2=url.indexOf('_usd.htm');
				   if (pos2>-1) document.location = url.substring(0,pos2)+"_"+c+".htm" + anchor;
				   else 
				   {	
					pos2=url.indexOf('_euro.htm');
					if (pos2>-1) document.location = url.substring(0,pos2)+"_"+c+".htm" + anchor;
					else document.location = url.substring(0,pos)+"_"+c+".htm" + anchor;
				   }
				}
		    }
		    else
			document.location = url + "?currency=" + c + anchor;
		  }
		}
	}
}


function getCurrency()
{
/*
	cookie = document.cookie;
	broken_cookie = cookie.split(";");
	m = broken_cookie.length;

	for (i=0; i<m; i++)
	{
		broken_cookie[i] = trimCookie(broken_cookie[i]);
		if ((broken_cookie[i]=='currency=usd') || (broken_cookie[i]=='currency=usdollar'))
		{
			$("#currency").val("usd");
			$("#currency_label").addClass("usd");
		}
		else if (broken_cookie[i]=='currency=euro')
		{
			$("#currency").val("euro");
			$("#currency_label").addClass("euro");
		}
		else
		{
			$("#currency").val("gbp");
			$("#currency_label").addClass("gbp");
		}
	}
*/
}

function printPage()
{
	if (window.print)
	{
		window.print();
	}
	else
	{
		alert("Sorry, your browser doesn't support this feature.");
	}
}

function showRooms(r, c)
{
	kids = document.form.kidsage.value;
	if (kids=='')
		kidspace=0;
	else
		kidspace=31;
	
	for (i = 2; i <= 5; i++)
	{
		$('#room_'+i).hide();
	}
	if (r > 1)
	{
		for (i = 2; i <= r; i++)
		{
			$('#room_'+i).show();
		}
	}
}

function setGuestsFree()
{
	f = document.form;
	adults = 0;
	children = 0;
	
	if (f.family1.selectedIndex>0)
	{
		adults = adults + (2 * f.family1.selectedIndex);
		children = children + (1 * f.family1.selectedIndex);
	}
	if (f.family2.selectedIndex>0)
	{
		adults = adults + (2 * f.family2.selectedIndex);
		children = children + (2 * f.family2.selectedIndex);
	}
	f.adults.value = adults;
	f.children.value = children;
}

function ageOnly(field)
{
	var valid = "0123456789,"
	ok = 1;
	var temp;
	for (var i=0; i<field.value.length; i++)
	{
		temp = "" + field.value.substring(i, i+1);
		if (valid.indexOf(temp) == "-1")
			ok = 0;
	}
	if (ok==0)
	{
		alert("Please only enter numbers in this field!");
		field.focus();
		field.select();
	}
}

function openMap(url, w, h)
{
	url=url.replace('2&3','2%263');
	var params="menubar=yes,toolbar=yes,location=no,directories=no,status=no,scrollbars=yes,resizable=yes,dependent,top=0,left=0,width="+w+",height="+h;
	popupWin = window.open(url, 'popup',params);
	popupWin.focus();
}

function showHideKids()
{
	var new_kids = true;
	if ($('input[name="kidsage"]').is(':text'))
	{
		new_kids = false;
	}
	var showkids = 0,
		showaccom = 0;
	
	if (new_kids === true)
	{
		for (i = 1; i <= 5; i++)
		{
			if ($("#roomtype" + i).is(':visible'))
			{
				$room = $("#roomtype" + i);
				kids = $('option:selected', $room).attr('data-kids');
				$room.parent().find('p.agetitle').hide();
				if (kids > 0)
				{
					if (kids == 1)
					{
						$room.parent().find('p.agetitle').html('Age of child').show();
					}
					else
					{
						$room.parent().find('p.agetitle').html('Ages of children').show();
					}
					if (i > 1)
					{
						$("#roomtype1").parent().find('p.sleeps').html('Room 1 sleeps');
					}
				}
				for (x = 1; x <= 3; x++)
				{
					if (x <= kids)
					{
						$room.parent().find('select[name="r' + i + 'kidsage' + x + '"]').show();
					}
					else
					{
						$room.parent().find('select[name="r' + i + 'kidsage' + x + '"]').hide().val('');
					}
				}
				showkids = 1;
			}
			if ($("#roomtype" + i).is(':visible') && i > 1)
			{
				showaccom = 1;
			}
		}
		if (showkids == 0)
		{
			$("select.kidsage").hide();
		}
		else
		{
			setGuests(3);
		}
		if (showaccom === 1)
		{
			$('#accommodates').show();
		}
	}
	else
	{
		for (i = 1; i <= 5; i++)
		{
			if ($("#roomtype" + i).val().indexOf('family') > -1 && $("#roomtype" + i).is(':visible'))
			{
				$("#kidsage_row").show();
				kids = 1;
			}
		}
		if (kids == 0)
		{
			$("#kidsage_row").hide();
		}
	}
}

function wordToUpper(strSentence)
{
	return strSentence.toLowerCase().replace(/\b[a-z]/g, convertToUpper);
	
	function convertToUpper()
	{
		return arguments[0].toUpperCase();
	}
}

function setLastViewed(hotel)
{
	hotelcookie = hotel.join('|');
	cookie = document.cookie;
	broken_cookie = cookie.split(";");
	m = broken_cookie.length;
	var viewed = new Array();
	for (i=0; i<m; i++)
	{
		broken_cookie[i] = trimCookie(broken_cookie[i]);
		if (broken_cookie[i].indexOf('lastviewed1=')>-1)
		{
			viewed[0] = broken_cookie[i].substring(12);
		}
		if (broken_cookie[i].indexOf('lastviewed2=')>-1)
		{
			viewed[1] = broken_cookie[i].substring(12);
		}
		if (broken_cookie[i].indexOf('lastviewed3=')>-1)
		{
			viewed[2] = broken_cookie[i].substring(12);
		}
	}
	
	found = -1;
	for (i = 0; i < viewed.length; i++)
	{
		if (viewed[i] == hotelcookie)
		{
			found = i;
		}
	}
	
	if (found == -1)
	{
		if (viewed.length == 0)
		{
			document.cookie = "lastviewed1=" + hotelcookie +"; path=/;";
		}
		if (viewed.length == 1)
		{
			document.cookie = "lastviewed2=" + viewed[0] +"; path=/;";
			document.cookie = "lastviewed1=" + hotelcookie +"; path=/;";
		}
		if ((viewed.length == 2) || (viewed.length == 3))
		{
			document.cookie = "lastviewed3=" + viewed[1] +"; path=/;";
			document.cookie = "lastviewed2=" + viewed[0] +"; path=/;";
			document.cookie = "lastviewed1=" + hotelcookie +"; path=/;";
		}
	}
}

function checkSpelling(destination)
{
	if (destination == 'kondon' || destination == 'olndon' || destination == 'ondon')
	{
		destination = 'London';
	}
	if (destination == 'fublin' || destination == 'sublin' || destination == 'ublin' || destination == 'udblin')
	{
		destination = 'Dublin';
	}
	if (destination == 'apris' || destination == 'aris' || destination == 'oaris')
	{
		destination = 'Paris';
	}
	if (destination == 'deinburgh' || destination == 'dinburgh' || destination == 'rdinburgh' || destination == 'wdinburgh')
	{
		destination = 'Edinburgh';
	}
	if (destination == 'abrcelona' || destination == 'arcelona' || destination == 'narcelona' || destination == 'varcelona')
	{
		destination = 'Barcelona';
	}

	return destination;
}

function capitalizeString(str)
{
	var new_string = '';
	sp = str.split(' ');
	for (var c=0; c < sp.length; c++)
	{
		new_string += sp[c].substring(0, 1).toUpperCase() + sp[c].substring(1, sp[c].length) + ' ';
	}
	return $.trim(new_string);
}

function getLastViewed()
{
	cookie = document.cookie;
	broken_cookie = cookie.split(";");
	m = broken_cookie.length;
	var hotel_name = '';
	
	var viewed = new Array();
	for (i=0; i<m; i++)
	{
		broken_cookie[i] = trimCookie(broken_cookie[i]);
		if (broken_cookie[i].indexOf('lastviewed1=')>-1)
		{
			viewed[0] = broken_cookie[i].substring(12);
		}
		if (broken_cookie[i].indexOf('lastviewed2=')>-1)
		{
			viewed[1] = broken_cookie[i].substring(12);
		}
		if (broken_cookie[i].indexOf('lastviewed3=')>-1)
		{
			viewed[2] = broken_cookie[i].substring(12);
		}
	}
	if (viewed.length == 0)
	{
		$('div#banners, div#viewed, div.viewed, div.viewed-more, div#tv-ad').hide();
		$('div#home-top div.popular').removeClass('viewed');
		$('div#banners, div#tv-ad').show();
	}
	if (viewed.length == 1)
	{
		$('div#banners, div#viewed, div.viewed, div.viewed-more, div#tv-ad').hide();
		for (var p = 3; p <= 8; p++)
		{
			$('div.city-hotels.london p:eq(' + p + ')').hide()
		}
		$('div#home-top p.more').css({'margin-bottom':'10px'});
		$('div#home-top div.popular').removeClass('viewed');
		
		hotel = viewed[0].split('|');
		hotel_name = hotel[0];
		if (hotel[7] != '')
		{
			hotel_name = hotel[7];
		}
		$('div.viewed-more').attr('title', hotel[0]);
		$('div.viewed-more a').attr('title', hotel[0]).attr('href', hotel[4]);
		$('div.viewed-more p.name a').html('<b>'+hotel_name+'</b>');
		$('div.viewed-more img').attr('alt', hotel[0]).attr('src', hotel[1]);
		$('div.viewed-more p.rating').html(hotel[3]);
		if (hotel[3] == '5 star')
		{
			$('div.viewed-more p.rating').addClass('stars5');
		}
		if (hotel[3] == '4 star deluxe')
		{
			$('div.viewed-more p.rating').addClass('stars4d');
		}
		if (hotel[3] == '4 star')
		{
			$('div.viewed-more p.rating').addClass('stars4');
		}
		if (hotel[3] == '3 star deluxe')
		{
			$('div.viewed-more p.rating').addClass('stars3d');
		}
		if (hotel[3] == '3 star')
		{
			$('div.viewed-more p.rating').addClass('stars3');
		}
		if (hotel[3] == '2 star deluxe')
		{
			$('div.viewed-more p.rating').addClass('stars2d');
		}
		if (hotel[3] == '2 star')
		{
			$('div.viewed-more p.rating').addClass('stars2');
		}
		if (hotel[3] == '1 star deluxe')
		{
			$('div.viewed-more p.rating').addClass('stars1d');
		}
		if (hotel[3] == '1 star')
		{
			$('div.viewed-more p.rating').addClass('stars1');
		}
		$('div.viewed-more p.address').html(hotel[2] + ', ' + hotel[8]);
		$('div.viewed-more p.score span').html(hotel[5]);
		$('div.viewed-more p.score strong').html(hotel[6]);
		
		$('div#viewed, div.viewed-more').show();
	}
	if (viewed.length > 1)
	{
		$('div#banners, div#viewed, div.viewed, div.viewed-more, div#tv-ad').hide();
		for (var p = 3; p <= 8; p++)
		{
			$('div.city-hotels.london p:eq(' + p + ')').hide()
		}
		$('div#home-top p.more').css({'margin-bottom':'10px'});
		$('div#home-top div.popular').addClass('viewed');
		
		hotel = viewed[0].split('|');
		hotel_name = hotel[0];
		if (hotel[7] != '')
		{
			hotel_name = hotel[7];
		}
		$('div.viewed:eq(0)').attr('title', hotel[0]);
		$('div.viewed:eq(0) a').attr('title', hotel[0]).attr('href', hotel[4]);
		$('div.viewed:eq(0) p a').html('<b>'+hotel_name + '</b>,<br />' + hotel[8]);
		$('div.viewed:eq(0) img').attr('alt', hotel[0]).attr('src', hotel[1]);
		$('div.viewed:eq(0)').show();
		hotel = viewed[1].split('|');
		hotel_name = hotel[0];
		if (hotel[7] != '')
		{
			hotel_name = hotel[7];
		}
		$('div.viewed:eq(1)').attr('title', hotel[0]);
		$('div.viewed:eq(1) a').attr('title', hotel[0]).attr('href', hotel[4]);
		$('div.viewed:eq(1) p a').html('<b>'+hotel_name + '</b>,<br />' + hotel[8]);
		$('div.viewed:eq(1) img').attr('alt', hotel[0]).attr('src', hotel[1]);
		$('div.viewed:eq(1)').show();
		if (viewed.length == 3)
		{
			hotel = viewed[2].split('|');
			hotel_name = hotel[0];
			if (hotel[7] != '')
			{
				hotel_name = hotel[7];
			}
			$('div.viewed:eq(2)').attr('title', hotel[0]);
			$('div.viewed:eq(2) a').attr('title', hotel[0]).attr('href', hotel[4]);
			$('div.viewed:eq(2) p a').html('<b>'+hotel_name + '</b>,<br />' + hotel[8]);
			$('div.viewed:eq(2) img').attr('alt', hotel[0]).attr('src', hotel[1]);
			$('div.viewed:eq(2)').show();
		}
		
		$('div#viewed').show();
	}
}

function whiteLabelSearch(dest)
{
	var rooms = $('select#rooms').val();
	var guests = '';
	for (var x = 0; x < rooms; x++)
	{
		var adults = 0;
		var children = 0;
		var kidsage=''
		if ($('select#roomtype' + (x + 1)).val() == 'doubleroom' || $('select#roomtype' + (x + 1)).val() == 'twin')
		{
			adults = 2;
			children = 0;
		}
		if ($('select#roomtype' + (x + 1)).val() == 'single')
		{
			adults = 1;
			children = 0;
		}
		if ($('select#roomtype' + (x + 1)).val() == 'triple')
		{
			adults = 3;
			children = 0;
		}
		if ($('select#roomtype' + (x + 1)).val() == 'family1')
		{
			adults = 2;
			children = 1;
			var age=$('input#kidsage').val();
			var pos=age.indexOf(',');
			if (pos>-1) age=age.substring(0,pos);
			kidsage='&rooms[' + x + '].children[0].age='+age;
		}
		if ($('select#roomtype' + (x + 1)).val() == 'family2')
		{
			adults = 2;
			children = 2;
			var age=$('input#kidsage').val();
			var pos=age.indexOf(',');
			if (pos>-1) age=age.substring(0,pos);
			kidsage='&rooms[' + x + '].children[0].age='+age+'&rooms[' + x + '].children[1].age='+age;
		}
		guests += '&rooms[' + x + '].adultsCount=' + adults + '&rooms[' + x + '].childrenCount=' + children+kidsage;
	}
	var arrdate = $('select#arrivedate').val();
	var arr = $('select#arrivedate2').val();
	var pos = arr.indexOf('|');
	var arrmonth = parseInt(arr.substring(0, pos)) + 1;
	var arryear = arr.substring(pos + 3);
	var depdate = $('select#departdate').val();
	var dep = $('select#departdate2').val();
	pos = dep.indexOf('|');
	var depmonth = parseInt(dep.substring(0, pos)) + 1;
	var depyear = dep.substring(pos + 3);
	for (var i = 0; i < ukCities.length; i++)
	{
		if (dest.toLowerCase()==ukCities[i].toLowerCase())
		{
			dest = dest + ', United Kingdom';
			break;
		}
	}
	if (document.location.href.indexOf('searchhotel.htm') > -1)
	{
		window.open('http://world.hoteldirect.co.uk/templates/354468/hotels/list?destination=' + dest + '&roomsCount=' + rooms + guests + '&checkin=' + arrmonth + '%2F' + arrdate + '%2F' + arryear + '&checkout=' + depmonth + '%2F' + depdate + '%2F' + depyear + '&filter.sortedBy=our_rec&currency=' + cur + '&currencySymbol=' + cur_symbol + '&lang=en&filtering=true', '_blank', '');
	}
	else
	{
		document.location.href = 'http://world.hoteldirect.co.uk/templates/354468/hotels/list?destination=' + dest + '&roomsCount=' + rooms + guests + '&checkin=' + arrmonth + '%2F' + arrdate + '%2F' + arryear + '&checkout=' + depmonth + '%2F' + depdate + '%2F' + depyear + '&filter.sortedBy=our_rec&currency=' + cur + '&currencySymbol=' + cur_symbol + '&lang=en&filtering=true';
	}
}

function pause(milliseconds) {
	var dt = new Date();
	while ((new Date()) - dt <= milliseconds) { /* Do nothing */ }
}
