﻿
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)
			{
			
			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;
				//Shee - Set selected room in session - Start
				var hotelvalue = hotelIndex+"_"+roomNo0+"_"+roomNo1;
				setSessionInfo("SelectedHotelRoom",hotelvalue);
				//Shee - Set selected room in session - End
				
				//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);
				}
				//}
			}
			//Shee - Set selected room in session - Start
			//This function sets the key and the value to the session object in Ajax.
				function setSessionInfo(key,value)
				{
				
				 if (key.length==0 || value.length==0)
                  { 
                     return;
                  }
                xmlHttp=GetXmlHttpObject();
                if (xmlHttp==null)
                  {
                  //alert ("Your browser does not support AJAX!");
                  return;
                  } 
                xmlHttp.open("POST","SessionVariablesInfo.aspx?selectedHotelRoomKey=" + key + "&selectedHotelRoomValue=" + value,true);
                xmlHttp.send(null);
				}
				//Shee - Set selected room in session - End
			
			//Shee - Set selected room in session - Start
			//Common function to retrieve a xmlhttp request object for ajax call.
			 function GetXmlHttpObject()
            {
            var xmlHttp=null;
            try
              {
              // Firefox, Opera 8.0+, Safari
              xmlHttp=new XMLHttpRequest();
              }
            catch (e)
              {
              // Internet Explorer
              try
                {
                xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
                }
              catch (e)
                {
                xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
                }
              }
            return xmlHttp;
            }
            //Shee - Set selected room in session - End
            
			function OpenWindow(url)
			{
				window.open(url,"objWin","menubar=0,toolbar=0,resizable=1,width=650,height=750,scrollbars=1");
			}
			function OpenInsurance(url)
			{			    
                window.open(url,"Insurance","menubar=0,toolbar=0,resizable=1,width=780,height=700,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 Cleariframe(control)
{
document.getElementById(control+"_addpage").setAttribute("src","");
}



function GetMoreInfo(hotelid,control)
{
document.getElementById(control+"_addpage").setAttribute("src","HotelMoreInfo.aspx?hotelcode="+hotelid);
document.getElementById(control+"_ModalPanel").style.display="";

$find(control+"_mpe").show();

}

function CleariframeA(control)
{
document.getElementById(control+"_addpage").setAttribute("src","");
}



function GetMoreInfoA(hotelid,control)
{
document.getElementById(control+"_addpage").setAttribute("src","HotelMoreInfo.aspx?hotelcode="+hotelid);
document.getElementById(control+"_ModalPanel").style.display="";
document.getElementById(control+"_ModalPanel").style.width = "810px";
document.getElementById(control+"_addpage").style.width = "810px";
document.getElementById(control+"_addpage").style.height = "500px";
document.getElementById(control+"_lblfheader").innerText = "Hotel Information";

$find("msgmoe").show();

}

function GetCancelPOlicy(control)
{
document.getElementById(control+"_addpage").setAttribute("src","HotelCancelPolicy.aspx");
document.getElementById(control+"_ModalPanel").style.display="";
document.getElementById(control+"_ModalPanel").style.width = "400px";
document.getElementById(control+"_addpage").style.width = "400px";
document.getElementById(control+"_addpage").style.height = "300px";
document.getElementById(control+"_lblfheader").innerText="Hotel Cancellation Policy";

$find("msgmoe").show();

}

