
		var obj_ddlRooms;
		var obj_ddlChildrens1;
		var obj_ddlChildrens2;
		var obj_ddlChildrens3;

		var SI_Child1;
		var SI_Child2;
		var SI_Child3;		 
		
		var obj_TD_ddlChild1Room1;
		var obj_TD_ddlChild2Room1;

		var obj_TD_ddlChild1Room2;
		var obj_TD_ddlChild2Room2;

		var obj_TD_ddlChild1Room3;
		var obj_TD_ddlChild2Room3;

		var objDD;

		var obj_ddlChildrens2;
		var obj_ddlChildrens1;

		var MaxSelectedIndex;

		function GetMaxSelectedIndexFor_ddlChildrens()
		{
				//alert("inside GetMaxSelectedIndexFor_ddlChildrens()");
				obj_ddlRooms=window.document.getElementById("UCFindHotel_ddlRooms");
				obj_ddlChildrens1=window.document.getElementById("UCFindHotel_ddlChildrens1");
				obj_ddlChildrens2=window.document.getElementById("UCFindHotel_ddlChildrens2");
				obj_ddlChildrens3=window.document.getElementById("UCFindHotel_ddlChildrens3");
				
				//parseFloat(strYear);
				//parseInt
				SI_Child1=parseInt(obj_ddlChildrens1.selectedIndex);
				SI_Child2=parseInt(obj_ddlChildrens2.selectedIndex);
				SI_Child3=parseInt(obj_ddlChildrens3.selectedIndex);
				//alert(SI_Child1.value);
				//alert("GetMaxSelectedIndexFor_ddlChildrens" + SI_Child1);
				//alert("GetMaxSelectedIndexFor_ddlChildrens" + SI_Child2);
				//alert("GetMaxSelectedIndexFor_ddlChildrens" + SI_Child3);
				
				if (obj_ddlRooms.selectedIndex=="0")
				{
						//alert(" 0 - whatever in ddch1 ");
						return window.document.getElementById("UCFindHotel_ddlChildrens1").selectedIndex;
				}

				if (obj_ddlRooms.selectedIndex =="1")
				{
						//alert("1 - GetMaxSelectedIndexFor_ddlChildrens");
						//return window.document.getElementById("ddlChildrens1").selectedIndex;
						// 1 -0
						
						if ( SI_Child1 > SI_Child2 )
						{
								//alert("SI_Child1 > SI_Child2" ) ;
								//return SI_Child1;
								return obj_ddlChildrens1.selectedIndex;
						}
						
						// 0 -1
						if (SI_Child2 > SI_Child1 ) 
						{
								//alert("SI_Child2 > SI_Child1" ); 
								//return SI_Child2;
								return obj_ddlChildrens2.selectedIndex;
						}
						// 1 -1
						//alert("SI_Child1 = SI_Child2");
						return obj_ddlChildrens2.selectedIndex;
									
				}	//if (obj_ddlRooms.selectedIndex =="1")
				
				if (obj_ddlRooms.selectedIndex=="2")
				{
						//alert(" SI =2")
						// 1 - 0 - 0
						if (SI_Child1 > SI_Child2 ) 
						{
								//alert("if (SI_Child1.value > SI_Child2.value" ) ;
								if (SI_Child1 > SI_Child3 ) 
								{
										//return SI_Child1;
										//alert("SI_Child1 > SI_Child3 ");
										return obj_ddlChildrens1.selectedIndex;
								}
								if (SI_Child1 = SI_Child3 ) 
								{
										//return SI_Child1;
										//alert("SI_Child1 = SI_Child3 ");
										return obj_ddlChildrens1.selectedIndex;
								}								
						}
						
						// 0 - 1 - 0
						if (SI_Child2 > SI_Child3 ) 
						{
								//alert("SI_Child2.value > SI_Child3.value ");
								if (SI_Child2 > SI_Child1 ) 
								{
										//return SI_Child2;
										//alert("SI_Child2 > SI_Child1 ");
										return obj_ddlChildrens2.selectedIndex;
								}
								if (SI_Child2 = SI_Child1 ) 
								{
										//return SI_Child2;
										//alert("SI_Child2 = SI_Child1 ");
										return obj_ddlChildrens2.selectedIndex;
								}								
						}
						
						// 0 - 0 - 1
						if (SI_Child3 > SI_Child1 ) 
						{
								//alert("SI_Child3.value > SI_Child1.value ");
								if (SI_Child3 > SI_Child2 ) 
								{
										//return SI_Child3;
										//alert("SI_Child3 > SI_Child2 ");
										return obj_ddlChildrens3.selectedIndex;
								}
								if (SI_Child3 = SI_Child2 ) 
								{
										//return SI_Child3;
										//alert("SI_Child3 = SI_Child2 ");
										return obj_ddlChildrens3.selectedIndex;
								}								
								
						}
						
						// 1 - 1 - 0
						if (SI_Child1 = SI_Child2 ) 
						{
								//alert("SI_Child1.value = SI_Child2.value ");
								if (SI_Child1 > SI_Child3 ) 
								{
										//return SI_Child1;
										//alert("SI_Child1 > SI_Child3 ");
										return obj_ddlChildrens1.selectedIndex;
								}
								if (SI_Child3 > SI_Child1 ) 
								{
										//alert("SI_Child3 > SI_Child1 ");
										return obj_ddlChildrens3.selectedIndex;
								}
								
						}
						// 0 - 1 - 1
						if (SI_Child2 = SI_Child3 ) 
						{
								//alert("SI_Child2.value = SI_Child3.value ");
								if (SI_Child2 > SI_Child1 ) 
								{
										//return SI_Child2;
										return obj_ddlChildrens2.selectedIndex;
								}
								if (SI_Child1 > SI_Child2 ) 
								{
										return obj_ddlChildrens1.selectedIndex;
								}
						}
						
						// 1 - 0 - 1
						if (SI_Child3 = SI_Child1 ) 
						{
								//alert("SI_Child3.value = SI_Child1.value ");
								if (SI_Child3 > SI_Child1 ) 
								{
										//return SI_Child3;
										return obj_ddlChildrens3.selectedIndex;
								}
								if (SI_Child1 > SI_Child3 ) 
								{
									return obj_ddlChildrens1.selectedIndex;
								}
						}
						
						// 1 - 1 - 1
							//alert("All equal");
							return obj_ddlChildrens1.selectedIndex;
			
				} //if (obj_ddlRooms.selectedIndex=="2")

		} //function GetMaxSelectedIndexFor_ddlChildrens()

		function ToggleVisibility_ddlChildrens1(strSelectedIndex)
		{
				//alert("inside ToggleVisibility_ddlChildrens1");
				//alert(strSelectedIndex);

				if (strSelectedIndex == "0" )
				{						
						window.document.getElementById("UCFindHotel_ddlChild1Room1").style.display="none";
						window.document.getElementById("UCFindHotel_ddlChild2Room1").style.display="none";						
						
						window.document.getElementById("UCFindHotel_ddlChild1Room2").style.display="none";
						window.document.getElementById("UCFindHotel_ddlChild2Room2").style.display="none";
												
						window.document.getElementById("UCFindHotel_ddlChild1Room3").style.display="none";
						window.document.getElementById("UCFindHotel_ddlChild2Room3").style.display="none";							
				}

				if (strSelectedIndex == "1" )
				{						
						window.document.getElementById("UCFindHotel_ddlChild1Room1").style.display="block";
						window.document.getElementById("UCFindHotel_ddlChild2Room1").style.display="none";	
												
						window.document.getElementById("UCFindHotel_ddlChild1Room2").style.display="none";
						window.document.getElementById("UCFindHotel_ddlChild2Room2").style.display="none";
												
						window.document.getElementById("UCFindHotel_ddlChild1Room3").style.display="none";
						window.document.getElementById("UCFindHotel_ddlChild2Room3").style.display="none";							
				}

				if (strSelectedIndex == "2" )
				{						
						window.document.getElementById("UCFindHotel_ddlChild1Room1").style.display="block";
						window.document.getElementById("UCFindHotel_ddlChild2Room1").style.display="block";	
												
						window.document.getElementById("UCFindHotel_ddlChild1Room2").style.display="none";
						window.document.getElementById("UCFindHotel_ddlChild2Room2").style.display="none";
												
						window.document.getElementById("UCFindHotel_ddlChild1Room3").style.display="none";
						window.document.getElementById("UCFindHotel_ddlChild2Room3").style.display="none";	
				}						
		} //function ToggleVisibility_ddlChildrens1(strSelectedIndex)

		function ToggleVisibility_ddlChildrens2(strSelectedIndex)
		{
				if (strSelectedIndex == "0" )
				{						
						window.document.getElementById("UCFindHotel_ddlChild1Room2").style.display="none";
						window.document.getElementById("UCFindHotel_ddlChild2Room2").style.display="none";
												
						window.document.getElementById("UCFindHotel_ddlChild1Room3").style.display="none";
						window.document.getElementById("UCFindHotel_ddlChild2Room3").style.display="none";	
				}

				if (strSelectedIndex == "1" )
				{						
						window.document.getElementById("UCFindHotel_ddlChild1Room2").style.display="block";
						window.document.getElementById("UCFindHotel_ddlChild2Room2").style.display="none";
												
						window.document.getElementById("UCFindHotel_ddlChild1Room3").style.display="none";
						window.document.getElementById("UCFindHotel_ddlChild2Room3").style.display="none";	
				}

				if (strSelectedIndex == "2" )
				{						
						window.document.getElementById("UCFindHotel_ddlChild1Room2").style.display="block";
						window.document.getElementById("UCFindHotel_ddlChild2Room2").style.display="block";
												
						window.document.getElementById("UCFindHotel_ddlChild1Room3").style.display="none";
						window.document.getElementById("UCFindHotel_ddlChild2Room3").style.display="none";	
				}						
		} //function ToggleVisibility_ddlChildrens2(strSelectedIndex)

		function ToggleVisibility_ddlChildrens3(strSelectedIndex)
		{
				if (strSelectedIndex == "0" )
				{						
						window.document.getElementById("UCFindHotel_ddlChild1Room3").style.display="none";
						window.document.getElementById("UCFindHotel_ddlChild2Room3").style.display="none";	
				}

				if (strSelectedIndex == "1" )
				{						
						window.document.getElementById("UCFindHotel_ddlChild1Room3").style.display="block";
						window.document.getElementById("UCFindHotel_ddlChild2Room3").style.display="none";	
				}

				if (strSelectedIndex == "2" )
				{						
						window.document.getElementById("UCFindHotel_ddlChild1Room3").style.display="block";
						window.document.getElementById("UCFindHotel_ddlChild2Room3").style.display="block";	
				}						
		} //function ToggleVisibility_ddlChildrens3(strSelectedIndex)			

		function ToggleVisibility_AllCell_ChildrenRooms_Room1(strFlagCell1,strFlagCell2,strFlagCell3)
		{
		
		obj_TD_ddlChild1Room1 = window.document.getElementById("UCFindHotel_ddlChild1Room1");
		obj_TD_ddlChild2Room1 = window.document.getElementById("UCFindHotel_ddlChild2Room1");

		//----------------------------------------------------------
		if (strFlagCell2 == "ON")
		{
		obj_TD_ddlChild1Room1.style.display="block";			
		}
		else (strFlagCell2 == "OFF")
		{
		obj_TD_ddlChild1Room1.style.display="none";			
		}

		//----------------------------------------------------------
		if (strFlagCell3 == "ON")
		{
		obj_TD_ddlChild2Room1.style.display="block";			
		}
		else (strFlagCell3 == "OFF")
		{
		obj_TD_ddlChild2Room1.style.display="none";			
		}				
		}

		function ToggleVisibility_AllCell_ChildrenRooms_Room2(strFlagCell1,strFlagCell2,strFlagCell3)
		{
		
		obj_TD_ddlChild1Room2 = window.document.getElementById("UCFindHotel_ddlChild1Room2");
		obj_TD_ddlChild2Room2 = window.document.getElementById("UCFindHotel_ddlChild2Room2");

		//----------------------------------------------------------
		if (strFlagCell2 =="ON")
		{
		obj_TD_ddlChild1Room2.style.display="block";			
		}
		else (strFlagCell2 =="OFF")
		{
		obj_TD_ddlChild1Room2.style.display="none";			
		}

		//----------------------------------------------------------
		if (strFlagCell3 =="ON")
		{
		obj_TD_ddlChild2Room2.style.display="block";			
		}
		else (strFlagCell3 =="OFF")
		{
		obj_TD_ddlChild2Room2.style.display="none";			
		}

		}

		function ToggleVisibility_AllCell_ChildrenRooms_Room3(strFlagCell1,strFlagCell2,strFlagCell3)
		{
				
		obj_TD_ddlChild1Room3 = window.document.getElementById("UCFindHotel_ddlChild1Room3");
		obj_TD_ddlChild2Room3 = window.document.getElementById("UCFindHotel_ddlChild2Room3");
		
		//----------------------------------------------------------
		if (strFlagCell2 =="ON")
		{
		obj_TD_ddlChild1Room3.style.display="block";			
		}
		else (strFlagCell2 =="OFF")
		{
		obj_TD_ddlChild1Room3.style.display="none";			
		}

		//----------------------------------------------------------
		if (strFlagCell3 =="ON")
		{
		obj_TD_ddlChild2Room3.style.display="block";			
		}
		else (strFlagCell3 =="OFF")
		{
		obj_TD_ddlChild2Room3.style.display="none";			
		}

		}
		
		function ToggleVisibility_Rooms3()
		{
				MaxSelectedIndex =GetMaxSelectedIndexFor_ddlChildrens();
								
				objDD = window.document.getElementById("UCFindHotel_ddlChildrens3");
				if(objDD.selectedIndex == "0")
				{						
						window.document.getElementById("UCFindHotel_ddlChild1Room3").style.display="none";
						window.document.getElementById("UCFindHotel_ddlChild2Room3").style.display="none";				
				}
				
				if(objDD.selectedIndex == "1") 		
				{						
						window.document.getElementById("UCFindHotel_ddlChild1Room3").style.display="block";
						window.document.getElementById("UCFindHotel_ddlChild2Room3").style.display="none";				
			
				}	//if(objDD.selectedIndex == "1") 

				if(objDD.selectedIndex == "2") 		
				{						
						window.document.getElementById("UCFindHotel_ddlChild1Room3").style.display="block";
						window.document.getElementById("UCFindHotel_ddlChild2Room3").style.display="block";					

				}	//if(objDD.selectedIndex == "2") 
							
		}	//function ToggleVisibility_Rooms3()		

		function ToggleVisibility_Rooms2()
		{				
				MaxSelectedIndex =GetMaxSelectedIndexFor_ddlChildrens();
								
				obj_ddlChildrens2 = window.document.getElementById("UCFindHotel_ddlChildrens2");
				if(obj_ddlChildrens2.selectedIndex == "0") 		
				{						
						window.document.getElementById("UCFindHotel_ddlChild1Room2").style.display="none";
						window.document.getElementById("UCFindHotel_ddlChild2Room2").style.display="none";
												
				}

				if(obj_ddlChildrens2.selectedIndex == "1") 		
				{					
						window.document.getElementById("UCFindHotel_ddlChild1Room2").style.display="block";
						window.document.getElementById("UCFindHotel_ddlChild2Room2").style.display="none";
				
				} //if(objDD.selectedIndex == "1") 		

				if(obj_ddlChildrens2.selectedIndex == "2") 		
				{					
					window.document.getElementById("UCFindHotel_ddlChild1Room2").style.display="block";
					window.document.getElementById("UCFindHotel_ddlChild2Room2").style.display="block";
					
					} //if(objDD.selectedIndex == "2") 		
		}//function ToggleVisibility_Rooms2()	

		function ToggleVisibility_Rooms1()
		{								
				MaxSelectedIndex =GetMaxSelectedIndexFor_ddlChildrens();
								
				objDD = window.document.getElementById("UCFindHotel_ddlChildrens1");
				
				if(objDD.selectedIndex == "0") 		
				{						
						window.document.getElementById("UCFindHotel_ddlChild1Room1").style.display="none";
						window.document.getElementById("UCFindHotel_ddlChild2Room1").style.display="none";
				}

				if(objDD.selectedIndex == "1") 		
				{						
						window.document.getElementById("UCFindHotel_ddlChild1Room1").style.display="block";
						window.document.getElementById("UCFindHotel_ddlChild2Room1").style.display="none";
				} //if(objDD.selectedIndex == "1") 

				if(objDD.selectedIndex == "2") 		
				{						
						window.document.getElementById("UCFindHotel_ddlChild1Room1").style.display="block";
						window.document.getElementById("UCFindHotel_ddlChild2Room1").style.display="block";
				} //if(objDD.selectedIndex == "2")			
		}

		function ToggleVisibility()
		{
				objDD = window.document.getElementById("UCFindHotel_ddlRooms");

				if(objDD.selectedIndex == "0") 		
				{
						//objDD = window.document.getElementById("UCFindHotel_RoomsRow3");
						//objDD.style.display="none";
						//objDD = window.document.getElementById("UCFindHotel_RoomsRow4");
						//objDD.style.display="none";
						var ad2 = window.document.getElementById("UCFindHotel_ddlAdults2");
						var ad3 = window.document.getElementById("UCFindHotel_ddlAdults3");
						var ch2 = window.document.getElementById("UCFindHotel_ddlChildrens2");
						//var ch3 = window.document.getElementById("UCFindHotel_ddlChildrens3");
						
						var Room2Row = window.document.getElementById("UCFindHotel_room2Row");
						var Room3Row = window.document.getElementById("UCFindHotel_room3Row");
						
						ad2.style.display="none";
						ad3.style.display="none";
						ch2.style.display="none";
						//ch3.style.display="none";
						Room2Row.style.display="none";
						Room3Row.style.display="none";
						
						//++++ 	Control state based on SelectedIndex for ddlChildrens1 ++++
						obj_ddlChildrens1 = window.document.getElementById("UCFindHotel_ddlChildrens1");
						ToggleVisibility_ddlChildrens1(obj_ddlChildrens1.selectedIndex)
						
				}	//if(objDD.selectedIndex == "0")

				if(objDD.selectedIndex == "1") 		
				{
						//objDD = window.document.getElementById("UCFindHotel_RoomsRow3");
						//objDD.style.display="block";
						// "block" does not work with Firefox so it has been removed. Setting display to "" works on IE as well as Firefox.
						//objDD.style.display=""; 
						
						var ad2 = window.document.getElementById("UCFindHotel_ddlAdults2");
						var ch2 = window.document.getElementById("UCFindHotel_ddlChildrens2");
						var Room2Row = window.document.getElementById("UCFindHotel_room2Row");
						
						ad2.style.display="";
						ch2.style.display="";
						Room2Row.style.display="";
						
						//objDD = window.document.getElementById("UCFindHotel_RoomsRow4");
						//objDD.style.display="none";				
						
						var ad3 = window.document.getElementById("UCFindHotel_ddlAdults3");
						var ch3 = window.document.getElementById("UCFindHotel_ddlChildrens3");
						var Room3Row = window.document.getElementById("UCFindHotel_room3Row");
						
						ad3.style.display="none";
						ch3.style.display="none";
						Room3Row.style.display="none";
						
						//++++ According to the option selected in ddlChildrens2, toggle state ++++
						MaxSelectedIndex = GetMaxSelectedIndexFor_ddlChildrens();
												
						obj_ddlChildrens2 = window.document.getElementById("UCFindHotel_ddlChildrens2");
						ToggleVisibility_ddlChildrens2(obj_ddlChildrens2.selectedIndex);
						
				}	//if(objDD.selectedIndex == "1")			
				
				if(objDD.selectedIndex== "2") 	
				{
						//objDD = window.document.getElementById("UCFindHotel_RoomsRow3");
						//objDD.style.display="block";
						// "block" does not work with Firefox so it has been removed. Setting display to "" works on IE as well as Firefox.
						//objDD.style.display=""; 
						
						//objDD = window.document.getElementById("UCFindHotel_RoomsRow4");
						//objDD.style.display="block";
						// "block" does not work with Firefox so it has been removed. Setting display to "" works on IE as well as Firefox.
						//objDD.style.display=""; 
						
						var ad2 = window.document.getElementById("UCFindHotel_ddlAdults2");
						var ch2 = window.document.getElementById("UCFindHotel_ddlChildrens2");
						var Room2Row = window.document.getElementById("UCFindHotel_room2Row");
						
						ad2.style.display="";
						ch2.style.display="";
						Room2Row.style.display="";
						var ad3 = window.document.getElementById("UCFindHotel_ddlAdults3");
						var ch3 = window.document.getElementById("UCFindHotel_ddlChildrens3");
						var Room3Row = window.document.getElementById("UCFindHotel_room3Row");
						
						ad3.style.display="";
						ch3.style.display="";
						Room3Row.style.display="";
						
						//++++ According to the option selected in ddlChildrens2, toggle state ++++
						MaxSelectedIndex =GetMaxSelectedIndexFor_ddlChildrens();
												
						obj_ddlChildrens2 = window.document.getElementById("UCFindHotel_ddlChildrens2");
						ToggleVisibility_ddlChildrens2(obj_ddlChildrens2.selectedIndex);						
						obj_ddlChildrens3 = window.document.getElementById("UCFindHotel_ddlChildrens3");
						ToggleVisibility_ddlChildrens3(obj_ddlChildrens3.selectedIndex);
										
				} //if(objDD.selectedIndex=="2") 
		} //ToggleVisibility()
		
		function getCityListOld()
		{
			obj_ddlCountryList = window.document.getElementById("UCFindHotel_ddlCountryList");
			//alert(obj_ddlCountryList.value);
			obj_ddlCityList = window.document.getElementById("UCFindHotel_ddlCityList");
			obj_ddlCityList.selectedIndex = 0;
			var ccode=obj_ddlCountryList.value;
			
			//alert(navigator.appName);
			if (document.implementation && document.implementation.createDocument)
			{
				var xmlHttp = new XMLHttpRequest();
				xmlHttp.open("GET", "GetCityList.aspx?ccode="+ccode, false);
				xmlHttp.send(null);
				var xmlcity = document.implementation.createDocument("", "doc", null);
				//xmlcity.async=false;
				xmlcity.load("country.xml");				
				var objcitylist = xmlcity.getElementsByTagName("CD");
				alert(objcitylist.length);
			}
			else if (window.ActiveXObject)
			{
				var xmlHttp = new ActiveXObject("Microsoft.XMLHTTP")
				xmlHttp.open("GET", "GetCityList.aspx?ccode="+ccode, false)
				xmlHttp.send()			
				var xmlcity = new ActiveXObject("Microsoft.XMLDOM")
				xmlcity.async=false
				xmlcity.loadXML(xmlHttp.responseText)
				var objcitylist = xmlcity.selectNodes("//CD")
			}			
						
			obj_ddlCityList.length = objcitylist.length;			
					
			if (objcitylist.length > 0)
			{			
				for(var i=0;i < objcitylist.length;i++)
				{					
					obj_ddlCityList.options[i].value=objcitylist.item(i).selectSingleNode("C").text;
					obj_ddlCityList.options[i].text=objcitylist.item(i).selectSingleNode("N").text;
				}
			}
		}
		
		function getSelectedCityIDOld()
		{
			obj_ddlCityList1 = window.document.getElementById("UCFindHotel_ddlCityList");
			obj_hidCityID = window.document.getElementById("UCFindHotel_hidCityID");			
			obj_hidCityName = window.document.getElementById("UCFindHotel_hidCityName");			
			obj_hidCityID.value = obj_ddlCityList1.value;			
			obj_hidCityName.value = obj_ddlCityList1.options[obj_ddlCityList1.selectedIndex].text;									
		}
		
		function resetCountryList(){			
			obj_ddlCountryList = window.document.getElementById("ddlCountryList");			
			obj_ddlCountryList.selectedIndex = 0;
		}
		
		function calender(mode)
		{							
			//alert(mode);
			if(navigator.appName.indexOf("Netscape") == -1)
			{
				window.open("PAdminPopUp.aspx?mode="+mode,"cal","width=200,height=180,,top=375,left=795");
			}
			else 
			{
				msgWindow = open("PAdminPopUp.aspx?mode="+mode,"cal","width=200,height=180,,top=375,left=795");
			}					
		}
		
	function setYears(inY,outY)
	{
		if(inY.options.selectedIndex > outY.options.selectedIndex)
		{
			outY.options.selectedIndex = outY.options.selectedIndex + 1;
		}
	}
	
	function amadChange(inM,inD,outM,outD,outY,inY,objNights)
	{	
		if	(!isBrowserSupp())
		    {
		    return;
		    }		
		   setYears(inY,outY);
		var res = adjustDate(inM.options.selectedIndex, inD);
		if (res != 0)
			{
				outD.options.selectedIndex=0;
				
			    if (inM.options.selectedIndex==11)
				{					
					if((outY.options.length -1) == outY.options.selectedIndex)
					{
						alert("Date Out Of Range");
						if(inY.options.selectedIndex !=0)
						{
							inY.options.selectedIndex = inY.options.selectedIndex - 1;
							outM.options.selectedIndex = 0;
						}
						return;
					}
					
					
					outM.options.selectedIndex=0
					outY.options.selectedIndex = outY.options.selectedIndex + 1;
					//alert(outY.options.length);
					//alert(outY.options.selectedIndex);
				}
				else
				{
					outM.options.selectedIndex=inM.options.selectedIndex + 1;
				}
			}
		else
		{
		outM.options.selectedIndex = inM.options.selectedIndex;
		outD.options.selectedIndex = inD.options.selectedIndex+1; 
		 }

getNights(inM,inD,outM,outD,outY,inY,objNights); 
return;
}

