// JavaScript Document





//Language and currency



function changeSettings() {

var params = "cid=165272";

var urlQ = "http://travel.hotels-and-discounts.com/index.jsp?pageName=hotSearch&cid=165272&localeSelect=true&locale=";

if(document.webslocales.nnLocaleLanguage.value.length > 0) {

urlQ += document.webslocales.nnLocaleLanguage.value;

} else {

urlQ += document.webslocales.localeLanguage.value;

}

urlQ += "_" + document.webslocales.localeCountry.value;

document.webslocales.nnLocaleLanguage.value = "";

if (params.length > 0) {

urlQ += "&" + params;

}

document.webslocales.action = urlQ

document.webslocales.submit();

}





var multiLangLocales = new Array();

multiLangLocales["US"] = new Array("en", "es");

multiLangLocales["AT"] = new Array("de");

multiLangLocales["BE"] = new Array("da", "fr", "de", "en");

multiLangLocales["CA"] = new Array("en", "fr");

multiLangLocales["DK"] = new Array("da");

multiLangLocales["FR"] = new Array("fr");

multiLangLocales["DE"] = new Array("de");

multiLangLocales["UK"] = new Array("en");

multiLangLocales["IE"] = new Array("en");

multiLangLocales["IT"] = new Array("it");

multiLangLocales["NL"] = new Array("nl");

multiLangLocales["NO"] = new Array("no");

multiLangLocales["ES"] = new Array("es");

multiLangLocales["SE"] = new Array("se");

multiLangLocales["CH"] = new Array("de", "it", "fr", "en");

function countryChanged(popup) {

var countryCode = popup.options[popup.selectedIndex].value;

if (multiLangLocales[countryCode] != null && multiLangLocales[countryCode].length > 0) {

webslocales.localeLanguage.options.length = 0;

var langOptions = multiLangLocales[countryCode];

for (var i = 0; i < langOptions.length; i++) {

var opt = new Option();

opt.value = langOptions[i];

opt.text = document.forms['hform'].elements(langOptions[i]).value;

//opt.text = langNameMap[langOptions[i]];

webslocales.localeLanguage.options[webslocales.localeLanguage.length] = opt;

}

if (multiLangLocales[countryCode].length > 1) {

languagePopup.style.visibility='visible';

languagePopup.style.display='block';

} else {

languagePopup.style.visibility='hidden';

languagePopup.style.display='none';

}

} else {

languagePopup.style.visibility='hidden';

languagePopup.style.display='none';

}

}



// end language and currency







