/* Variabili globali usate dalla pagina: HotelInfo.asp */
var gImgPath="/images";
var gBusyImage="/E/images/imageLoading.gif";

var gPicsPath = "" // "http://images.octopustravel.com/HH/"; // "http://images.test.octopustravel.com/HH/"; //

/* Variabili globali usate dalla pagina: HotelsDeals.asp */
var gLoaded=true; //gLoaded=false;

var gHealthPage = "HealthUL.asp";
var gPassportPage = "PassportUL.asp";
var gTravelPage = "TravelUL.asp";
var gWeatherPage = "WeatherUL.asp";
var gCurrencyPage = "CurrencyUL.asp";
var gMapsPage = "InteractiveMaps.asp";

var gMsg1="Please specify where you live";
var gMsg2="Please specify your preferred currency";
var gMsg3="Please specify a language";

//var gCurrOpt=parent.gCurrOpt;
var gCurrOpt = new String("|Pounds Sterling|euro|US Dollars");

//var gCurrVal=parent.gCurrVal;
var gCurrVal =new String("|GBP|EUR|USD");

//var gNatOpt=parent.gNatOpt;
var gNatOpt = new String("|Albania|Algeria|Antigua|Argentina|Armenia|Aruba|Australia|Austria|Azerbaijan|Bahamas|Bahrain|Bangladesh|Barbados|Belarus|Belgium|Bermuda|Bolivia|Bosnia Herzegovina|Botswana|Brazil|British Virgin Islands|Brunei Darussalam|Bulgaria|Cambodia|Cameroon|Canada|Cayman Islands|Chile|China|Colombia|Congo|Cook Islands|Costa Rica|Croatia|Cuba|Cyprus|Czech Republic|Denmark|Dominican Republic|Ecuador|Egypt|Estonia|Ethiopia|Fiji|Finland|France|French Polynesia|Gabon|Gambia|Georgia|Germany|Gibraltar|Greece|Greenland|Grenada|Guadeloupe|Guam|Guatemala|Haiti|Honduras|Hong Kong|Hungary|Iceland|India|Indonesia|Iran|Iraq|Ireland(Republic of)|Israel|Italy|Jamaica|Japan|Jordan|Kazakhstan|Kenya|Kuwait|Kyrgyzstan|Laos|Latvia|Lebanon|Libya|Liechtenstein|Lithuania|Luxembourg|Macau|Macedonia|Madagascar|Malaysia|Maldives|Mali|Malta|Mauritius|Mexico|Moldova|Mongolia|Morocco|Mozambique|Myanmar|Namibia|Nepal|Netherlands|Netherlands Antilles|New Caledonia|New Zealand|Nicaragua|Nigeria|North Cyprus|North Korea|Norway|Oman|Pakistan|Panama|Paraguay|Peru|Philippines|Poland|Portugal|Puerto Rico|Qatar|Romania|Russia|Saint Barthelemy|San Martin (F)|Saudi Arabia|Senegal|Serbia & Montenegro|Seychelles|Singapore|Slovakia|Slovenia|South Africa|South Korea|Spain|Sri Lanka|St Kitts & Nevis|St Lucia|St Vincent & Grenadines|Sudan|Swaziland|Sweden|Switzerland|Syria|Tadjikistan|Taiwan|Tanzania|Thailand|Togo|Trinidad & Tobago|Tunisia|Turkey|Turkmenistan|Turks & Caicos Island|Uganda|Ukraine|United Arab Emirates|United Kingdom|United States|Uruguay|Uzbekistan|Vanuatu|Venezuela|Vietnam|Virgin Islands (USA)|Yemen Republic|Zaire|Zambia|Zimbabwe");

//var gNatVal=parent.gNatVal;
var gNatVal =new String("|CAL|CDZ|CAG|CAR|CAM|CAU|CAA|CA |CAZ|CBS|CBN|CBD|CWB|CBY|CB |CBA|CBO|CBH|CBW|CBR|CVG|CBU|CBG|CKH|CCM|CCA|CCP|CCL|CCN|CCO|CCG|CCK|CCS|CCR|CCU|CCY|CC |CDK|CDR|CEC|CUN|CES|CET|CFI|CSF|CF |CPF|CGA|CGM|CGE|CD |CGK|CGR|CGZ|CGD|CGP|CGU|CGT|CHT|CHN|CHX|CH |CIS|CIN|CIA|CIR|CIQ|CEI|CIL|CI |CJA|CJ |CJO|CKA|CKE|CKT|CKG|CLA|CLV|CLE|CLY|CFL|CLI|CLU|CMO|CMK|CMG|CMA|CMV|CML|CMW|CIW|CME|CMD|CMN|CM |CMZ|CMM|CNA|CNP|CNL|CAN|CNC|CNZ|CNI|CNG|CNS|CKP|CN |COM|CPK|CPG|CPY|CPE|CPH|CPL|CP |CPT|CDH|CR |CRU|CSH|CGL|CSJ|CSN|CYU|CFZ|CRS|CSR|CSL|CSA|CK |CE |CCE|CKC|CLC|CVE|CSD|CSZ|CS |CCH|CSY|CTJ|CTW|CTZ|CTH|CTG|CTT|CTN|CTR|CTU|CTC|CUG|CUK|CEM|CGB|CUS|CUY|CUZ|CVU|CVC|CVI|CVN|CYE|CZM|CZA|CZW");

