/*
this is the portugese teaser.
*/

var domain_link = 'http://www.reservationpage.com';
var mychainid = 'C00203';
var mycombo_2;
var lg = 1;
var date_arr = new Array; var days_arr = new Array; 
date_arr[0]=new Option("January",31); date_arr[1]=new Option("February",28); 
date_arr[2]=new Option("March",31); date_arr[3]=new Option("April",30); 
date_arr[4]=new Option("May",31); date_arr[5]=new Option("June",30); 
date_arr[6]=new Option("July",31); date_arr[7]=new Option("August",30); 
date_arr[8]=new Option("September",30); date_arr[9]=new Option("October",31); 
date_arr[10]=new Option("November",31); date_arr[11]=new Option("December");
date_arr[12]=new Option("January",31); date_arr[13]=new Option("February",28); 
date_arr[14]=new Option("March",31); date_arr[15]=new Option("April",30); 
date_arr[16]=new Option("May",31); date_arr[17]=new Option("June",30); 
date_arr[18]=new Option("July",31); date_arr[19]=new Option("August",30); 
date_arr[20]=new Option("September",30); date_arr[21]=new Option("October",31); 
date_arr[22]=new Option("November",31); date_arr[23]=new Option("December");
var right_now=new Date();

var current_year = right_now.getYear();
if (current_year==106) current_year = 1900 + right_now.getYear();
if (current_year==107) current_year = 1900 + right_now.getYear();
if (current_year==108) current_year = 1900 + right_now.getYear();
if (current_year==109) current_year = 1900 + right_now.getYear();
if (current_year==110) current_year = 1900 + right_now.getYear();

var current_year_2 = current_year + 1
var current_month = right_now.getMonth();
//alert(current_month +' '+ current_year );
function fill_select(f) {
    var y = 0;

    for(x=current_month;x<24;x++) {
       var y; 
       if (x > 11) { current_year = current_year_2 }
	 if (x == 0)  { y = 1 };
	 if (x == 1)  { y = 2 };
	 if (x == 2)  { y = 3 };
	 if (x == 3)  { y = 4 };
	 if (x == 4)  { y = 5 };
	 if (x == 5)  { y = 6 };
	 if (x == 6)  { y = 7 };
	 if (x == 7)  { y = 8 };
	 if (x == 8)  { y = 9 };
	 if (x == 9)  { y = 10 };
	 if (x == 10)  { y = 11 };
	 if (x == 11)  { y = 12 };
	 if (x == 12)  { y = 1 };
	 if (x == 13)  { y = 2 };
	 if (x == 14)  { y = 3 };
	 if (x == 15)  { y = 4 };
	 if (x == 16)  { y = 5 };
	 if (x == 17)  { y = 6 };
	 if (x == 18)  { y = 7 };
	 if (x == 19)  { y = 8 };
	 if (x == 20)  { y = 9 };
	 if (x == 21)  { y = 10 };
	 if (x == 22)  { y = 11 };
	 if (x == 23)  { y = 12 };

       document.writeln("<OPTION value=\""+y+' '+current_year+"\">"+date_arr[x].text+' '+current_year+"</"+"OPTION>");
    }

    
}


function start_cal() {
    fill_select(document.Form1);
}
/*****************************************************************/


function validate() {

	
var item_one = document.getElementById('combo_0').value;
var item_two = document.getElementById('combo_1').value;
var item_three = document.getElementById('combo_2').value;

//Country
if (document.getElementById('combo_0').value =="") { 
	alert('Missing Country') 
};

//City
if (document.getElementById('combo_1').value =="") { 
	alert('Missing City') 
};

//Hotel
if (document.getElementById('combo_2').value =="") { 
	alert('Missing Hotel') 
};

//Day
if (document.getElementById('day1').value =="") { 
	alert('Missing Number of Days') 
};

//Nights
if (document.getElementById('nightstay').value =="") { 
	alert('Missing Number of Nights') 
};
//Adults
if (document.getElementById('adults').value =="") { 
	alert('Missing Number of Adults') 
};

//send hotel ID, month, year, adults(1), children(0)
//alert("Combo One:" + item_one + "\nCombo Two:" +  item_two + "\nCombo Three:" + item_three);

	
	var mycombo_2;	
	var lg, language, promo;
	

	if (document.getElementById('monthyear1').value == '3 2005') {alert('Missing Month/Year')};
	if (document.getElementById('day1').value == '0') {alert('Missing Day')};
	if (document.getElementById('nightstay').value == '0') {alert('Missing Number of Nights')};
	if (document.getElementById('combo_2').value == '0') {alert('Missing Hotel Selection')};

	

	if ((document.getElementById('monthyear1').value !== '3 2005') && (document.getElementById('day1').value !== '0') && (document.getElementById('nightstay').value !== '0') && (document.getElementById('combo_2').value !== '0')) {

		mycombo_2 = document.getElementById('combo_2').value;
		var my = document.getElementById('monthyear1').value;
		var dy = document.getElementById('day1').value;
		var ns = document.getElementById('nightstay').value;
		var ad = document.getElementById('adults').value;
		var ch = document.getElementById('child').value;

		var lg = "";
		if (document.getElementById('lg')) {lg = document.getElementById('lg').value};
		var pc = "";
		if (document.getElementById('pc')) {pc = document.getElementById('pc').value};
		var newlink = domain_link+'/'+ mychainid+'/'+mycombo_2+'/pickdateteaser.aspx?date1='+my+'&nightstay='+ns+'&day1='+dy+'&ddadults='+ad+'&ddchildren='+ch+'&lg='+lg;
		//alert(my +'\n'+ dy);
		window.location.href = newlink;
	}

}
<!--
// first combo box //countries

	data_1 = new Option("1", "$");
	data_2 = new Option("2", "$$");
	data_3 = new Option("3", "$$$");
	data_4 = new Option("4", "$$$$");
	data_5 = new Option("5", "$$$$$");
	data_6 = new Option("6", "$$$$$$");
	
