﻿function ShowHideRoomsResults(idlink,inholder,val)
		{
	        var tdroomview = inholder.toString().split('_')[0]+"_toggle_appear";//"_ctl00_tbRoomView";
	        var tdroomview2 = inholder.toString().split('_')[0]+"_ctl01_tbRoomView";
	        if(document.getElementById(tdroomview).style.display == 'none')
	        {
	         //document.getElementById(tdroomview).style.display = 'inline'
	        document.getElementById(idlink).innerText = "Hide room options"
	        // if(val==2)
	        // document.getElementById(tdroomview2).style.display = 'inline'
	        Effect.toggle(tdroomview, 'appear');
	   
	        }
	      else
	      {
	       document.getElementById(idlink).innerText = "View room options"
//	       document.getElementById(tdroomview).style.display ='none';
//	       if(val==2)
//	       document.getElementById(tdroomview2).style.display = 'none'
           Effect.toggle(tdroomview, 'appear');

	      }
		
		
		}


function displaySeasons(value)
			{
				
				value ++;
				value --;
				 switch(value)
				{
					case 1:	//(eval("tdRoom2")).style.display = 'inline';
							//document.getElementById("searchHotels_tdRoom2").style.display = 'inline'
							(eval("document.all.divRoom2" )).style.visibility = 'hidden';
							//searchHotels_divRoom2.style.display = 'hidden';

							//(eval("tdRoom3")).style.display = 'inline';
							//searchHotels_tdRoom3.style.display = 'inline'
							(eval("document.all.divRoom3" )).style.visibility = 'hidden';
							//document.getElementById("searchHotels_divRoom2").style.display = 'hidden'
							searchHotels_lblRoom1.style.visibility="hidden";

							break;
					case 2:	//(eval("tdRoom2")).style.display = 'inline';
							(eval("document.all.divRoom2" )).style.visibility = 'visible';

							//(eval("tdRoom3")).style.display = 'inline';
							(eval("document.all.divRoom3" )).style.visibility = 'hidden';
							searchHotels_lblRoom1.style.visibility="visible";

							break;
					case 3: //(eval("tdRoom2")).style.display = 'inline';
							(eval("document.all.divRoom2" )).style.visibility = 'visible';

							//(eval("tdRoom3")).style.display = 'inline';
						    (eval("document.all.divRoom3" )).style.visibility = 'visible';
						    searchHotels_lblRoom1.style.visibility="visible";

							break;
				}
			}

       
        
        
        function setDataH(hindex,roomType,NoRoom){
        
		document.getElementById('hdhotelIndex').value =hindex;
		//hdhotelIndex.value = hindex;
		if(roomType == 0){
		//hdroomType0.value = 99;
		document.getElementById('hdroomType0').value = 99;
		document.getElementById('hdHotelIndexRtype0').value = hindex;
		document.getElementById('hdNoroom0').value = NoRoom; 
		
		}
		else if(roomType == 1){
		
		//hdroomType1.value = 99;
		document.getElementById('hdroomType1').value = 99;
		document.getElementById('hdHotelIndexRtype1').value = hindex;
		document.getElementById('hdNoroom1').value = NoRoom; 
		}
		}
		
		function fly(hotelIndex,val,str)
			{
	      debugger;
			var roomType0=-1;
			var roomType1=-1;
			
			var roomNo0=0;
			
			var roomNo1=-1;
			if(val != -1)roomNo1 = 0;
			
			var direc = 0;
				
			if(document.getElementById('hdroomType0').value==99 && document.getElementById('hdHotelIndexRtype0').value==hotelIndex)
				{
				roomType0 = document.getElementById('hdHotelIndexRtype0').value;
				roomNo0 = document.getElementById('hdNoroom0').value;
				direc = 1;
				}
				
				
				if(document.getElementById('hdroomType1').value==99 && document.getElementById('hdHotelIndexRtype1').value==hotelIndex)
				{
				roomType1 = document.getElementById('hdHotelIndexRtype1').value;
				roomNo1 = document.getElementById('hdNoroom1').value;
				direc = 1;  
				}
				//if(direc == 0){
				//alert('Please select a room');
				//return false;
				//}
				//else 
				//{
				
				document.getElementById('hdHotelRoom').value = hotelIndex+"_"+roomNo0+"_"+roomNo1;
				//document.location = "eT_Availability.aspx?hotelIdx="+hotelIndex+"&rType0="+roomType0+"&rNo0="+roomNo0+"&rType1="+roomType1+"&rNo1="+roomNo1;
				// debugger;
//				if(str == 'HotelAndActivities')
//				{
				window.location = "eT_AllResults.aspx?twickuokey="+document.getElementById('hdHotelRoom').value;
				//}
//				else{
//				goToNext(0,0);
//				}
				//}
			}
			function Localization()
			 {
			 var newDate = new Date();
			 var hidField = document.getElementById('HiddenField1');  // ID of hidden field
			 if(hidField == null) {} 
			 else
			 {
			 hidField.value = newDate.toLocaleString();
			 }
			 }
			
			
			function OpenWindow(url)
			{
				window.open(url,"objWin","menubar=0,toolbar=0,resizable=1,width=650,height=750,scrollbars=1");
			}
			
			function hide()
			{
			
				if(divWait!=null && divWait.style!=null)
				{
				divWait.style.visibility = 'hidden';
				divWait.style.position = 'relative';
				divWait.style.top= '-100px';
				}
			}
			function imgOnmouseOver(url)
			{
				//debugger;
				var imgHolder = document.getElementById('imgMain');
				imgHolder.src = url;
				
			}
			function mapLinkOnClick(url)
			{
				
				var tr = document.getElementById('trMapHolder');
				tr.style.display = 'inline';
				var mapHolder = document.getElementById('imgMap');
				mapHolder.src = url;
				document.getElementById('hlMap').style.display ='none';
				var hlClose = document.getElementById('hlClose');
				hlClose.style.display = 'inline';
			}
			function hideMap()
			{
				//debugger;
				var tr = document.getElementById('trMapHolder'); 
				tr.style.display = 'none';
				var hlClose = document.getElementById('hlClose');
				hlClose.style.display = 'none';
				document.getElementById('hlMap').style.display = 'inline';
	
			}
			
			
			
			/*
	Validation for Activities Only
	Validate Form Selections
*/


