function removeAirfare(){
	//alert('Remove Airfare');
	var a = document.getElementById('ctl00_cph1_Inc_iq1_airport');
	var s = document.getElementById('ctl00_cph1_Inc_iq1_waiting');
	if (document.getElementById('ctl00_cph1_selectedHotel')){
		var h = document.getElementById('ctl00_cph1_selectedHotel').value;
		//var hc = document.getElementById('ctl00_cph1_Inc_iq1_resort')
		
		//for (ic = 0; ic < hc.length; ic++) { 
		//	if (hc.options[ic].value == h) {
		//		//alert(h);
		//		hc.options[ic].selected = true;
		//	}
		//}

	}

	a.selectedIndex = 0;
	
	if (validateQuoteControl){
		WebForm_DoPostBackWithOptions(new WebForm_PostBackOptions("ctl00$cph1$Inc_iq1$waiting", "", false, "", "WaitingStep1.aspx", false, true));
	}
	else{alert('Please provide missing information!');}
}

function AgeInput(childAge) {
	if (childAge.selectedIndex > 0){
		document.getElementById('validateChildAges').style.display = 'none';}
}

function ShowMetheText() {	
	var fDate = document.getElementById('ctl00_cph1_Inc_iq1_date_input1').value ;
	var fdays = document.getElementById('ctl00_cph1_Inc_iq1_days').value ;
	var displayTravelDates = document.getElementById('displayTravelDates');
	var displayValidateDepartureDate = document.getElementById('validateDepartureDate');
	
	var b = isDate(fDate);
	var errorText = '';
	var s = 0;

	if (b) {
		d = dateDiff('d', Date(), fDate, 1, 1);
		
		if (d < 0) {s = 1;}
		if (d < 2 && d >= 0) {s = 2;}
		if (d > 331) {s = 3;}

		switch (s) {
			case 1:
			//In the past (< today)
			errorText = 'Date must be in the future!';
			break;
			case 2:
			//Too short (today -> today + 3)
			errorText = 'Date must be atleast 3 days away.';
			break;
			case 3:
			//Too Far (today + 331)
			errorText = 'Date can not be more than 331 days away.';
			break;
		}
	}

	if (b && s > 0) {
		displayTravelDates.style.display = 'none';
		displayValidateDepartureDate.innerHTML = errorText;
		displayValidateDepartureDate.style.display = 'inline';
	}
	else if (!b) {
		displayTravelDates.style.display = 'none';
		displayValidateDepartureDate.innerHTML = 'Enter a valid Date!';
		displayValidateDepartureDate.style.display = 'inline';
	}		
	else{
		if(s == 0 && b) {
			var endDate = new Date();
			fDate = new Date(fDate);
			fdays = new Number(fdays);
			endDate = dateAdd2("d" , fdays, fDate);
	
			var Returning;
			Returning =  'Returning: ' + weekdayName(endDate) + ' ' + monthName(endDate) + ' ' + datePart('d' ,endDate) + ', ' + datePart('yyyy' ,endDate) ;
			var Departing;
			Departing =  'Departing: ' + weekdayName(fDate) + ' ' + monthName(fDate) + ' ' + datePart('d' ,fDate) + ', ' + datePart('yyyy' ,fDate) ;
			
			displayTravelDates.innerHTML =  Departing + '<br />' + Returning ;
			//displayTravelDates.style.display = 'inline';
		}
	}
}

function isFutureDate(fdate){
	var today = new Date();
	var depart = new Date(fdate);
	if(depart < today){return false;}
	else{return true;}
}

function checkAges() {
        /*if(document.getElementById("ctl00_cph1_Inc_iq1_child41").selectedIndex!=0){
           document.getElementById("ctl00_cph1_Inc_iq1_child41").style.visibility='';
           document.getElementById("ctl00_cph1_Inc_iq1_child31").style.visibility='';
           document.getElementById("ctl00_cph1_Inc_iq1_child21").style.visibility='';
           document.getElementById("ctl00_cph1_Inc_iq1_child11").style.visibility='';
        }
        else*/ if(document.getElementById("ctl00_cph1_Inc_iq1_child31").selectedIndex!=0){
            document.getElementById("ctl00_cph1_Inc_iq1_child31").style.visibility='';
            document.getElementById("ctl00_cph1_Inc_iq1_child21").style.visibility='';
            document.getElementById("ctl00_cph1_Inc_iq1_child11").style.visibility='';
        }
        else if(document.getElementById("ctl00_cph1_Inc_iq1_child21").selectedIndex!=0){
            document.getElementById("ctl00_cph1_Inc_iq1_child21").style.visibility='';
            document.getElementById("ctl00_cph1_Inc_iq1_child11").style.visibility='';
        }
        else if(document.getElementById("ctl00_cph1_Inc_iq1_child11").selectedIndex!=0){
            document.getElementById("ctl00_cph1_Inc_iq1_child11").style.visibility='';
        }

}
    