// second combo box  //cities
	//data_1_1 = new Option("Buenos Aires", "*");
	data_1_1 = new Option("Amparo", "--");
	data_1_2 = new Option("Belo Horizonte", "--");
	data_1_3 = new Option("Blumenau", "--");
	data_1_4 = new Option("Bzios", "--");
	data_1_5 = new Option("Caldas Imperatriz", "--");
	//data_1_6 = new Option("Cambori", "--");
	data_1_6 = new Option("Fortaleza", "--");
	data_1_7 = new Option("Florianpolis", "--");
	data_1_8 = new Option("Franca", "--");
	data_1_9 = new Option("Itapema", "--");
	data_1_10 = new Option("Joo Pessoa", "--");
	data_1_11 = new Option("Maca", "--");
	data_1_12 = new Option("Paraty", "--");
	data_1_13 = new Option("Petrpolis", "--");
	data_1_14 = new Option("Porto Alegre", "--");
	data_1_15 = new Option("Ribeiro Preto ", "--");
	data_1_16 = new Option("Rio de Janeiro", "--");
	data_1_17 = new Option("Salvador", "--");
	data_1_18 = new Option("So Jos dos Campos", "--");
	data_1_19 = new Option("So Paulo", "--");
	data_2_1 = new Option("Paris", "--");
	data_3_1 = new Option("Lima", "--");
	data_4_1 = new Option("Lisbon", "--");
	data_5_1 = new Option("San Francisco", "--");
	