// search engine



		function showcity1(){

		city1.style.visibility='visible';

		city1.style.display='block';

		tcity1.style.backgroundImage='url("images/ytop_over.gif")';

		hidemaps1();

		hidehotel1();

		hidevacation1();

		hidecar1();

		hideair1();

		}

		

		function showmaps1(){

		maps1.style.visibility='visible';

		maps1.style.display='block';

		tmaps1.style.backgroundImage='url("images/ztop_over.gif")';

		hidecity1();

		hidehotel1();

		hidevacation1();

		hidecar1();

		hideair1();

		}

		

		function showhotel1(){

		hotel1.style.visibility='visible';

		hotel1.style.display='block';

		thotel1.style.backgroundImage='url("images/ytop_over.gif")';

		hidecity1();

		hidemaps1();

		hidevacation();

		hidecar();

		hideair();

		}

		

		function showvacation1(){

		vacation1.style.visibility='visible';

		vacation1.style.display='block';

		tvacation1.style.backgroundImage='url("images/gtop_over.gif")';

		hidecity1();

		hidemaps1();

		hidehotel1();

		hidecar1();

		hideair1();

		loadDates2();

		}

		

		function showcar1(){

		car1.style.visibility='visible';

		car1.style.display='block';

		tcar1.style.backgroundImage='url("images/ztop_over.gif")';

		hidecity1();

		hidemaps1();

		hidehotel1();

		hidevacation1();

		hideair1();

		}	

		

		function showair1(){

		air1.style.visibility='visible';

		air1.style.display='block';

		tair1.style.backgroundImage='url("images/ztop_over.gif")';

		hidecity1();

		hidemaps1();

		hidehotel1();

		hidevacation1();

		hidecar1();

		}

		

		function hidecity1(){

		city1.style.display='none';

		city1.style.visibility='hidden';

		tcity1.style.backgroundImage='url("images/ytop.gif")';

		}

		

		function hidemaps1(){

		maps1.style.display='none';

		maps1.style.visibility='hidden';

		tmaps1.style.backgroundImage='url("images/ztop.gif")';

		}

		

		function hidehotel1(){

		hotel1.style.display='none';

		hotel1.style.visibility='hidden';

		thotel1.style.backgroundImage='url("images/ytop.gif")';

		}

		

		function hidevacation1(){

		vacation1.style.display='none';

		vacation1.style.visibility='hidden';

		tvacation1.style.backgroundImage='url("images/gtop.gif")';

		}

		

		function hidecar1(){

		car1.style.display='none';

		car1.style.visibility='hidden';

		tcar1.style.backgroundImage='url("images/ztop.gif")';

		}

		

		function hideair1(){

		air1.style.display='none';

		air1.style.visibility='hidden';

		tair1.style.backgroundImage='url("images/ztop.gif")';

		}













		function showhotel(){

		hotel.style.visibility='visible';

		hotel.style.display='block';

		thotel.style.backgroundImage='url("images/btop_over.gif")';

		hidevacation();

		hidecar();

		hideair();

		}

		

		function showvacation(){

		vacation.style.visibility='visible';

		vacation.style.display='block';

		tvacation.style.backgroundImage='url("images/gtop_over.gif")';

		hidehotel();

		hidecar();

		hideair();

		loadDates2();

		}

		

		function showcar(){

		car.style.visibility='visible';

		car.style.display='block';

		tcar.style.backgroundImage='url("images/rtop_over.gif")';

		hidehotel();

		hidevacation();

		hideair();

		}	

		

		function showair(){

		air.style.visibility='visible';

		air.style.display='block';

		tair.style.backgroundImage='url("images/ytop_over.gif")';

		hidehotel();

		hidevacation();

		hidecar();

		}

		

		function hidehotel(){

		hotel.style.display='none';

		hotel.style.visibility='hidden';

		thotel.style.backgroundImage='url("images/btop.gif")';

		}

		

		function hidevacation(){

		vacation.style.display='none';

		vacation.style.visibility='hidden';

		tvacation.style.backgroundImage='url("images/gtop.gif")';

		}

		

		function hidecar(){

		car.style.display='none';

		car.style.visibility='hidden';

		tcar.style.backgroundImage='url("images/rtop.gif")';

		}

		

		function hideair(){

		air.style.display='none';

		air.style.visibility='hidden';

		tair.style.backgroundImage='url("images/ytop.gif")';

		}

		

		

  function loadDates()

  {

	var calendar = new Date();

	var calendar2 = new Date();

	var cal

	var cal2

	var date;

	var month;

	var year;

	var date2;

	var month2;

	var year2;



	//Here is the variable to change for to advance the arrival Date

	 var advanceArrival = 21;



	//Here is the variable to change for to advance the departure Date

	 var advanceDeparture = 23;



	//Set the arrival Days

	calendar.setDate(calendar.getDate()+ advanceArrival);

	date = calendar.getDate();

	month = calendar.getMonth();	



	//Set the Departure Days

	calendar2.setDate(calendar2.getDate()+advanceDeparture);

	date2 = calendar2.getDate();

	month2 = calendar2.getMonth();	



	document.forms['frm_Search'].arrivalMonth.value=month;

	document.forms['frm_Search'].arrivalDay.value=date;

	document.forms['frm_Search'].departureMonth.value=month2;

	document.forms['frm_Search'].departureDay.value=date2;

  }



  function loadDates2()

  {

	var calendar = new Date();

	var calendar2 = new Date();

	var cal

	var cal2

	var date;

	var month;

	var year;

	var date2;

	var month2;

	var year2;	



	//Here is the variable to change for to advance the arrival Date

	 var advanceArrival = 21; 



	//Here is the variable to change for to advance the departure Date

	 var advanceDeparture = 23;	



	//Set the arrival Days

	calendar.setDate(calendar.getDate()+ advanceArrival);

	date = calendar.getDate();

	month = calendar.getMonth();	



	//Set the Departure Days

	calendar2.setDate(calendar2.getDate()+advanceDeparture); 

	date2 = calendar2.getDate();

	month2 = calendar2.getMonth();	



	document.forms['frm_Search2'].arrivalMonth.value=month;

	document.forms['frm_Search2'].arrivalDay.value=date;

	document.forms['frm_Search2'].departureMonth.value=month2;

	document.forms['frm_Search2'].departureDay.value=date2;

  }



  function openCondoWindow(file,input) {

        window.open(file, input,'width=300,height=540,resizable=1');

  }

  

  

  function setCondos(searchCondos){

	if(searchCondos == true){

		document.forms['frm_Search'].isHotels.value = false;

		document.forms['frm_Search'].isCondos.value = true;

	}else if(searchCondos == false){

		document.forms['frm_Search'].isHotels.value = true;

		document.forms['frm_Search'].isCondos.value = false;

	}

  }



  function OpenDates(file,input) {

	window.open(file, input, 'width=300,height=300,resizable=1');

  }



  function OpenCalendar(dayField, day, monthField, month, yearField, year)

  {

    file = '/util/calendar.jsp?formName=frm_Search';

    if ( dayField != null )

      file += '&dayField=' + dayField + '&day=' + day;

    if ( monthField != null )

      file += '&monthField=' + monthField + '&month=' + month;

    if ( yearField != null )

      file += '&yearField=' + yearField + '&year=' + year;

    window.open( file, "dates", 'width=300,height=300,resizable=1');

  }



  // Checks if browser is Netscape 2.0x since the options array properties don't work with Netscape 2.0x



  function isBrowserSupp() {



	// Get the version of the browser

	version =  parseFloat( navigator.appVersion );

	if ( ( version >= 2.0 ) && ( version < 2.1 ) && ( navigator.appName.indexOf( "Netscape" ) != -1 ) ) {

		return false;

	} else {

		return true;

	}

	return true;

  }



  function isLeapYear(yrStr){

	var leapYear=false;

	var year = parseInt(yrStr, 10);



	// every fourth year is a leap year

	if (year%4 == 0){

	leapYear=true;



	// unless it's a multiple of 100

	if (year%100 == 0)

	{

		leapYear=false;



		// unless it's a multiple of 400

		if (year%400 == 0){

			leapYear=true;

		}

	}

	}

	return leapYear;

  }



  function getDaysInMonth(mthIdx, YrStr)

  {

	// all the rest have 31

	var maxDays=31



	// expect Feb. (of course)

	if (mthIdx==1){

		if (isLeapYear(YrStr)){

			maxDays=29;

		} else {

			maxDays=28;

		}

	}



	// thirty days hath...

	if (mthIdx==3 || mthIdx==5 || mthIdx==8 || mthIdx==10){

		maxDays=30;

	}

	return maxDays;

  }



  //the function which does some magic to the date fields



  // return non-zero if it is the last day of the month



  function adjustDate(mthIdx, Dt){

	var value=0;

	var today = new Date()

	var theYear = parseInt(today.getYear(),10)



	if (mthIdx < today.getMonth()) {

		theYear = (parseInt(today.getYear(), 10) + 1)

	}



	if(theYear<100){

		theYear = "19" + theYear

	} else {

		

		if((theYear-100) < 10){

			theYear = "0" + (theYear-100)

		} else {

			theYear = (theYear-100)+""

		}



		theYear = "20" + theYear

	}



	var numDays=getDaysInMonth(mthIdx, theYear);



	if (mthIdx==1){

		if (Dt.options.selectedIndex + 1 < numDays){

			return 0;

		} else {

			Dt.options.selectedIndex=numDays - 1;



			//check for leap year

			if (numDays==29){

				return 99;

			} else {

				return 1;

			}

		}

	}



	if (Dt.options.selectedIndex + 1 < numDays){

		value=0;

	} else {



		if (Dt.options.selectedIndex + 1 > numDays){

			Dt.options.selectedIndex--;

			value=3;

		} else {

			//index is 31 or 30

			value=2;

		}

	}

	return value;

  }



  //changes departure month when arrival month is changed



  function amadChange(inM,inD,outM,outD){



	if (!isBrowserSupp()){

		return;

	}



	var res = adjustDate(inM.options.selectedIndex, inD);

	if (res != 0){

		outD.options.selectedIndex=0;

		if (outM.options.selectedIndex==11){

			outM.options.selectedIndex=0

		} else {

			outM.options.selectedIndex=inM.options.selectedIndex + 1;

		}

	} else {

		outM.options.selectedIndex = inM.options.selectedIndex;

		outD.options.selectedIndex = inD.options.selectedIndex+1;

	}

	return;



  }



  function dmddChange(outM,outD){

	if (!isBrowserSupp()){

		return;

	}

	adjustDate(outM.options.selectedIndex,outD);

	return;

  }



  function validateAir(){

	alert

	if(document.forms['AvailRequester'].destinationCity.value == "Orlando, FL, US"){

		window.document.forms['AvailRequester'].destinationCity.value='MCO';

	}

  }

  

  

function MM_openBrWindow(theURL,winName,features) { //v2.0



  window.open(theURL,winName,features);



}





function MM_preloadImages() { //v3.0

  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();

    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)

    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}

}

  