var gLanguage = "E";

/*
var gInitParms = new Array(
"GB",
"GBP",
parent.gRooms,parent.gArrival,parent.gDuration,parent.gCity,parent.gAges
);
*/

function sbm() {
	if (gLoaded && SubmitForm(document.forms[0],document.forms[1])) {
		document.forms[1].submit();
	}
	return false;
}
function chk() {
	return (gLoaded && checkCountry() && checkCurrency());
}

/*
function sbmHotDeal(cntry,cntryName,ctyCode){
		with(document.showHotDealCity){
			country.value= cntry;
			countryName.value= cntryName;
			positionTo.value= ctyCode;
			submit();
		}
}*/

/* La data la gestiosco in ASP */
var gDateFormat = "DMY";
var gEventStart = new String("2006-06-05");
var gEventEnd = new String("2006-07-03");
var gLocationName;
var gMonthNames=new String("Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec");
var gToday="2006-06-05";
var gStartDate="2006-06-05";
var gEndDate="2008-06-04";
var gFromDate="2006-06-06";
var gToDate="2006-06-07";
var gStartMonth = parseInt(gStartDate.substr(5,2),10);
var gStartYear = parseInt(gStartDate.substr(0,4),10);
/********************************************************************************/

var gRoomTypeOpt = new String(" |Twin (sleeps 2)|Twin plus child (sleeps 3)|Double (sleeps 2)|Double plus child (sleeps 3) |Single (sleeps 1)|Triple (sleeps 3)|Twin for sole use (sleeps 1)|Quad (sleeps 4)");
var gRoomTypeVal = new String(" |0|1|2|3|4|5|6|7");
var gChildAges = new String(" 2 3 4 5 6 7 8 9101112131415161718");
var gRooms,gAges,gPax;
var gMaxPax=9;
var gMaxAdults=9;
var gMaxChildren=9;  //5;

var gNameRoot = 'document.forms["searchHotels"].';

//var gCityOpt = parent.gCityOpt;
//var gCityVal = parent.gCityVal;

//var gCltCityOpt=parent.gCltCityOpt;
//var gCltCityVal=parent.gCltCityVal;

var gCltCityOpt = new String("Amsterdam, Netherlands|Athens, Greece|Bangkok, Thailand|Barcelona, Spain|Berlin, Germany|Dubai, United Arab Emirates|Dublin, Irish Republic|Edinburgh, United Kingdom|Las Vegas, United States|London, United Kingdom|New York, United States|Nice, France|Paris, France|Prague, Czech Republic|Rome, Italy|Singapore, Singapore");
var gCltCityVal =new String("AAMS1|AATH1|ABKK |ABCN1|CBER |ADXB |ADUB |AEDA |CLAS |CLON |CNYC |ANCE1|APARR|APRG1|CROM |CSIN ");