function amadChanges(inM,inD,outM)
	{	
		if	(!isBrowserSupp())
		    {
		    return;
		    }		
		   //setYears(inY,outY);
		var res = adjustDate(inM.options.selectedIndex, inD);
		/*if (res != 0)
			{
				outD.options.selectedIndex=0;
				
			    if (inM.options.selectedIndex==11)
				{					
					if((outY.options.length -1) == outY.options.selectedIndex)
					{
						alert("Date Out Of Range");
						if(inY.options.selectedIndex !=0)
						{
							inY.options.selectedIndex = inY.options.selectedIndex - 1;
							outM.options.selectedIndex = 0;
						}
						return;
					}
					
					
					outM.options.selectedIndex=0
					outY.options.selectedIndex = outY.options.selectedIndex + 1;
					//alert(outY.options.length);
					//alert(outY.options.selectedIndex);
				}
				else
				{
					outM.options.selectedIndex=inM.options.selectedIndex + 1;
				}
			}
		else
		{
		outM.options.selectedIndex = inM.options.selectedIndex;
		outD.options.selectedIndex = inD.options.selectedIndex+1; 
		 }

getNights(inM,inD,outM,outD,outY,inY,objNights); 
*/
return;
}

function adjustDate(mthIdx, Dt)
{
var value=0;

var today = new Date()
var theYear = parseInt(today.getYear(),10)

if (mthIdx < today.getMonth()) {
    theYear = (parseInt(today.getYear(), 10) + 1)
}
if(theYear<100){
    theYear = "19" + theYear
}
else{
    if((theYear-100) < 10){
        theYear = "0" + (theYear-100)
    }
    else{
        theYear = (theYear-100)+""
    }
    theYear = "20" + theYear
}


var numDays=getDaysInMonth(mthIdx, theYear);

if (mthIdx==1)
    {
    if (Dt.options.selectedIndex + 1 < numDays)
        {
        return 0;
        }
    else
        {
        Dt.options.selectedIndex=numDays - 1;
        //check for leap year
        if (numDays==29)
            {
            return 99;
            }
        else
            {
            return 1;
            }
        }
    }
if (Dt.options.selectedIndex + 1 < numDays)
    {
    value=0;
    }
else
    {
    if (Dt.options.selectedIndex + 1 > numDays)
        {
        Dt.options.selectedIndex--;
        value=3;
        }
    else
        {
        //index is 31 or 30
        value=2;
        }
    }
return value;
}