var ucName='';

// Set UC Name!
function SetucCallName(name)
{

	ucName=name;
}
function RoomSelection()
{

if($(ucName+'_ddlRooms').selectedIndex == 0)
{

 trRoom2.style.visibility="hidden";
//$(ucName+'_trRoom2').style.visibility = 'hidden';
//(eval("document.all.ddlRooms" )).style.visibility = 'hidden';
}
else if($(ucName+'_ddlRooms').selectedIndex == 1)
{
trRoom2.style.visibility="visible";
}

}
function ValidateSearch()
{

	// validate All at Once!
	var errMessage='';
	
	// validate country selection
	if($(ucName+'_ddlCountry').selectedIndex<=0)
		errMessage +='Please Select A Country \n';
	
	if($(ucName+'_ddlCity').selectedIndex<0)
		errMessage +='Please Select A City \n';
	
	if(!$(ucName+'_txtCheckIn').value.isDate())
		errMessage +='Please Enter a Valid Start date\n';
	else if(!toDate($(ucName+'_txtCheckIn').value).isFutureDate(false))
		errMessage +='Invalid Date, please enter a Future date \n';
	
	if(!$(ucName+'_txtCheckOut').value.isDate())
		errMessage +='Please Enter a Valid End date \n';
	else if($(ucName+'_txtCheckOut').value.isDate() && !toDate($(ucName+'_txtCheckOut').value).isFutureDate(true,toDate($(ucName+'_txtCheckIn').value)))
		errMessage +='End Date Should be Start Date\'s Future Date';
	
	if(errMessage=='')
		return true;
	else
		alert('Error: \n'+errMessage);
		
	return false;
}