var gCityOpt = new String("Aberdeen, United Kingdom|Abu Dhabi, United Arab Emirates|Agadir, Morocco|Aix-en-Provence, France|Albufeira, Portugal|Algarve, Portugal|Alghero (Sardinia), Italy|Alicante, Spain|Amalfi, Italy|Amsterdam, Netherlands|Anaheim, United States|Andorra, Spain|Annecy, France|Antibes, France|Antwerp, Belgium|Armacao de Pera, Portugal|Athens, Greece|Auckland, New Zealand|Avignon, France|Bahamas|Bangkok, Thailand|Barcelona, Spain|Basel, Switzerland|Bath, United Kingdom|Beijing, China|Beirut, Lebanon|Belfast & Region|Benalmadena, Spain|Benidorm, Spain|Bergamo, Italy|Bergen|Berlin, Germany|Berlin World Cup Area|Berne, Switzerland|Bilbao, Spain|Birmingham, United Kingdom|Birmingham, United Kingdom|Blackpool, United Kingdom|Bologna, Italy|Bordeaux|Boston, United States|Bournemouth, United Kingdom|Bremen, Germany|Brighton, United Kingdom|Bristol, United Kingdom|Brugge (Bruges), Belgium|Brussels, Belgium|Budapest, Hungary|Buenos Aires, Argentina|Cairo, Egypt|Calella, Spain|Cannes, France|Cape Town, South Africa|Capri, Italy|Carcassonne, France|Cardiff, United Kingdom|Carvoeiro, Portugal|Casablanca, Morocco|Cascais, Portugal|Catania, Italy|Chamonix Mont Blanc, France|Chester, United Kingdom|Chicago, United States|Chicago, United States|Clearwater, United States|Cologne|Cologne World Cup Area|Como, Italy|Copenhagen|Cordoba, Spain|Corfu Town, Greece|Cork, Ireland(Republic of)|Crete|Crete-Rethymnon, Greece|Cyclades Islands|Cyprus|Dijon, France|Dodecanese Islands|Doha, Qatar|Dortmund, Germany|Dortmund World Cup Area|Dresden, Germany|Dubai, United Arab Emirates|Dubai-Jumeirah|Dublin, Irish Republic|Dusseldorf, Germany|Edinburgh, United Kingdom|Eindhoven, Netherlands|Estepona, Spain|Estoril, Portugal|Faro, Portugal|Fez, Morocco|Florence|FLUMINIMAGGIORE, Italy|Fort Lauderdale, United States|Frankfurt, Germany|Frankfurt World Cup Area|Fuengirola, Spain|Galway, Ireland(Republic of)|Gelsenkirchen World Cup Area|Geneva, Switzerland|Genoa, Italy|Gerona, Spain|Glasgow, United Kingdom|Glasgow Airport, United Kingdom|Gothenburg|Granada, Spain|Grindelwald, Switzerland|Groningen, Netherlands|Hamburg, Germany|Hamburg World Cup Area|Hannover World Cup Area|Harlow, United Kingdom|Harrogate, United Kingdom|Hawaii|Heidelberg, Germany|Helsinki, Finland|Hong Kong|Hong Kong-Kowloon, Hong Kong|Hull, United Kingdom|Ibiza & Formentera, Spain|Innsbruck, Austria|Interlaken, Switzerland|Inverness, United Kingdom|Islamabad, Pakistan|Istanbul, Turkey|Istria|Jerez de la Frontera, Spain|Jersey, United Kingdom|Johannesburg, South Africa|Juan-les-Pins, France|Jyvaskyla, Finland|Kaiserslautern World Cup Area|Key West, United States|Kilkenny, Ireland(Republic of)|Killarney, Ireland(Republic of)|Koh Samui & Islands|Krakow, Poland|Kuala Lumpur, Malaysia|Lancaster, United Kingdom|Las Vegas, United States|Lausanne, Switzerland|Leeds, United Kingdom|Leipzig, Germany|Leipzig World Cup Area|Lido Di Jesolo, Italy|Lille, France|Lisbon, Portugal|Liverpool, United Kingdom|Liverpool & Region|Ljubljana, Slovenia|London, United Kingdom|London Gatwick, United Kingdom|London Heathrow, United Kingdom|London Luton, United Kingdom|London Stansted, United Kingdom|Los Angeles, United States|Lucerne, Switzerland|Luxembourg, Luxembourg|Lyon, France|Madeira & Porto Santo, Portugal|Madrid|Malaga, Spain|Mallorca, Spain|Mallorca-Palma, Spain|Malmo, Sweden|Malta|Manchester, United Kingdom|Manchester & Surrounding area|Marbella, Spain|Marrakech, Morocco|Marseille, France|Melbourne|Menorca, Spain|Mexico City, Mexico|Miami, United States|Miami Beach, United States|Mijas, Spain|Milan, Italy|Monaco, France|Monte Carlo, France|Montecatini Terme, Italy|Montpellier, France|Montreal, Canada|Montreux, Switzerland|Moscow|Munich, Germany|Munich World Cup Area|Murcia, Spain|Mykonos-Mykonos Town, Greece|Naples, Italy|Naxos Town (Hora), Greece|Newcastle & Region|New Delhi, India|New Orleans, United States|New York, United States|New York & Surrounding area|Nice, France|Nottingham, United Kingdom|Nuremberg, Germany|Nuremberg World Cup Area|Oahu-Honolulu, United States|Olympia, Greece|Orlando, United States|Oslo, Norway|Ouarzazate, Morocco|Oulu, Finland|Oxford, United Kingdom|Padova, Italy|Palermo and Sicily|Paphos, Cyprus|Paris & Region|Paris Charles de Gaulle, France|Paris-Disneyland, France|Paris-Marne la Valee, France|Paris Orly, France|Parma, Italy|Pattaya Beach, Thailand|Perth, Australia|Perugia, Italy|Philadelphia, United States|Phuket, Thailand|Pisa, Italy|Porto|Porto and surrounding area|Prague, Czech Republic|Rabat, Morocco|Reykjavik, Iceland|Rhodes|Rhodes-Faliraki, Greece|Rhodes-Rhodes Town, Greece|Riga, Latvia|Rijeka, Croatia|Rimini, Italy|Rio De Janeiro, Brazil|Rome, Italy|Rome & Region|Rome-Ciampino, Italy|Rotterdam, Netherlands|Rovaniemi, Finland|Saariselka, Finland|Salzburg, Austria|San Cristobel, Ecuador|San Diego, United States|San Francisco, United States|San Gimignano, Italy|Santiago de Compostela and surrounding area|Santorini, Greece|Seoul, South Korea|Seville, Spain|Shanghai, China|Siena, Italy|Singapore, Singapore|Sitges, Spain|Sorrento, Italy|Split, Croatia|Stockholm, Sweden|St Petersburg, Russia|Strasbourg, France|Stratford-upon-Avon, United Kingdom|Stresa, Italy|Stuttgart, Germany|Stuttgart World Cup Area|Sydney, Australia|Sydney-Bondi Beach, Australia|Taipei|Tallinn, Estonia|Tangier, Morocco|Taormina (Sicily)|Tavira, Portugal|Tenerife|The Hague, Netherlands|Tokyo, Japan|Toledo, Spain|Toronto, Canada|Torremolinos, Spain|Toulouse, France|Treviso, Italy|Trieste, Italy|Tunis, Tunisia|Turin, Italy|Turku, Finland|Utrecht, Netherlands|Valencia, Spain|Vancouver, Canada|Venice & Islands|Venice Mainland|Verona, Italy|Vienna, Austria|Vilamoura, Portugal|Vilanova I LA, Spain|Warsaw, Poland|Washington DC, United States|Windermere, United Kingdom|York, United Kingdom|York, United Kingdom|Zagreb, Croatia|Zakynthos-Laganas, Greece|Zermatt, Switzerland|Zurich, Switzerland|Mumbai (Bombay), India|Mumbai (Bombay) Airport, India");
var gCityVal = new String("CABZ |AAUH1|CAGA |CAIXE|CALBU|AALG1|CAHO |CALC |CAMAL|AAMS1|CANA |CANDO|CNCY |CANTI|CANR |CARMC|AATH1|CAKL |CAVN |ABAH |ABKK |ABCN1|CBSL |CBATH|CPEK |CBEY |ABEL |CBENA|CBEND|CBGY |ABGO |CBER |ABER1|CBRN |CBIO |ABHX |CBHX |CBLK |ABLQ1|ABOD1|CBOS |CBOH |CBRE |CBSH |CBRS |CBRUG|CBRU |CBUD |CBUE |ACAI |CCALX|CCEQ |ACPT |CPRJ |CCCF |CCWL |CCARV|CCAS |CCASC|CCTA |CCHAM|CCEG |ACHI |CCHI |CCLW |ACGN1|ACGN2|CQCM |ACPH1|CODB |CCFU |CORK |ACRT |CRETH|ACYC |ACYP |CDIJ |ADOD |CDOH |ADTM1|ADTM2|CDRS |ADXB |AJUME|ADUB |ADUS |AEDA |CEIN |CESTE|CESTO|CFAO |CFEZ |AFLR1|CFLUM|CFLL |AFRA |AFRA2|CFUEG|CGWY |AGELS|AGVE |CGOA |CGRO |AGLS |CGLAB|AGOT |CGRX |CGRIN|CGRQ |AHAM1|AHAM2|AHAJ |CHAR |CHARR|AHAWA|CQHD |CHEL |AHKG |CKOWL|CHULL|AIBI |CINN |CINTE|CINV |CISB |CIST |AAAIS|CJERE|CJER |CJNB |CJLP |CJYV |AKLT |CEYW |CKKY |CKIR |AKOSA|CKRK |CKUL |CLANC|CLAS |CQLS |CLBA |CLEJ |ALEJ1|CLIDO|CLIL |CLIS |CLPL |ALPL |CLJU |CLON |ALGW |CLHR |ALTN |ASTN |ALAX |CLUCE|CLUX |CLYN |AMADE|AMAD1|CAGP |APMI |CPMI |CMMA |AMLT |CMAN |AMAN |CQRL |CRAK |CMRS |AMEL |AEMEN|CMEX |AMIA |CMIAB|CMIJA|CMIL |AMON |CMCM |CMONC|CMPL |CYMQ |CMONE|AMOW |AMUC |AMUC1|CMJV |CJMK |CNAP |CNAXO|ANCL |ADEL |CMSY |CNYC |AAANY|ANCE1|CNOTT|CNUE |ANUE1|CHNL |COLYM|AORL |AOSL |COZZ |COUL |COXFO|CQPA |APMO |CPAPH|APARR|CCDG |CDISN|CMARW|CORY |CQPM |CPATT|APER |CPEG |CPHL |AHKT |CPSA |AOPO2|AOPO |APRG1|CRBA |CREK |AAARH|CFALI|CRHO |CRIX |CRJK |CRMI |ARIO |CROM |ARME |CCIA |CRTM |CRVN |CSAAR|CSZG |CSCY |CSAN |CSFO |CSANG|ASCQ |ASANO|CSEL |ASVQ |CSHA |CSIEN|CSIN |CSITG|CSORR|CSPU |ASTO |ALED |CSXB |CSTRA|CSTRE|CSTR |ASTR1|ASYDN|CBONB|ATPE |AAATL|CTNG |ATAOR|CTAVR|ATNF |CHAG |CTYO |CTOLE|AYTO |CUTL |CTLS |CQTV |CTRS |ATUN |CTRN |CTKU |CUTRE|CVLC |CYVR |AVCE2|AVCE3|AVRN |AVIE |CVILM|CVILO|AWAW |CWAS |CWIND|AYORA|CYORK|CZAG |CLGAS|CZERM|AZRH1|CBOM |CBOMC" );