function dmddChange(outM,outD,inM,inD,outY,inY,objNights)
{
if (!isBrowserSupp())
    {
    return;
    }

adjustDate(outM.options.selectedIndex,outD);
if (((outM.options.selectedIndex < inM.options.selectedIndex) && (inM.options.selectedIndex != 11)) || ((outM.options.selectedIndex == inM.options.selectedIndex) && (outD.options.selectedIndex <= inD.options.selectedIndex)))
	{
		amadChange(inM,inD,outM,outD,outY,inY);
	}
	//alert("sds");
getNights(inM,inD,outM,outD,outY,inY,objNights);
return;
}


function getDaysInMonth(mthIdx, YrStr)
{
// all the rest have 31
var maxDays=31
// expect Feb. (of course)
if (mthIdx==1)
    {
    if (isLeapYear(YrStr))
        {
        maxDays=29;
        }
    else
        {
        maxDays=28;
        }
    }
// thirty days hath...
if (mthIdx==3 || mthIdx==5 || mthIdx==8 || mthIdx==10)
    {
    maxDays=30;
    }
return maxDays;
}

function isLeapYear(yrStr)
{
var leapYear=false;
var year = parseInt(yrStr, 10);
// every fourth year is a leap year
if (year%4 == 0)
    {
    leapYear=true;
    // unless it's a multiple of 100
    if (year%100 == 0)
        {
        leapYear=false;
        // unless it's a multiple of 400
        if (year%400 == 0)
            {
            leapYear=true;
            }
        }
    }
return leapYear;
}
function isBrowserSupp() {
    // Get the version of the browser
    version =  parseFloat( navigator.appVersion );

    if ( ( version >= 2.0 ) && ( version < 2.1 ) && ( navigator.appName.indexOf( "Netscape" ) != -1 ) ) {
        return false;
    }
    else {
    return true;
    }

return true;
}