/* DATE VALIDATION */


function RoomSelectionFlightHotel()
{

if($(ucName+'_cmbRooms').selectedIndex == 0)
{

 trRoom2.style.visibility="hidden";
//$(ucName+'_trRoom2').style.visibility = 'hidden';
//(eval("document.all.ddlRooms" )).style.visibility = 'hidden';
}
else if($(ucName+'_cmbRooms').selectedIndex == 1)
{
trRoom2.style.visibility="visible";
}

}


function ShowRooms(obj){
	
	
	switch(obj[obj.selectedIndex].text){
		case "1":
			document.getElementById('SearchForm1_ddlroom1Adults').style.display = "inline";
			document.getElementById('SearchForm1_ddlRoom1Children').style.display = "inline";
			document.getElementById('SearchForm1_ddlRoom1Infants').style.display = "inline";
			
			document.getElementById('SearchForm1_ddlroom2Adults').style.display = "none";
			document.getElementById('SearchForm1_ddlRoom2Children').style.display = "none";
			document.getElementById('SearchForm1_ddlRoom2Infants').style.display = "none";
			
			document.getElementById('divHroom2Adults').style.display = "none";
			document.getElementById('divHRoom2Children').style.display = "none";
			document.getElementById('divHRoom2Infants').style.display = "none";
			break;
		case "2":
			document.getElementById('SearchForm1_ddlroom1Adults').style.display = "inline";
			document.getElementById('SearchForm1_ddlRoom1Children').style.display = "inline";
			document.getElementById('SearchForm1_ddlRoom1Infants').style.display = "inline";
		
			document.getElementById('SearchForm1_ddlroom2Adults').style.display = "inline";
			document.getElementById('SearchForm1_ddlRoom2Children').style.display = "inline";
			document.getElementById('SearchForm1_ddlRoom2Infants').style.display = "inline";
			
			document.getElementById('divHroom2Adults').style.display = "inline";
			document.getElementById('divHRoom2Children').style.display = "inline";
			document.getElementById('divHRoom2Infants').style.display = "inline";
			break;
	}

}
function ShowDPRooms(obj){
	
	
	switch(obj[obj.selectedIndex].text){
		case "1":
			document.getElementById('ucFlightHotelSearch_cmbRoom1Adult').style.display = "inline";
			document.getElementById('ucFlightHotelSearch_cmbRoom1Child').style.display = "inline";
			document.getElementById('ucFlightHotelSearch_cmbRoom1Infant').style.display = "inline";
			
			document.getElementById('ucFlightHotelSearch_cmbRoom2Adult').style.display = "none";
			document.getElementById('ucFlightHotelSearch_cmbRoom2Child').style.display = "none";
			document.getElementById('ucFlightHotelSearch_cmbRoom2Infant').style.display = "none";
			
			document.getElementById('divRoom2Adult').style.display = "none";
			document.getElementById('divRoom2Childs').style.display = "none";
			document.getElementById('divRoom2Infant').style.display = "none";
			break;
		case "2":
			document.getElementById('ucFlightHotelSearch_cmbRoom1Adult').style.display = "inline";
			document.getElementById('ucFlightHotelSearch_cmbRoom1Child').style.display = "inline";
			document.getElementById('ucFlightHotelSearch_cmbRoom1Infant').style.display = "inline";
		
			document.getElementById('ucFlightHotelSearch_cmbRoom2Adult').style.display = "inline";
			document.getElementById('ucFlightHotelSearch_cmbRoom2Child').style.display = "inline";
			document.getElementById('ucFlightHotelSearch_cmbRoom2Infant').style.display = "inline";
			
			document.getElementById('divRoom2Adult').style.display = "inline";
			document.getElementById('divRoom2Childs').style.display = "inline";
			document.getElementById('divRoom2Infant').style.display = "inline";
			break;
	}

}



  