var gDestCode;
var gDestDesc;
var gRoomText="Room";
var gImgPath="//www.octopustravel.com/rtw/images";
var gCntyText="Where do you live?";
var gCurrText="Show me prices in";
var gCityOption = ""; //new String(onlyCityDesc(gCityOpt));


var gMsg4="Please select a valid date in the range 05 Jun 2006 to 04 Jun 2008";
var gMsg5="The second date of your range cannot be earlier than the first date.";
var gMsg6="The maximum number of passengers allowed is 9. For 10 passengers or more please use the Group Booking Form available when you select the 10 or more People tab above.";
var gMsg6a="To book rooms for additional passengers, please first utilise the Add or Modify Names option from the Basket page.";
var gMsg7="Please specify at least one room type";
var gMsg8="Please specify a room type";
var gMsg9="Please specify a number of rooms";
var gMsg10="Please enter all child ages";
var gMsg11="Please specify a city";
var gMsg12="Cribs cannot be specified for Single Rooms";
var gMsg13="A child age is not required for this room type";
var gMsg14="The maximum number of children allowed is ";
var gMsg15="Sorry, this room type is only available when children are present."+"\n"+ gMsg6a;
var gMsg16="Please select a destination first";
var gMsg17="The second date of your range cannot be the same as the first date.";
var gMsg18="Date range cannot be greater than 90 days apart";