function fromyearchange(ddlfromyear,ddltoyear)
{
	
	if(ddlfromyear.value > ddltoyear.value)
	{
		ddltoyear.value =parseInt(ddltoyear.value) + 1;
	}
	if(ddltoyear < ddlfromyear)
	{
		
	}
}

function toyearchange(ddlfromyear,ddltoyear)
{
	
	if(ddltoyear.value < ddlfromyear.value )
	{
		ddlfromyear.value = parseInt(ddlfromyear.value)- 1;
	}
	
}

function validateSearchForm()
{
	var fromdate;
	var todate;
	var ddlFromYear;
	var ddlFromMonth;
	var ddlFromDay;
	var countryid;
	var cityid;
	var ddlToYear;
	var ddlToMonth;
	var ddlToDay;
	var strErrormsg;
	var bError;
	var objNights;
	bError = 0;
	strErrormsg = ""
	ddlFromYear = window.document.forms[0].ddlCheckINYear;
	ddlFromMonth = window.document.forms[0].ddlCheckINMonth;	
	ddlFromDay = window.document.forms[0].ddlCheckINDate;
					
	ddlToYear = window.document.forms[0].ddlCheckOutYear;
	ddlToMonth = window.document.forms[0].ddlCheckOutMonth;	
	ddlToDay = window.document.forms[0].ddlCheckOutDate;
	
	hotelSearch = window.document.forms[0].ihdHotelSearch.value;
	objNights = window.document.getElementById("lblNumNights");

	if(hotelSearch == 1)
	{
		countryid = window.document.forms[0].UCFindHotel_ihdCountryID.value;	
		cityid = window.document.forms[0].UCFindHotel_ihdCityID.value;	
	}
	else
	{
		countryid = window.document.forms[0].UCFindHotel_ddlCountryList.value;
		cityid = window.document.forms[0].UCFindHotel_ddlCityList.value;
	}

	fromdate = new Date(ddlFromYear.value,ddlFromMonth.options.selectedIndex,ddlFromDay.value);
	todate = new Date(ddlToYear.value,ddlToMonth.options.selectedIndex,ddlToDay.value);
	//alert(fromdate)
	
	//if(
//	return false;
	if(countryid == "")
	{
		strErrormsg = " Please select the Country";
		bError = 1;
	}
	if(cityid == "")
	{
		 strErrormsg = strErrormsg +"\n Please select the City";
		 bError = 1;
	}
	if(bError ==1)
	{
		alert(strErrormsg + "\n    - Please correct the above error(s).");
		return false;
	}
	var currentdate;
	currentdate = new Date();
	//alert(currentdate.getMonth());
	if(fromdate < currentdate)
	{
	 alert("invalid date");
	 return false;
	}
	if(!(getNights(ddlFromMonth,ddlFromDay,ddlToMonth,ddlToDay,ddlToYear,ddlFromYear,objNights)))
	{
		return false;
	}	
	
	//var	myWindow = window.open("Processing.htm", "WaitWindow", 'width=360,height=440,scrollbars=no,resizable=no,top=100,left=350');

}
var m_iCityId="";
var m_strCityName="";
var m_iCountryId="";
var m_strCountryName="";