function changeChildren(){
	var CountAdult1, MaxChildren, NChildren1, i, childID;
	var divAges = document.getElementById("ctl00_cph1_Inc_iq1_ages");
        divAges.style.display='none';

	CountAdult1 = parseInt(document.getElementById("ctl00_cph1_Inc_iq1_count_adult").value, 10);
	if(CountAdult1==NaN){
		CountAdult1 = 0;
	}
	
	MaxChildren = parseInt(7 - CountAdult1);
	if(MaxChildren > 4){MaxChildren = 4;}
	if(CountAdult1==1){MaxChildren=2}

	NChildren1 = document.getElementById("ctl00_cph1_Inc_iq1_childrenNum");
        
        for (var count = NChildren1.options.length-1; count >-1; count--){
	    NChildren1.options[count] = null;
	}
	
	if(CountAdult1<6){    
		for (var count = 0; count < MaxChildren + 1; count++){
			if (CountAdult1 == 1 && count == 4){break;}
			optionItem = new Option(count, count,  false, false);
			NChildren1.options[NChildren1.length] = optionItem;
		}
	}
	else{
		optionItem = new Option(0, 0,  false, false);
		NChildren1.options[0] = optionItem;
        }
	    
	//hiding first room children's ages based on # of adults in the room
	for (i=3;i>MaxChildren;i--){
	        childID = 'ctl00_cph1_Inc_iq1_child' + i + '1';
            	document.getElementById(childID).style.visibility='';
            	document.getElementById(childID).style.visibility='hidden';
            	document.getElementById(childID).selectedIndex=0;
	}
	//changeRooms();
}
	
function addChildren(){
        var NumOfChildren1;
        NumOfChildren1 = document.getElementById("ctl00_cph1_Inc_iq1_childrenNum").value;
	var divAges = document.getElementById("ctl00_cph1_Inc_iq1_ages");
        
        switch (NumOfChildren1)
        {
            case "1":
                        document.getElementById("ctl00_cph1_Inc_iq1_child11").style.visibility='visible';
			document.getElementById("ctl00_cph1_Inc_iq1_child21").selectedIndex=0;
                        document.getElementById("ctl00_cph1_Inc_iq1_child21").style.visibility='hidden';
			document.getElementById("ctl00_cph1_Inc_iq1_child31").selectedIndex=0;
                        document.getElementById("ctl00_cph1_Inc_iq1_child31").style.visibility='hidden';
			//document.getElementById("ctl00_cph1_Inc_iq1_child41").selectedIndex=0;
                      //  document.getElementById("ctl00_cph1_Inc_iq1_child41").style.visibility='hidden';
                        divAges.style.display='inline';
                        break;
            case "2":
                        document.getElementById("ctl00_cph1_Inc_iq1_child11").style.visibility='visible';
                        document.getElementById("ctl00_cph1_Inc_iq1_child21").style.visibility='visible';
			document.getElementById("ctl00_cph1_Inc_iq1_child31").selectedIndex=0;
                        document.getElementById("ctl00_cph1_Inc_iq1_child31").style.visibility='hidden';
			//document.getElementById("ctl00_cph1_Inc_iq1_child41").selectedIndex=0;
                        //document.getElementById("ctl00_cph1_Inc_iq1_child41").style.visibility='hidden';
                        divAges.style.display='inline';
                        break;
            case "3":
                        document.getElementById("ctl00_cph1_Inc_iq1_child11").style.visibility='visible';
                        document.getElementById("ctl00_cph1_Inc_iq1_child21").style.visibility='visible';
                        document.getElementById("ctl00_cph1_Inc_iq1_child31").style.visibility='visible';
			//document.getElementById("ctl00_cph1_Inc_iq1_child41").selectedIndex=0;
                        //document.getElementById("ctl00_cph1_Inc_iq1_child41").style.visibility='hidden';
                        divAges.style.display='inline';
                        break;
	    case "4":
                        document.getElementById("ctl00_cph1_Inc_iq1_child11").style.visibility='visible';
                        document.getElementById("ctl00_cph1_Inc_iq1_child21").style.visibility='visible';
                        document.getElementById("ctl00_cph1_Inc_iq1_child31").style.visibility='visible';
                        //document.getElementById("ctl00_cph1_Inc_iq1_child41").style.visibility='visible';
                        divAges.style.display='inline';
                        break;
            default:
                        document.getElementById("ctl00_cph1_Inc_iq1_child11").selectedIndex=0;
                        document.getElementById("ctl00_cph1_Inc_iq1_child11").style.visibility='hidden';
                        document.getElementById("ctl00_cph1_Inc_iq1_child21").selectedIndex=0;
                        document.getElementById("ctl00_cph1_Inc_iq1_child21").style.visibility='hidden';
                        document.getElementById("ctl00_cph1_Inc_iq1_child31").selectedIndex=0;
                        document.getElementById("ctl00_cph1_Inc_iq1_child31").style.visibility='hidden';
			//document.getElementById("ctl00_cph1_Inc_iq1_child41").selectedIndex=0;
                        //document.getElementById("ctl00_cph1_Inc_iq1_child41").style.visibility='hidden';
                        divAges.style.display='none';
                        //document.getElementById("validateChildAges").style.display='none';
                        break;
        }
	//changeRooms();

}

function changeRooms(){
	var numAdults = parseInt(document.getElementById("ctl00_cph1_Inc_iq1_count_adult").value);
	var numChildren = parseInt(document.getElementById("ctl00_cph1_Inc_iq1_childrenNum").value);
	var numRooms = document.getElementById("ctl00_cph1_Inc_iq1_roomNum");
   
        for (var count = numRooms.options.length-1; count >-1; count--){
	    numRooms.options[count] = null;
	}

	if (numAdults == 1) {
	//1 room
		optionItem = new Option(1, 1,  false, false);
		numRooms.options[0] = optionItem;
	}
	else{
		if (numAdults > 5 || (numChildren > 0 && (numAdults + numChildren) > 5) || numChildren > 2) {
		//alert('> 5 Adults Or > 2 Children');
		//2 rooms
			optionItem = new Option(2, 2,  false, false);
			numRooms.options[0] = optionItem;
		}
		else{
		//alert('All others');
		// 1 or 2 rooms
			for (var count = 0; count < 2; count++){
				optionItem = new Option(count+1, count+1,  false, false);
				numRooms.options[numRooms.length] = optionItem;
			}
		}
	}
	
}