/* Hide/Show options
function ShowExtraOptions(){
     ExtraOptions1.style.display = 'block';
	 ExtraOptions2.style.display = 'block';
	 ExtraOptions3.style.display = 'block';
}
function HideExtraOptions(){
     ExtraOptions1.style.display = 'none';
	 ExtraOptions2.style.display = 'none';
	 ExtraOptions3.style.display = 'none';
}*/

/* Show locations pop-up windows */
function ShowLocationWin() {
    var cityCodeID = document.forms['searchHotels'].cityCode;
	dest = getSelectionValue( cityCodeID );
	if ( cityCodeID.selectedIndex == 0 ) {
		alert("Please select a destination first!");
		cityCodeID.focus();
		return false;
	}
	var destType = dest.substr(0,1);	
	var destCode = escape(trim(dest.substr(1,4)));
    //alert(destCode);
	//return;
   var fullUrl = 'ShowLocation.asp?destType=' + destType+'&destCode=' + destCode;
   //alert(fullUrl);
   //return;
   var opzioni = "width=600,height=600,locationbar=0,menubar=0,personalbar=0,status=0,scrollbars=1,resizable=0";
   window.open(fullUrl,"ViewLocazioni",opzioni);
}

/* Show special events from pop-up windows */
function ShowSpecialEvent(url) {

	var Indice = -1;
	var gLocationName='';
	var dest = document.forms['searchHotels'].city;
	
	for (i=0; (i < dest.length) && (Indice == -1); i++) {
		if (dest[i].checked)
			Indice = i;
	}
	
    if ( dest[dest.length-1].checked ) {
	    var cityCodeID = document.forms['searchHotels'].cityCode;
		dest = getSelectionValue( cityCodeID );
		
		if ( cityCodeID.selectedIndex == 0 ) {
			alert("Please select a destination first!");
			cityCodeID.focus();
			return false;
		}
		gLocationName = cityCodeID.options[cityCodeID.selectedIndex].text;
	}else{
	    dest = eval( "document.forms['searchHotels'].city[" + Indice + "].value"  );
	    gLocationName = eval( "document.forms['searchHotels'].LocationName" + Indice + ".value"  );
	}
	var destType = dest.substr(0,1);
	var destCode = escape(trim(dest.substr(1,4)));
	
	var fromDate = getSelectionValue(document.forms['searchHotels'].yearFrom) + "-" + getSelectionValue(document.forms['searchHotels'].monthFrom) + "-" + getSelectionValue(document.forms['searchHotels'].dayFrom);
	var toDate = getSelectionValue(document.forms['searchHotels'].yearTo) + "-" + getSelectionValue(document.forms['searchHotels'].monthTo) + "-" + getSelectionValue(document.forms['searchHotels'].dayTo);
	
	var fullUrl = url+'?destType='+destType+'&destCode='+destCode+'&fromDate='+escape(fromDate)+'&toDate='+escape(toDate) + '&LocationName=' + gLocationName;
	
	//alert(fullUrl);
	//return;
	
	//return openPopUp(fullUrl,"",900,600);
	window.open(fullUrl, "ViewEvents", "width=650,height=600,locationbar=0,menubar=0,personalbar=0,status=0,scrollbars=1,resizable=0");
}