function validateHotelSearchForm()
{
	var fromdate;
	var todate;
	var ddlFromYear;
	var ddlFromMonth;
	var ddlFromDay;
	var countryid;
	var cityid;
	var ddlToYear;
	var ddlToMonth;
	var ddlToDay;
	var strErrormsg;
	var bError;
	var objNights;
	var ErrorFlag=0;
		
	bError = 0;
	strErrormsg = ""
	
	var str = location.href;
		str = str.toLowerCase();
		
    if(str.indexOf("hotelprofile") == -1 )
	{
	
    var	xiCityName = window.document.getElementById("UCFindHotel_txtRegion").value;
    if(xiCityName == "")
    {
        alert("Please select valid Destination");
		return false;
    }
    
    var obj_hidDestination = window.document.getElementById("UCFindHotel_hidDestination")
    obj_hidDestination.value=xiCityName;
    
    GetCountryDetails(xiCityName);
    if(m_strCityName=="")
	{
	    ErrorFlag=1;
	}
	else
	{
	    obj_hidCityName = window.document.getElementById("UCFindHotel_hidCityName")
	    if(obj_hidCityName == null)
	     alert("Object not found");
	    obj_hidCityName.value =  m_strCityName;
	}
	if(m_iCityId=="")
	{
	    ErrorFlag=1;
	}
	else
	{
	    var obj_hidCityID = window.document.getElementById("UCFindHotel_hidCityID");
	    obj_hidCityID.value = m_iCityId;
	    //alert(obj_hidCityID.value);
	}
	if(m_strCountryName=="")
	{
	    ErrorFlag=1;
	}
	else
	{	    
    	var obj_hidCountryName = window.document.getElementById("UCFindHotel_hidCountryName");
	    obj_hidCountryName.value = m_strCountryName;
	}
	if(m_iCountryId=="")
	{
	    ErrorFlag=1;
	}
	else
	{
	    var obj_hidCountryID = window.document.getElementById("UCFindHotel_hidCountryID");
	    obj_hidCountryID.value = m_iCountryId;
	}
	
	if(ErrorFlag==1)
	{
	    alert("Please select valid Destination");
		return false;
	}
	}	
	ddlFromYear = window.document.forms[0].UCFindHotel_ddlCheckINYear;
	ddlFromMonth = window.document.forms[0].UCFindHotel_ddlCheckINMonth;	
	ddlFromDay = window.document.forms[0].UCFindHotel_ddlCheckINDay;
					
	//ddlToYear = window.document.forms[0].UCFindHotel_ddlCheckOUTYear;
	//ddlToMonth = window.document.forms[0].UCFindHotel_ddlCheckOUTMonth;	
	//ddlToDay = window.document.forms[0].UCFindHotel_ddlCheckOUTDay;
	
	hotelSearch = window.document.forms[0].UCFindHotel_ihdHotelSearch.value;

	//objNights = window.document.getElementById("UCFindHotel_lblNumNights");

	if(hotelSearch == 1)
	{
		countryid = window.document.forms[0].UCFindHotel_ihdCountryID.value;	
		cityid = window.document.forms[0].UCFindHotel_ihdCityID.value;	
	}
	else if(hotelSearch == 2)
	{
		countryid = window.document.forms[0].UCFindHotel_ihdCountryID.value;	
		cityid = window.document.forms[0].UCFindHotel_ihdCityID.value;	
	}
	else
	{
	    // =====================================================================================
		// Following lines are commented because dropdown lists for city and country are
        // replaced with search predict text box
        // =====================================================================================
		// countryid = window.document.forms[0].UCFindHotel_ddlCountryList.value;
		// cityid = window.document.forms[0].UCFindHotel_ddlCityList.value;
		
	}

	fromdate = new Date(ddlFromYear.value,ddlFromMonth.options.selectedIndex,ddlFromDay.value);
	//todate = new Date(ddlToYear.value,ddlToMonth.options.selectedIndex,ddlToDay.value);
	//alert(fromdate);
	
	//if(
//	return false;
	if(countryid == "Initial")
	{
		strErrormsg = " Please select the Country";
		bError = 1;
	}
	if(cityid == "Initial")
	{
		 strErrormsg = strErrormsg +"\n Please select the City";
		 bError = 1;
	}
	if(cityid == "")
	{
		 strErrormsg = strErrormsg +"\n Please select the City";
		 bError = 1;
	}
	if(bError == 1)
	{
		alert(strErrormsg + "\n    - Please correct the above error(s).");
		return false;
	}
	var currentdate;
	currentdate = new Date();
	//alert(currentdate.getMonth());	
	if(fromdate < currentdate)
	{
		alert("Invalid Date Selection! Please Check.");
	   return false;
	}
	/*if(!(getNights(ddlFromMonth,ddlFromDay,ddlToMonth,ddlToDay,ddlToYear,ddlFromYear,objNights)))
	{
		return false;
	}*/
	
	//window.location = "Processing.htm"
	return true;
	//var	myWindow = window.open("Processing.htm", "WaitWindow", 'width=360,height=440,scrollbars=no,resizable=no,top=100,left=350');

}