// third combo box   //combo_2
	
	//data_1_1_1 = new Option("Claridge Hotel", "H00262");
	
	data_1_1_1 = new Option("Canto da Floresta Othon Resort", "H00816");
	data_1_1_2 = new Option("Spa Sant'Anna Othon Resort", "H00817");
	data_1_2_1 = new Option("Belo Horizonte Othon Palace", "H00611");
	data_1_3_1 = new Option("Plaza Blumenau", "H00718");
	data_1_4_1 = new Option("Colonna Park Othon Classic", "H00621");
	data_1_4_2 = new Option("Colonna Beach Othon Travel", "H00633");
	data_1_5_1 = new Option("Plaza Caldas de Imperatriz", "H00720");
	//data_1_6_1 = new Option("Cambori Othon Classic", "H00802");
	data_1_6_1 = new Option("Othon Palace Fortaleza", "H00694");
	data_1_6_2 = new Option("Iracema Othon Travel", "H00635");
	data_1_7_1 = new Option("Bahia Norte Othon Classic", "H00819");
	data_1_8_1 = new Option("Nena Suite Othon Classic", "H00623");
	data_1_9_1 = new Option("Plaza Itapema", "H00722");
	data_1_10_1 = new Option("Atlntico Praia Othon Travel", "H00866");
	data_1_11_1 = new Option("Maca Othon Suites", "H00994");
	data_1_12_1 = new Option("Othon Pousada Villa Del Sol", "H00641");
	data_1_13_1 = new Option("Othon Pousada Riverside Park", "H00640");
	//data_1_14_2 = new Option("Solar do Imperio Othon Classic", "H00796");
	data_1_14_1 = new Option("Plaza Porto Alegre", "H00716");
	data_1_14_2 = new Option("Plaza So Rafael", "H00714");
	data_1_15_1 = new Option("Osis Othon Classic", "H00624");
	
	data_1_16_1 = new Option("Rio Othon Palace", "H00616");
	data_1_16_2 = new Option("Leme Othon Palace", "H00614");
	data_1_16_3 = new Option("Califrnia Othon Classic", "H00620");
	data_1_16_4 = new Option("Olinda Othon Classic", "H00625");
	data_1_16_5 = new Option("Aeroporto Othon Travel", "H00632");
	data_1_16_6 = new Option("Lancaster Othon Travel", "H00636");
	data_1_16_7 = new Option("Savoy Othon Travel", "H00638");
	//data_1_17_8 = new Option("Trocadero Othon Travel", "H00288");
	data_1_17_1 = new Option("Bahia Othon Palace", "H00610");
	data_1_17_2 = new Option("Bahia Plaza Resort", "H01013");
	data_1_18_1 = new Option("Intervale Othon Travel", "H00634");
	data_1_19_1 = new Option("So Paulo Othon Classic", "H00630");
	//data_1_20_2 = new Option("Bienal Othon Flat", "H00290");
	data_1_19_2 = new Option("Le Premier Othon Flat", "H00645");
	data_1_19_3 = new Option("London Othon Flat", "H00643");
	data_1_19_4 = new Option("The Time Paulo Othon Flat", "H00644");
	
	data_2_1_1 = new Option("Waldorf Madeleine Othon Palace", "H00617");
	data_2_1_2 = new Option("Waldorf Trocadero Othon Palace", "H00268");
	data_2_1_3 = new Option("Accias St. Germain Othon Classic ", "H00619");
	//data_2_1_4 = new Option("Renoir Othon Classic", "H00277");
	//data_2_1_5 = new Option("Rochambeau Othon Classic ", "H00278");
	//data_2_1_6 = new Option("Unic Othon Classic", "H00280");
	
	data_3_1_1 = new Option("Hotel del Pilar Miraflores Othon Classic", "H00622");
	
	data_4_1_1 = new Option("Olissipo Castelo Othon Palace", "H00615");
	data_4_1_2 = new Option("Olissippo Marques de S Othon Classic", "H00626");
	data_4_1_3 = new Option("Olissipo Oriente Othon Palace ", "H00733");
	data_5_1_1 = new Option("Renoir Othon Classic", "H00628");
	
// other parameters

    displaywhenempty=""
    valuewhenempty=-1

    displaywhennotempty="Select"
    valuewhennotempty=0


function change(currentbox) {
	numb = currentbox.id.split("_");
	currentbox = numb[1];

    i=parseInt(currentbox)+1

// I empty all combo boxes following the current one

    while ((eval("typeof(document.getElementById(\"combo_"+i+"\"))!='undefined'")) &&
           (document.getElementById("combo_"+i)!=null)) {
         son = document.getElementById("combo_"+i);
	     // I empty all options except the first one (it isn't allowed)
	     for (m=son.options.length-1;m>0;m--) son.options[m]=null;
	     // I reset the first option
	     son.options[0]=new Option(displaywhenempty,valuewhenempty)
	     i=i+1
    }


// now I create the string with the "base" name ("stringa"), ie. "data_1_0"
// to which I'll add _0,_1,_2,_3 etc to obtain the name of the combo box to fill

    stringa='data'
    i=0
    while ((eval("typeof(document.getElementById(\"combo_"+i+"\"))!='undefined'")) &&
           (document.getElementById("combo_"+i)!=null)) {
           eval("stringa=stringa+'_'+document.getElementById(\"combo_"+i+"\").selectedIndex")
           if (i==currentbox) break;
           i=i+1
    }


// filling the "son" combo (if exists)

    following=parseInt(currentbox)+1

    if ((eval("typeof(document.getElementById(\"combo_"+following+"\"))!='undefined'")) &&
       (document.getElementById("combo_"+following)!=null)) {
       son = document.getElementById("combo_"+following);
       stringa=stringa+"_"
       i=0
       while ((eval("typeof("+stringa+i+")!='undefined'")) || (i==0)) {

       // if there are no options, I empty the first option of the "son" combo
	   // otherwise I put "Select" in it

	   	  if ((i==0) && eval("typeof("+stringa+"0)=='undefined'"))
	   	      if (eval("typeof("+stringa+"1)=='undefined'"))
	   	         eval("son.options[0]=new Option(displaywhenempty,valuewhenempty)")
	   	      else
	             eval("son.options[0]=new Option(displaywhennotempty,valuewhennotempty)")
	      else
              eval("son.options["+i+"]=new Option("+stringa+i+".text,"+stringa+i+".value)")
	      i=i+1
	   }
       //son.focus()
       i=1
       combostatus=''
       cstatus=stringa.split("_")
       while (cstatus[i]!=null) {
          combostatus=combostatus+cstatus[i]
          i=i+1
          }
       return combostatus;
    }
}