/* Show special events from pop-up windows -From advanced option window */
function ShowSpecialEvent2(url) {
	var gLocationName='';
    var cityCodeID = document.forms['searchHotels'].cityCode;
	dest = getSelectionValue( cityCodeID );
	if ( cityCodeID.selectedIndex == 0 ) {
		alert("Please select a destination first!");
		cityCodeID.focus();
		return false;
	}
	gLocationName = cityCodeID.options[cityCodeID.selectedIndex].text;
	
	var destType = dest.substr(0,1);
	var destCode = escape(trim(dest.substr(1,4)));
	
	var fromDate = getSelectionValue(document.forms['searchHotels'].yearFrom) + "-" + getSelectionValue(document.forms['searchHotels'].monthFrom) + "-" + getSelectionValue(document.forms['searchHotels'].dayFrom);
	var toDate = getSelectionValue(document.forms['searchHotels'].yearTo) + "-" + getSelectionValue(document.forms['searchHotels'].monthTo) + "-" + getSelectionValue(document.forms['searchHotels'].dayTo);
	
	var fullUrl = url+'?destType='+destType+'&destCode='+destCode+'&fromDate='+escape(fromDate)+'&toDate='+escape(toDate) + '&LocationName=' + gLocationName;
	
	//alert(fullUrl);
	//return;
	
	//return openPopUp(fullUrl,"",900,600);
	window.open(fullUrl, "ViewEvents", "width=650,height=600,locationbar=0,menubar=0,personalbar=0,status=0,scrollbars=1,resizable=0");
}

/* Get more Location from pop-up windows */
function setLocation(locationCode, LocationName) {
	var LocazioneID = document.getElementById('Location');
    
	var i, trovato;
	trovato = false;
    for (i = LocazioneID.length - 1; i>=0 && !trovato; i--) {
	    if (LocazioneID.options[i].value == locationCode) {
	      trovato = true;
	    }
    }
	
	if ( !trovato ){
		var elOptNew = document.createElement('option');
	    elOptNew.text = LocationName;
	    elOptNew.value = locationCode;
	    var elOptOld = LocazioneID.options[LocazioneID.selectedIndex];
	    try {
	      //LocazioneID.add(elOptNew, elOptOld); // standards compliant; doesn't work in IE
		  LocazioneID.add(elOptNew, null); // standards compliant; doesn't work in IE
	    }catch(ex) {
	      //LocazioneID.add(elOptNew, LocazioneID.selectedIndex); // IE only
		  LocazioneID.add(elOptNew); // IE only
	    }
		//window.close();
		LocazioneID.selectedIndex = LocazioneID.length - 1;
		LocazioneID.focus();
		return true;
	}else{
	    LocazioneID.selectedIndex = i+1;
		LocazioneID.focus();
	    return false;
	}
}

function upDateLocations(NumbersOpt){
   var obj = document.getElementById("Location");
   for (i = obj.length - 1; i>NumbersOpt; i--) {
        obj.remove(i);
		obj.selectedIndex = obj.selectedIndex - 1;
   }
   return true;
}

/* Manda i dati ad advanced search */
function goToAdvancedSearch() {

// Set the start and end date:
var fromDate1 = getSelectionValue(document.forms['searchHotels'].yearFrom) + "-" + getSelectionValue(document.forms['searchHotels'].monthFrom) + "-" + getSelectionValue(document.forms['searchHotels'].dayFrom);
var toDate1 = getSelectionValue(document.forms['searchHotels'].yearTo) + "-" + getSelectionValue(document.forms['searchHotels'].monthTo) + "-" + getSelectionValue(document.forms['searchHotels'].dayTo);
document.forms['searchHotels'].fromDate.value = fromDate1;
document.forms['searchHotels'].toDate.value = toDate1;
///////////////// Manfredo Valente! /////////////

    document.forms['searchHotels'].goToSearch.value = "NO";
	document.forms['searchHotels'].submit();
}

function checkBoookHotelForm() {
  if ( ControllaStanze() ){
		// Set the start and end date:
		var fromDate1 = getSelectionValue(document.forms['searchHotels'].yearFrom) + "-" + getSelectionValue(document.forms['searchHotels'].monthFrom) + "-" + getSelectionValue(document.forms['searchHotels'].dayFrom);
		var toDate1 = getSelectionValue(document.forms['searchHotels'].yearTo) + "-" + getSelectionValue(document.forms['searchHotels'].monthTo) + "-" + getSelectionValue(document.forms['searchHotels'].dayTo);
		document.forms['searchHotels'].fromDate.value = fromDate1;
		document.forms['searchHotels'].toDate.value = toDate1;
		//alert( document.forms['searchHotels'].cityName.value );
		//alert( cityName );
		//return;
		document.forms['searchHotels'].submit();
  }
}