function GetCountryDetails(xiCityName)
{
    var CityArray;
	var CityCountryArray; 
	var CityId;
	
	for(var iCounterCity = 0; iCounterCity < labels.length; iCounterCity++)
	{
		CityCountryArray = labels[iCounterCity];
		
		if(xiCityName == CityCountryArray[0])
		{
			CityId = CityCountryArray[1];
			break;
		} 
	}
				
	for(var iCounterCountry = 0; iCounterCountry < CountryArray.length; iCounterCountry++)
	{
	    CityArray = CountryArray[iCounterCountry];
		
		if(CityId == CityArray[1])
		{
		    m_strCityName    = CityArray[0];
			m_iCityId	     = CityArray[1];
			m_strCountryName = CityArray[2];
			m_iCountryId	 = CityArray[3];	
			break;
		}	  
	} 
	
}	

	function getNights(inM,inD,outM,outD,outY,inY,objNights)
	{
		var dateDiff;
		var one_day=1000*60*60*24;
		var ddlFromYear;
		var ddlFromMonth;
		var ddlFromDay;	

		var ddlToYear;
		var ddlToMonth;
		var ddlToDay;

		ddlFromYear = inY.value;
		ddlFromMonth = inM.selectedIndex;	
		ddlFromDay = inD.value;

		ddlToYear = outY.value;
		ddlToMonth = outM.options.selectedIndex;	
		ddlToDay = outD.value;

		fromdate = new Date(ddlFromYear,ddlFromMonth,ddlFromDay);
		todate = new Date(ddlToYear,ddlToMonth,ddlToDay);

		dateDiff = Math.ceil((todate.getTime()-fromdate.getTime())/(one_day));	
		if(dateDiff < 1)
		{
			alert("invalid date");
			return false;	
		}
		else
		{
		//	var obj;
			//obj=window.document.getElementById("UCFindHotel_lblNumNights");
			if (objNights!=null)
			{
				objNights.innerText = String(dateDiff);
			}
		}
		return true;
	}
	
	function InitializeControls()
	{
		var newDate;
		newDate = new Date();
		
		document.frmSearch.ddlCheckINYear.options.length = 0;
		document.frmSearch.ddlCheckINYear.options[document.frmSearch.ddlCheckINYear.options.length]= new Option(newDate.getFullYear(),newDate.getFullYear());
		document.frmSearch.ddlCheckINYear.options[document.frmSearch.ddlCheckINYear.options.length]= new Option((newDate.getFullYear()+1),(newDate.getFullYear()+1));
		//document.frmSearch.ddlCheckOUTYear.options.length = 0;
		//document.frmSearch.ddlCheckOUTYear.options[document.frmSearch.ddlCheckOUTYear.options.length]= new Option(newDate.getFullYear(),newDate.getFullYear());
		//document.frmSearch.ddlCheckOUTYear.options[document.frmSearch.ddlCheckOUTYear.options.length]= new Option((newDate.getFullYear()+1),(newDate.getFullYear()+1) );

		window.document.getElementById("UCFindHotel_RoomsRow3").style.display="none";
		window.document.getElementById("UCFindHotel_RoomsRow4").style.display="none";
		window.document.getElementById("UCFindHotel_ddlChild1Room1").style.display="none";
		window.document.getElementById("UCFindHotel_ddlChild2Room1").style.display="none";
		window.document.getElementById("UCFindHotel_ddlChild1Room2").style.display="none";
		window.document.getElementById("UCFindHotel_ddlChild2Room2").style.display="none";
	}

	function LoadProcessingPage()
	{

		alert('hello');
		var objCountryID = window.document.forms[0].UCFindHotel_hidCountryID;
		var iCountryID = objCountryID.value;
		////////////////////////////////////////////////////////////////////////////////////
		var objCityID = window.document.forms[0].UCFindHotel_hidCityID;
		var iCityID = objCityID.value;
		////////////////////////////////////////////////////////////////////////////////////
		var objHotelName = window.document.forms[0].UC_Search_Form_txtSrcHotelName;
		var strHotelName = objHotelName.value;
		var iHotelID = 0;
		////////////////////////////////////////////////////////////////////////////////////
		var objStarRating = window.document.forms[0].cmbStar;
		var iStarRating = objStarRating.value;
		
		////////////////////////////////////////////////////////////////////////////////////
		var objCurrencyCode = window.document.forms[0].UC_Search_Form_ddlCurrencyList;
		var strCurrencyCode;
		
		strCurrencyCode = objCurrencyCode.value;
		
		////////////////////////////////////////////////////////////////////////////////////
		
		var objChkInYear = window.document.forms[0].UCFindHotel_ddlCheckINYear;
		var objChkInMonth = window.document.forms[0].UCFindHotel_ddlCheckINMonth;
		var objChkInDay = window.document.forms[0].UCFindHotel_ddlCheckINDay;
		var dChkInDate = new Date(objChkInYear.value,objChkInMonth.value,objChkInDay.value);
		////////////////////////////////////////////////////////////////////////////////////
		var objNoOfNights = window.document.forms[0].ddlNoOfNights;
		var iNoOfNights = objNoOfNights.value;
		////////////////////////////////////////////////////////////////////////////////////
		var dChkOutDate = new Date();
		dChkOutDate.setDate(dChkInDate + iNoOfNights);
		////////////////////////////////////////////////////////////////////////////////////
		var objRooms = window.document.forms[0].UCFindHotel_ddlRooms;
		var iRooms = objRooms.value;
		////////////////////////////////////////////////////////////////////////////////////
		var objAdultsRoom1 = window.document.forms[0].UCFindHotel_ddlAdults1;
		var iAdultsRoom1 = objAdultsRoom1.value;
		////////////////////////////////////////////////////////////////////////////////////
		var objAdultsRoom2 = window.document.forms[0].UCFindHotel_ddlAdults2;
		var iAdultsRoom2 = objAdultsRoom2.value;
		////////////////////////////////////////////////////////////////////////////////////
		var objAdultsRoom3 = window.document.forms[0].UCFindHotel_ddlAdults3;
		var iAdultsRoom3 = objAdultsRoom3.value;
		////////////////////////////////////////////////////////////////////////////////////
		var objNoOfChildrenRoom1 = window.document.forms[0].UCFindHotel_ddlChildrens1;
		var iNoOfChildrenRoom1 = objNoOfChildrenRoom1.value;
		////////////////////////////////////////////////////////////////////////////////////
		var objNoOfChildrenRoom2 = window.document.forms[0].UCFindHotel_ddlChildrens2;
		var iNoOfChildrenRoom2 = objNoOfChildrenRoom2.value;
		////////////////////////////////////////////////////////////////////////////////////
		var objNoOfChildrenRoom1 = window.document.forms[0].UCFindHotel_ddlChildrens3;
		var iNoOfChildrenRoom3 = objNoOfChildrenRoom1.value;
		////////////////////////////////////////////////////////////////////////////////////
		
		var objRoom1Child1Age = window.document.forms[0].UCFindHotel_ddlChild1Room1;
		var iRoom1Child1Age = objRoom1Child1Age.value;
		////////////////////////////////////////////////////////////////////////////////////
		var objRoom1Child2Age = window.document.forms[0].UCFindHotel_ddlChild2Room1;
		var iRoom1Child2Age = objRoom1Child2Age.value;
		////////////////////////////////////////////////////////////////////////////////////
		////////////////////////////////////////////////////////////////////////////////////
		var objRoom2Child1Age = window.document.forms[0].UCFindHotel_ddlChild1Room2;
		var iRoom2Child1Age = objRoom2Child1Age.value;
		////////////////////////////////////////////////////////////////////////////////////
		var objRoom2Child2Age = window.document.forms[0].UCFindHotel_ddlChild2Room2;
		var iRoom2Child1Age = objRoom2Child2Age.value;
		////////////////////////////////////////////////////////////////////////////////////
		////////////////////////////////////////////////////////////////////////////////////
		var objRoom3Child1Age = window.document.forms[0].UCFindHotel_ddlChild1Room3;
		var iRoom3Child1Age = objRoom3Child1Age.value;
		////////////////////////////////////////////////////////////////////////////////////
		var objRoom2Child2Age = window.document.forms[0].UCFindHotel_ddlChild2Room3;
		var iRoom2Child2Age = objRoom2Child2Age.value;
		
				
		window.location.href='http://localhost/hotelhippo/HotelSearchResults-page-CityId-' + iCityID + '-CountryId-' + iCountryID + '-HotelID-' + iHotelID + '-StarRatings-' + iStarRating + '-CurrencyCode-' + strCurrencyCode + '-Chkindate-' + dChkInDate.toString() + '-Chkoutdate-' + dChkOutDate.toString() + '-Rooms-' + iRooms + '-Adult1-' + iAdultsRoom1 + '-Adult2-' + iAdultsRoom2 + '-Adult3-' + iAdultsRoom3 + '-Child1-' + iNoOfChildrenRoom1 + '-Child2-' + iNoOfChildrenRoom2 + '-Child3-' + iNoOfChildrenRoom3 + '-Child1Age1-' + iRoom1Child1Age + '-Child2Age1-' + iRoom2Child1Age + '-Child3Age1-' + iRoom3Child1Age + '-Child1Age2-' + iRoom1Child2Age + '-Child2Age2-' + iRoom2Child1Age + '-Child3Age2-' + iRoom2Child2Age ;
		
		
	}


