﻿
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 selectRoomAllocation()
{
//				debugger;
//				var roomControl =document.getElementById('FlightHotelSearch_cmbRooms');
//				var rooms;
//				rooms = 1;
//				if(roomControl!=null){
//					rooms = roomControl.value;
//				}

//				displaySeasons(rooms);

//				
//				var room1Control = document.getElementById('searchHotels_lblRoom1');
//				if(room1Control!=null){
//					if(rooms>1)
//						searchHotels_lblRoom1.style.visibility="visible"
//					else
//						searchHotels_lblRoom1.style.visibility="hidden"
//				}
//			return;


			}
			
        
        
        
        function setData(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 goTo(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 = "GQ_Availability.aspx?hotelIdx="+hotelIndex+"&rType0="+roomType0+"&rNo0="+roomNo0+"&rType1="+roomType1+"&rNo1="+roomNo1;
				// debugger;
				if(str == 'HotelAndActivities')
				{
				window.location = "GQ_Availability.aspx?hotelrooom="+document.getElementById('hdHotelRoom').value;
				}
				else{
				goToNext(0,0);
				}
				//}
			}
			
			
			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)
			{
				//debugger;
				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 OpenWindow(url)
{
window.open(url,"objWin","menubar=0,toolbar=0,resizable=1,width=650,height=750,scrollbars=1");
}


  