function goToSearch() {

	var obj = document.forms['searchHotels'].city;
	var cityName = "", cityCode = "";
	if (obj[obj.length -1].checked && document.forms['searchHotels'].cityCode.selectedIndex == 0 ){
          alert("Select a city!");
		  return;	   
	}else{
      cityName = document.forms['searchHotels'].cityCode.options[document.forms['searchHotels'].cityCode.selectedIndex].text;
	}
	/*
	if (obj[obj.length -1].checked ) {
	   cityCode = getSelectionValue(document.forms['searchHotels'].cityCode);
	   cityName = document.forms['searchHotels'].cityCode.options[document.forms['searchHotels'].cityCode.selectedIndex].text;
	}else{
	   cityCode = "Mikele Conte";
	   cityName = "Manfredo Valente";
	   for (i=0; i < obj.length; i++){
	      if( obj[i].checked ){
			   var valori = gCltCityOpt.split("|");
			   cityCode = obj[i].value;
			   cityName = valori[i];
		  }
	   }
	}*/
	//alert( cityName );
    if ( ControllaStanze() ){

// Set the start and end date:
var fromDate1 = getSelectionValue(document.forms['searchHotels'].yearFrom) + "-" + getSelectionValue(document.forms['searchHotels'].monthFrom) + "-" + getSelectionValue(document.forms['searchHotels'].dayFrom);
var toDate1 = getSelectionValue(document.forms['searchHotels'].yearTo) + "-" + getSelectionValue(document.forms['searchHotels'].monthTo) + "-" + getSelectionValue(document.forms['searchHotels'].dayTo);

document.forms['searchHotels'].fromDate.value = fromDate1;
document.forms['searchHotels'].toDate.value = toDate1;

//alert( document.forms['searchHotels'].cityName.value );
//alert( cityName );
//return;

document.forms['searchHotels'].cityName.value = cityName;
document.forms['searchHotels'].Nomecitta.value = cityName;
//document.forms['searchHotels'].cityCode.value = cityCode;

document.forms['searchHotels'].submit();

///////////////// Manfredo Valente! /////////////
        //document.forms['goToSearchHotels'].Room0.value = document.forms['searchHotels'].Room0.value;
		//document.forms['goToSearchHotels'].Room0Count.value = document.forms['searchHotels'].Room0Count.value;
		//document.forms['goToSearchHotels'].Room0Cots.value = document.forms['searchHotels'].Room0Cots.value;
		//document.forms['goToSearchHotels'].Room0Ages0.value = document.forms['searchHotels'].Room0Ages0.value;
		//document.forms['goToSearchHotels'].Room0Ages1.value = document.forms['searchHotels'].Room0Ages1.value;
		//document.forms['goToSearchHotels'].Room0Ages2.value = document.forms['searchHotels'].Room0Ages2.value;
		
		//document.forms['goToSearchHotels'].Room1.value = document.forms['searchHotels'].Room1.value;
		//document.forms['goToSearchHotels'].Room1Count.value = document.forms['searchHotels'].Room1Count.value;
		//document.forms['goToSearchHotels'].Room1Cots.value = document.forms['searchHotels'].Room1Cots.value;
		//document.forms['goToSearchHotels'].Room1Ages0.value = document.forms['searchHotels'].Room1Ages0.value;
		//document.forms['goToSearchHotels'].Room1Ages1.value = document.forms['searchHotels'].Room1Ages1.value;
		//document.forms['goToSearchHotels'].Room1Ages2.value = document.forms['searchHotels'].Room1Ages2.value;

	    //document.forms['goToSearchHotels'].city.value = cityName;
        //document.forms['goToSearchHotels'].cityCode.value = cityCode;
        //document.forms['goToSearchHotels'].fromDate.value = fromDate1;
		//document.forms['goToSearchHotels'].toDate.value = toDate1;
		//document.forms['goToSearchHotels'].submit();
	}
}

/* This javascript is to hide/show the search boxes */
//////////////////////////////////// Global Variables /////////////////////////////////////////
//var HotelsSearchType = 1;

function HotelsQuickSearch(){
    if ( HotelsSearchType == 1 ) {
	    goToSearch();
	}else{
	    HotelsAdvancedSearchDiv.style.display = 'none';
		ricercaAvanzata.style.display = 'none';
		ricercaSemplice.style.display = 'block';
		HotelsSearchType = 1;
	}
}

function HotelsAdvancedSearch(){
    if ( HotelsSearchType == 2 ) {
       goToSearch();
	}else{
	   HotelsAdvancedSearchDiv.style.display = 'block';
	   ricercaSemplice.style.display = 'none';
	   ricercaAvanzata.style.display = 'block';
	   HotelsSearchType = 2;
	}
}
/******************************************************/

function goToSearchHotels() {
	if ( document.forms['searchHotels'].cityCode.selectedIndex == 0 ){
          alert("Select a city!");
		  return;	   
	}
	var cityName = document.forms['searchHotels'].cityCode.options[document.forms['searchHotels'].cityCode.selectedIndex].text;	
	if ( ControllaStanze() ){
	
// Set the start and end date:
var fromDate1 = getSelectionValue(document.forms['searchHotels'].yearFrom) + "-" + getSelectionValue(document.forms['searchHotels'].monthFrom) + "-" + getSelectionValue(document.forms['searchHotels'].dayFrom);
var toDate1 = getSelectionValue(document.forms['searchHotels'].yearTo) + "-" + getSelectionValue(document.forms['searchHotels'].monthTo) + "-" + getSelectionValue(document.forms['searchHotels'].dayTo);
document.forms['searchHotels'].fromDate.value = fromDate1;
document.forms['searchHotels'].toDate.value = toDate1;

document.forms['searchHotels'].Nomecitta.value = cityName;
document.forms['searchHotels'].city.value = cityName;
///////////////// Manfredo Valente! /////////////

        document.forms['searchHotels'].submit();
	}
}

function GetPersonsRoom(type) {
    if (type==2 || type==4  || type==6 )
	     return 3;
	if (type==1 || type==3)
	     return 2;
	if (type==5 || type==7)
	     return 1;
    if (type==8)
	     return 4;
	return 0;
}

function ControllaStanze() {

    var trovato = false;
	var room;
	var roomLines = getRoomLines();
    var passenger = 0;
	var NumeroStanze, roomsNumber;
	
	//alert("roomLines: " + roomLines);
    //return;
	
    for (i=0; i < roomLines; i++) {
		room = getRoomTypeField(i);
		if (room.selectedIndex > 0){
		   trovato = true;
		   //alert( room.selectedIndex + ": " + room.options[room.selectedIndex].text );
		   NumeroStanze = eval( "document.forms['searchHotels'].Room" + i + "Count" );
		   roomsNumber =  Number(NumeroStanze.options[NumeroStanze.selectedIndex].value);
		   passenger = passenger + GetPersonsRoom(room.selectedIndex) * roomsNumber;
		}
	}
	//alert( passenger );
	//return;
	
	if (!trovato){
	    alert("Please specify at least a room type!");
		return false;
	}
	
	if (passenger > 9){
	    alert("The maximum number of passengers allowed is 9. For 10 passengers or more please use the Group Booking Form available when you select the link: \"OVER 10 PEOPLE OR MORE\".");
		return false;
	}
	
	for (i=0; i < roomLines; i++) {
		room = getRoomTypeField(i);
		if ( room.selectedIndex == 2  || room.selectedIndex == 4 ){
		    
			NumeroStanze = eval( "document.forms['searchHotels'].Room" + i + "Count" );
		    roomsNumber =  Number(NumeroStanze.options[NumeroStanze.selectedIndex].value);
			
		  	for (k=0; k < roomsNumber; k++) {
		  
			     var anni = getRoomAgeField(i,k);
				 if ( anni.selectedIndex == 0){
					    alert("(Room " + (i+1) + ") Please specify the age of child (" + (k+1) + ")!");
				        return false;
				 }
				 
			}
		}
	}
	
	return true;
}

/* Page: Book Hotel */
function goToBasket() {

	if ( ControllaPasseggeri() ){
		if ( ControllaBambini() ){
		    //PleaseWaitHide.style.display = "block";
			//PleaseWaitShow.style.display = "none";
		    document.forms['bookForm'].submit();
		}
	}
}

function goToAddItem(){
	if ( ControllaPasseggeri() ){
	    document.forms['bookForm'].AddItem.value = "YES";
		document.forms['bookForm'].submit();
	}
}

function ControllaPasseggeri() {
    var valore;
	var persona;
	var passengers = document.forms["bookForm"].passengers.value;
	
	for (i=0; i < passengers; i++) {
		persona = eval( 'document.forms["bookForm"].fullName' + i );
		valore = trim(persona.value);
		if ( persona.value.length == 0 ){
		    alert("(Passenger " + (i+1) + ") Please specify the first and last name!");
	        persona.focus();
			return false;
		}else if( valore.indexOf(" ") == -1 ){
            alert("(Passenger " + (i+1) + ") Please specify the last name!");
	        persona.focus();
			return false;
		}
        //alert( persona.value.substring(persona.value.indexOf(" "),persona.value.length) != " " );
	}
	return true;
}

function ControllaBambini() {
    var valore;
	var persona, childAge;
	var passengers = document.forms["bookForm"].children.value;
	
	for (i=0; i < passengers; i++) {
		persona = eval( 'document.forms["bookForm"].child' + i );
		valore = trim(persona.value);
		if ( persona.value.length == 0 ){
		    alert("(Child " + (i+1) + ") Please specify the first and last name!");
	        persona.focus();
			return false;
		}else if( valore.indexOf(" ") == -1 ){
            alert("(Child " + (i+1) + ") Please specify the last name!");
	        persona.focus();
			return false;
		}
		
		ChildAge = eval( 'document.forms["bookForm"].childAge' + i );
		if ( ChildAge.selectedIndex == 0 ){
		    alert("(Child " + (i+1) + ") Please specify the age!");
	        ChildAge.focus();
			return false;
		}
        //alert( persona.value.substring(persona.value.indexOf(" "),persona.value.length) != " " );
	}
	return true;
}

/* Page: HotelChangeNames.asp */
function showPassengerName(obj,n){
    if(obj.checked){
	   eval("document.forms[0].Name" + n + ".style.display = 'block';");
	   eval("document.forms[0].Name" + n + "Ages.style.display = 'block';");
	   eval("document.forms[0].Name" + n + "Sel.style.display = 'none';");
	}else{
	   eval("document.forms[0].Name" + n + ".style.display = 'none';");
	   eval("document.forms[0].Name" + n + "Ages.style.display = 'none';");
	   eval("document.forms[0].Name" + n + "Sel.style.display = 'block';");
	}
}
