function validate()
				{
					 var cityCombo=document.getElementById("cityName");
					 if(document.getElementById("cityName1").value == "dotedLine" || document.getElementById("cityName1").value =="" || document.getElementById("cityName1").value ==0 || document.getElementById("cityName1").value=='---------------------'){
					alert("Please Select the Destination");
					return false;
					}

					 if (validateDates() && validateRoomStrength() && validateHtlChain() )
					 {
						if(document.getElementById('hotelNameString').value != null && trim(document.getElementById('hotelNameString').value).length < 3)
							document.getElementById('hotelNameString').value = "";
						if (document.SearchForm.residentOfIndia.checked)
						{
							document.SearchForm.action = "http://hotels.makemytrip.co.in/makemytrip/searchHotelProgress.do?residentOfIndia=Y&method=searchHotels";
						}
						else
						 {
							document.SearchForm.action = "http://hotels.makemytrip.co.in/makemytrip/searchHotelProgress.do?residentOfIndia=N&method=searchHotels";
						 }
						
						writePersistentCookie("_hc",document.getElementById("cityName1").value,"months",1);
						document.SearchForm.submit();
					 }
					 else
					 {
						 window.setTimeout(createArrows,1);
						 return false;
					 }

				}
function showBlock(blockId)
  {

    document.getElementById(blockId).style.display = "block";
	if(blockId='intl'&&firstTimeIntClick==0){

	firstTimeIntClick=1;
	loadXmlCountries();
	}
  }
function hideBlock(blockId)
  {
    document.getElementById(blockId).style.display = "none";
  }


	function showHidechildText(){
		var childCountFlag=0;
		for(var i=0; i<(document.getElementsByName("children")).length; i++){
			if(document.getElementsByName("children")[i].value != 0){
				childCountFlag++;
			}
		}
		if(childCountFlag == 0){
			document.getElementById("titleSpan").style.display="none"
		}
		else{
			document.getElementById("titleSpan").style.display="block"
		}
	}

	function showHidechildText1(){
		var childCountFlag=0;
		for(var i=0; i<(document.getElementsByName("children1")).length; i++){
			if(document.getElementsByName("children1")[i].value != 0){
				childCountFlag++;
			}
		}
		if(childCountFlag == 0){
			document.getElementById("titleSpan1").style.display="none"
		}
		else{
			document.getElementById("titleSpan1").style.display="block"
		}
	}

function showDiv(){
      if(document.location.hash.substr(1)!=""){
			document.getElementById("dom").style.display="none";
            obj=document.getElementById(document.location.hash.substr(1));

	         obj.style.display="block";
             showBlock('intl');

      }
}

function showShowHide(){
				var openShow="false";

				if(openShow=="true"){
					document.getElementById("handle").innerHTML="<u>Hide</u>";
				}
				else{
					document.getElementById("handle").innerHTML="<u>Show</u>";
				}
			}

function signoutFun(){
	var adj = new Date();
	document.forms[0].action = "signout.do?adj="+adj;
	document.forms[0].submit();
}

function getAbsolutePos(oEl)
	{
			var pos=[oEl.offsetLeft,oEl.offsetTop];
			var parent=oEl.offsetParent;
			var tmp={x:null,y:null};if(parent!=oEl)
			{
				while(parent)
				{
					switch(browser)
					{
						case'ie':
									if(_getStyle(parent,'position')=='relative'&&_getStyle(oEl,'width')=='auto'&&!(_getStyle(oEl,'position')!='static'))
									{
										return[oEl.offsetLeft,oEl.offsetTop];
									}
									else if(_getStyle(parent,'width')!='auto'||_getStyle(oEl.parentNode,'position')!='static')
									{
									tmp.x=parseInt(_getStyle(parent,'borderLeftWidth'));
									tmp.y=parseInt(_getStyle(parent,'borderTopWidth'));if(!isNaN(tmp.x))pos[0]+=tmp.x;if(!isNaN(tmp.y))pos[1]+=tmp.y;
									}
									break;
						case'gecko':if(_getStyle(parent,'position')=='relative')
	{tmp.x=parseInt(_getStyle(parent,'border-left-width'));tmp.y=parseInt(_getStyle(parent,'border-top-width'));if(!isNaN(tmp.x))pos[0]+=tmp.x;if(!isNaN(tmp.y))pos[1]+=tmp.y;}
	break;}
	pos[0]+=parent.offsetLeft;pos[1]+=parent.offsetTop;parent=parent.offsetParent;}}
	if(browser=='ie'&&_getStyle(oEl,'width')!='auto'&&_getStyle(oEl.offsetParent,'width')=='auto'&&_getStyle(oEl.offsetParent,'position')=='relative')
	{parent=oEl.parentNode;while(parent.tagName!='HTML')
	{tmp.x=parseInt(_getStyle(parent,'marginLeft'));tmp.y=parseInt(_getStyle(parent,'paddingLeft'));if(!isNaN(tmp.x))pos[0]-=tmp.x;if(!isNaN(tmp.y))pos[0]-=tmp.y;parent=parent.parentNode;}}
	return pos;}



	function toggleShow(id)
	{
		var obj = document.getElementById(id);
		var imgObj = document.getElementById("handleImage");
		if (obj.style.display=="none")
		{
			obj.style.display="block"
			document.getElementById("anchorForHandle").innerHTML="<u>Hide</u>";
			try
			{
				imgObj.src = "http://images1.makemytrip.com/mmtimgs/images/uparrow.gif"
			}
			catch (e)
			{
			}
		}
		else
		{
			obj.style.display="none"
			document.getElementById("anchorForHandle").innerHTML="<u>Show</u>";
			try
			{
				imgObj.src = "http://images1.makemytrip.com/mmtimgs/images/downarrow.GIF"
			}
			catch (e)
			{
			}
		}
	}


	function changeAnchorText(obj)
	{
		if(obj.innerHTML=="Show")
		{
			obj.innerHTML="Hide";
		}
		else
		{
			obj.innerHTML="Show"
		}
	}

	function whatIsThisHotel(evt)
		{
			document.forms[0].StarRating.style.display="none";
			 evt = (evt) ? evt : ((window.event) ? window.event : "")
			if (evt) {
				var elem = (evt.target) ? evt.target : evt.srcElement
				var x = 170;
				var y = 330;
				if (navigator.appName.indexOf("Explorer")!=-1)
				{
							if(window.screen.width == 1152 && window.screen.height == 864){
								x = 170;
								y = 330;
							}
							if(window.screen.width == 1280 && window.screen.height == 720){
								x = 170;
								y = 340;
							}
							if(window.screen.width == 1280 && window.screen.height == 1024){
								x = 170;
								y = 340;
							}
							if(window.screen.width == 1024 && window.screen.height == 768){
								x = 170;
								y = 340;
							}
							if(window.screen.width == 1280 && window.screen.height == 768){
								x = 170;
								y = 340;
							}
							if(window.screen.width == 1400 && window.screen.height == 900){
								x = 170;
								y = 340
							}
							if(window.screen.width == 1280 && window.screen.height == 800){
								x = 170;
								y = 340
							}
							if(window.screen.width == 1440 && window.screen.height == 900){
								x = 170;
								y = 340
							}
							if(window.screen.width == 800 && window.screen.height == 600){
								x = 170;
								y = 320;
							}
				}
				else
				{
							if(window.screen.width == 1152 && window.screen.height == 864){
								x = 170;
								y = 320;
							}
							if(window.screen.width == 1280 && window.screen.height == 720){
								x = 170;
								y = 320;
							}
							if(window.screen.width == 1280 && window.screen.height == 1024){
								x = 170;
								y = 320;
							}
							if(window.screen.width == 1024 && window.screen.height == 768){
								x = 170;
								y = 320;
							}
							if(window.screen.width == 1280 && window.screen.height == 768){
								x = 170;
								y = 320;
							}
							if(window.screen.width == 1400 && window.screen.height == 900){
								x = 170;
								y = 320;
							}
							if(window.screen.width == 1280 && window.screen.height == 800){
								x = 170;
								y = 320;
							}
							if(window.screen.width == 1440 && window.screen.height == 900){
								x = 170;
								y = 320;
							}
							if(window.screen.width == 800 && window.screen.height == 600){
								x = 170;
								y = 320;
							}
				}
				var divObj = document.getElementById("WhatIsX");
				divObj.style.display = "block";
				divObj.style.position = "absolute";
				divObj.style.left = x;
				divObj.style.top = y;
				divObj.innerHTML = "<div class='select-free'><table width='301' height='26' bgcolor='#3396FF' cellspacing=0 cellpadding=0 style='border:1px solid #3396FF'><tr><td><table width='300' height='25' cellspacing='0' cellpading='0' bgcolor='#FFFFFF' ><tr bgcolor='#3396FF'><td align='left'><font color='white'><B>What is Specify a Hotel?</B></font></td><td align='right'><a href='javascript:divclose(\"WhatIsX\")' style='font-size:12'><b><font color='white' title='Close' ><b>close[X]</b></font></b></a></td></tr><tr><td align='left' colspan='2'><font size='1'  family='verdana'>On entering up to three characters of a hotel name in the Specify a Hotel text field, the system will auto-complete the hotels that contain those characters. The options will appear for selection in a dropdown overlay.<br></font></td></tr></table></td></tr></table><!--[if lte IE 6.5]><iframe ></iframe><![endif]--></div>"
			}
			createArrows();
		}
		function divclose(name){
			var divObj;
			document.forms[0].StarRating.style.display="block";
			divObj= document.getElementById(name);
			divObj.style.display = "none";
			createArrows();
		}


		function compareDatesOnly(date1, date2) {
					var year1 = date1.getYear();
					var year2 = date2.getYear();
					var month1 = date1.getMonth();
					var month2 = date2.getMonth();
					var day1 = date1.getDate();
					var day2 = date2.getDate();

					if (year1 > year2) {
						return -1;
					}
					if (year2 > year1) {
						return 1;
					}

					//years are equal
					if (month1 > month2) {
						return -1;
					}
					if (month2 > month1) {
						return 1;
					}

					//years and months are equal
					if (day1 > day2) {
						return -1;
					}
					if (day2 > day1) {
						return 1;
					}

					//days are equal
					return 0;


				}
function filterDates2(cal) {
					endDate = cal.date;
					endDate.setDate(endDate.getDate()-1)
				}


				function dateInRange1(date) {
					if (endDate != null) {

						// Disable dates after end date
						var compareEnd = compareDatesOnly(date, endDate);
						if  (compareEnd < 0) {
							return (true);
						}

						// Hilight end date with "edges" style
						if  (compareEnd == 0) {
							{return "edges";}
						}

						// Hilight inner dates with "between" style
						if (startDate != null){
							var compareStart = compareDatesOnly(date, startDate);
							if  (compareStart < 0) {
								return "between";
							}
						}
					}

					//disable days prior to today
					var today = phpdate;
					//var today3=addDays(today,3);
					//today.setDate(today.getDate()+3);
					//today.setDate(today.getDate()+ htl_restrict_days)
					var compareToday = compareDatesOnly(date, today);
					if (compareToday > 0) {
						return(true);
					}


					//all other days are enabled
					return false;
					//alert(ret + " " + today + ":" + date + ":" + compareToday + ":" + days1 + ":" + days2);
					return(ret);
				}

			function addDays(myDate,days){
		return new Date(myDate.getTime()+days*24*60*60*1000);

}

				function dateInRange2(date) {
					if (startDate != null) {
						// Disable dates before start date
						var compareDays = compareDatesOnly(startDate, date);
						if  (compareDays < 0) {
							return (true);
						}

						// Hilight end date with "edges" style
						if  (compareDays == 0) {
							{return "edges";}
						}

						// Hilight inner dates with "between" style
						if ((endDate != null) && (date > startDate) && (date < endDate)) {
							return "between";
						}
					}

					var now = phpdate;
					//now.setDate(now.getDate()+4)
					//now.setDate(now.getDate()+ htl_restrict_days)
					if (compareDatesOnly(now, date) < 0) {
						return (true);
					}

					//all other days are enabled
					return false;
				}

function getDateString(dateString)
				{

						var	months = new Array();
								months[0] = "Jan";
								months[1] = "Feb";
								months[2] = "Mar";
								months[3] = "Apr";
								months[4] = "May";
								months[5] = "Jun";
								months[6] = "Jul";
								months[7] = "Aug";
								months[8] = "Sep";
								months[9] = "Oct";
								months[10] = "Nov";
								months[11] = "Dec";
						var parts = dateString.split("/");
						if (parts[1] == "09")
						{
							parts[1] = "9";
						}
						else if (parts[1]=="08")
						{
							parts[1] = "8"
						}
						var dateStringToReturn = parts[0] + "-" + months[ parseInt(parts[1])-1] + "-"+   parts[2];
						return dateStringToReturn;
				}


				function validateDates()
				{
					var fromDateString = document.getElementById("arrDateOway").value;
					var toDateString = document.getElementById("deptDateOway").value;
					if (fromDateString.length==0 && toDateString.length==0)
					{
						alert(enterDates);
						return;
					}
					if (fromDateString.length==0)
					{
						alert(enterCheckIn);
						return;
					}
					if (toDateString.length==0)
					{
						alert(enterCheckOut);
						return;
					}

					if(!isThisDate(fromDateString,"arrDateOway")){
						return false;
					}
					if(!isThisDate(toDateString,"deptDateOway")){
						return false;
					}
					var fromDate = buildDate(fromDateString);
					var toDate = buildDate(toDateString);
					var todayDate = new Date();
					var todayTime = todayDate.getTime();
					var fromTime = fromDate.getTime();
					var toTime = toDate.getTime();
					var now=new Date().getTime();
					if (fromTime > toTime)
					{
						alert(checkIn_CheckOut);
						return false;
					}
					else if (fromTime==toTime)
					{
						alert(same_check_in_out);
						return false;
					}
					else
					{
						return true;
					}
				}

				function buildDate(dateString)    // date string is in format dd/mm//yyyy
				{
					var dd = parseInt(eval(dateString.split("/")[0]),10);
					var mm = parseInt(eval(dateString.split("/")[1]),10);
					var yyyy = parseInt(eval(dateString.split("/")[2]),10);
					var date = new Date (yyyy, (mm-1) , dd, 0, 0, 0, 0)
					return date;
				}


				function toggleDiv(divId)
				{
					createArrows();
					var divObj = document.getElementById(divId);
					var display = divObj.style.display + "";
					if (display.toUpperCase()=="NONE")
					{
						divObj.style.display =  "block";
					}
					else if (display.toUpperCase()=="BLOCK")
					{
						divObj.style.display =  "none";
					}
				}


function searchoptnfn()
	{
	document.getElementById("searchoptn").style.display="";
	}

	function showHotelsSearch()
	{
		document.getElementById("flightsTable").style.display = "none";
		document.getElementById("hotelsTable").style.display = "block";
	}

function createRooms()
	{
		var table = document.getElementById("guestsTable");
		deleteTableWithHeader(table);
		var childrenAgesTable = document.getElementById("childrenAgesTable");
		deleteTable(childrenAgesTable);
		var titleSpan = document.getElementById("titleSpan");
		var rooms = document.getElementById("rooms").value;
		for (var count=0;count<rooms;count++)
		{
			var row = table.insertRow(count + 1);
			row.valign = "top"
			var cell1 = row.insertCell(0);
			var cell2 = row.insertCell(1);
			cell1.className = "bluetext"
			cell2.className = "bluetext"
			cell1.innerHTML =  "<select name='adults' class='childSelect' onchange='validateRoomStrength(),updateArray("+count+",0,this)' style='width:40px'><option value='1'>1</option><option value='2'>2</option><option value='3'>3</option><option value='4'>4</option><option value='5'>5</option><option value='6'>6</option></select>";
			cell2.innerHTML = "&nbsp;&nbsp;&nbsp;&nbsp;<select name='children' class='childSelect' style='width:40px'onchange='validateRoomStrength(),showChildrenAges(),showHidechildText(),updateArray("+count+",1,this)'><option value='0' selected>0</option><option value='1'>1</option><option value='2'>2</option><option value='3'>3</option><option value='4'>4</option><option value='5'>5</option></select>";
			cell2.align = "left"
			cell1.align = "left";

			if(count>0){
				document.forms[0].adults[count].value=roomDtls[count][0];
				document.forms[0].children[count].value=roomDtls[count][1];
			}else{
				document.forms[0].adults.value=roomDtls[count][0];
				document.forms[0].children.value=roomDtls[count][1];
			}
		}
		createArrows();
		showChildrenAges();
	  }


	function createArrows()
	{
			var rooms = document.getElementById("rooms").value;
			var arrowsTableObj = document.getElementById("arrowsTable");
			deleteTable(arrowsTableObj );
			for (var count=0;count<rooms;count++)
			{
				var row = arrowsTableObj .insertRow(count);
				row.valign = "top"
				var cell = row.insertCell(0);
				cell.className = "bluetext"
				if(count==0){
				cell.innerHTML = "&nbsp;<img src='http://images1.makemytrip.com/mmtimgs/images/arrow2.gif' height='0'><img src='http://images1.makemytrip.com/mmtimgs/images/arrow3.gif' width='25' height='3'/>Room" +  (count + 1)+":";
				}
				else{
				cell.innerHTML = "<img src='http://images1.makemytrip.com/mmtimgs/images/arrow2.gif' height='16'><img src='http://images1.makemytrip.com/mmtimgs/images/arrow3.gif' width='18' height='3'/>Room" +  (count + 1)+":";
				}
			}
	}


	function deleteTableWithHeader(table)
	{
		for (var count=table.rows.length-1;count>0;count--)
		{
			table.deleteRow(count);
		}
	}

	function deleteTable(table)
	{
		for (var count=table.rows.length-1;count>=0;count--)
		{
			table.deleteRow(count);
		}
	}

	function showChildrenAges()
	{
		for(var count=0;count<(document.forms[0].children).length;count++){

		}
		var childrenAgeTable = document.getElementById("childrenAgesTable");
		deleteTable(childrenAgeTable);
		var childSelects = document.getElementsByName("children");
		var v = 0;
		for (var count=0;count<childSelects.length;count++)
		{
			if (childSelects[count].value>0)
			{
				v +=1
			}
		}
		if (v>0)
		{
			document.getElementById("titleSpan").style.display = "block";
		}
		else
		{
			document.getElementById("titleSpan").style.display = "none";
		}
		v = 0;

		for (var count=0;count<childSelects.length;count++)
		{
			var childAge = childSelects[count].value;
			if (childAge>0)
			{
				var row = childrenAgeTable.insertRow( v++);
				var cell = row.insertCell(0);
				var cell2 = row.insertCell(1);
				cell.className = "bluetext"
				cell2.className = "bluetext"
				cell.innerHTML = "&nbsp;&nbsp;Room" + (count+1) + ":";
				var str = "";
				var childStr = "";
				str += "<table><tr>";
				var dupCnt=0;
				for(var childCount=1;childCount<=childAge;childCount++)
				{
					childStr += "Child " + childCount +  ":&nbsp;&nbsp;&nbsp;"
					str += "<td class='bluetext'>Child " + childCount +  ":<BR>";
					var selectName = "Room" + (count + 1);
					str += "<SELECT class='childSelect' name='" + selectName+"' id='Room"+count+"_"+childCount+"' onchange='updateAgeArray("+count+","+dupCnt+",this)'>";
					for (var ageCount=1;ageCount<=12;ageCount++)//changed from 0 to 1 to make children age to start from 1
					{
						str += "<option value=" + ageCount + ">" + ageCount + "</option>";
					}
					str += "</select>";
					str += "</TD>";
					dupCnt++;
				}
				str += "</tr></table>";
				cell2.innerHTML = str;
				var dupCnt=0;
				for(var childCount=1;childCount<=childAge;childCount++)
				{
					document.getElementById("Room"+count+"_"+childCount).value=childAges[count][dupCnt]
					dupCnt++;
				}
			}
		  }
		createArrows();
	}


	function validateRoomStrength()
	{
		var numberOfRooms = document.getElementById("rooms").value;
		var adults = document.getElementsByName("adults");
		var children = document.getElementsByName("children");
		for (var count=0;count<numberOfRooms;count++)
		{
			var adultsInRoom = parseInt(adults[count].value);
			var childrenInRoom = parseInt(children[count].value);
			var roomStrength = adultsInRoom + childrenInRoom;
			if ( roomStrength > maxRoomStrength)
			{
				alert("Please check that the total number of persons (including children) per room is:" + maxRoomStrength);
				children[count].focus();
				var childrenAgeTable = document.getElementById("childrenAgesTable");
				deleteTable(childrenAgeTable);
				return false;
			}
			children[count].length=maxRoomStrength-adultsInRoom;
			for(var j=0;j<=maxRoomStrength-adultsInRoom;j++){
				children[count].options[j]=new Option(j,j,true,false);
			}
			children[count].value=childrenInRoom;
			// Based on children slected the number of adults will be displayed
			adults[count].length=maxRoomStrength-childrenInRoom;
			for(var j=0;j<maxRoomStrength-childrenInRoom;j++){
				adults[count].options[j]=new Option(j+1,j+1,true,false);
			}
			adults[count].value=adultsInRoom;
		}
		return true;
	}


	function enterAlphaNumericWithSpace(e)
	{
		var key=0;
		if (!e) var e = window.event;
		// e gives access to the event in all browsers
		if(!e.which) key = e.keyCode; // This is used store the keycode(IE Only)
		else key = e.which; // This is used store the keycode(Netscape Only)
		 if((key>=48)&&(key<=57)||(key>=65)&&(key<=90)||(key>=97)&&(key<=122)||key==8||key==9||key==32||key==13||key==10||key==189)
		 {
			key=key;
			return true;
		 }
		 else
		 {
			alert("Please enter Alpha Numerics only.");
			key=0;
		   return false;
		 }
	}// @End enterAlphaNumeric(e)


	function isInteger(s){
		var i;
		for (i = 0; i < s.length; i++){
			// Check that current character is number.
			var c = s.charAt(i);
			if (((c < "0") || (c > "9"))) return false;
		}
		// All characters are numbers.
		return true;
	}

	function stripCharsInBag(s, bag){
		var i;
		var returnString = "";
		// Search through string's characters one by one.
		// If character is not in bag, append to returnString.
		for (i = 0; i < s.length; i++){
			var c = s.charAt(i);
			if (bag.indexOf(c) == -1) returnString += c;
		}
		return returnString;
	}

	function daysInFebruary (year){
		// February has 29 days in any year evenly divisible by four,
		// EXCEPT for centurial years which are not also divisible by 400.
		return (((year % 4 == 0) && ( (!(year % 100 == 0)) || (year % 400 == 0))) ? 29 : 28 );
	}
	function DaysArray(n) {
		var noofdays = new Array();
		for (var i = 1; i <= n; i++) {
			noofdays[i] = 31
			if (i==4 || i==6 || i==9 || i==11) {noofdays[i] = 30}
			if (i==2) {noofdays[i] = 29}
	   }
	   return noofdays;
	}

	function isThisDate(dtStr,fname){
		var todaydate = new Date();
		var daysInMonth = DaysArray(12)
		var pos1=dtStr.indexOf(dtCh)
		var pos2=dtStr.indexOf(dtCh,pos1+1)
		var strDay=dtStr.substring(0,pos1)
		var strMonth=dtStr.substring(pos1+1,pos2)
		var strYear=dtStr.substring(pos2+1)
		strYr=strYear
		if (strDay.charAt(0)=="0" && strDay.length>1) strDay=strDay.substring(1)
		if (strMonth.charAt(0)=="0" && strMonth.length>1) strMonth=strMonth.substring(1)
		for (var i = 1; i <= 3; i++) {
			if (strYr.charAt(0)=="0" && strYr.length>1) strYr=strYr.substring(1)
		}
		month=parseInt(strMonth)
		day=parseInt(strDay)
		year=parseInt(strYr)
		if (pos1==-1 || pos2==-1){
			alert(dateFormat)
			document.getElementById(fname).value="DD/MM/YYYY";
			return false
		}
		if (strMonth.length<1 || month<1 || month>12){
			 if(isNaN(month)){
				 alert(dateFormat);
				 document.getElementById(fname).focus();
			 }else{
			alert("Please enter a valid month.")
			 document.getElementById(fname).focus();
			 }
			return false
		}
		if (strDay.length<1 || day<1 || day>31 || (month==2 && day>daysInFebruary(year)) || day > daysInMonth[month]){
			alert(validDate)
			 document.getElementById(fname).focus();
			return false
		}
		if (strYear.length != 4 || year==0 || year<minYear || year>maxYear){
			alert(valid4Digit+" "+todaydate.getYear()+".")
			 document.getElementById(fname).focus();
			return false
		}
		if (dtStr.indexOf(dtCh,pos2+1)!=-1 || isInteger(stripCharsInBag(dtStr, dtCh))==false){
			alert(validDate)
			 document.getElementById(fname).focus();
			return false
		}
	return true
	}

	function ValidateForm(id,fname){

			if (isDate(id,fname)==false){
				document.getElementById(fname).focus();
				document.getElementById(fname).value="DD/MM/YYYY";
						return false
		}
		return true
	 }


			function increment()
			{
				document.getElementById("progressTable").style.visibility = "visible"
				document.getElementById("progressTable").style.height = "100%"
				var currentValue =  parseInt(dojo.widget.byId('setTestBar').getProgressValue());
				var maxValue =  parseInt(dojo.widget.byId('setTestBar').getMaxProgressValue());
				var diffInValue =  maxValue - currentValue;
				var incrementalValue = Math.floor(diffInValue / 25);
				currentValue += incrementalValue
				dojo.widget.byId('setTestBar').setProgressValue(currentValue);
				return;
			}


			function dateInRange11(date) {

				if (endDate != null) {

					// Disable dates after end date
					var compareEnd = compareDatesOnly(date, endDate);
					if  (compareEnd < 0) {
						return (true);
					}

					// Hilight end date with "edges" style
					if  (compareEnd == 0) {
						{return "edges";}
					}


					// Hilight inner dates with "between" style
					if (startDate != null){
						var compareStart = compareDatesOnly(date, startDate);
						if  (compareStart < 0) {
							return "between";
						}
					}
				}

				//disable days prior to today
				var today = phpdate;
				var today1=addDays(today,1);
				//today.setDate(today.getDate()+htl_restrict_days)
				var compareToday = compareDatesOnly(date, today1);
				if (compareToday > 0) {
					return(true);
				}


				//all other days are enabled
				return false;
				//alert(ret + " " + today + ":" + date + ":" + compareToday + ":" + days1 + ":" + days2);
				return(ret);
			}

		function addDays(myDate,days){
		return new Date(myDate.getTime()+days*24*60*60*1000);
}


			function dateInRange12(date) {
				if (startDate != null) {
					// Disable dates before start date
					var compareDays = compareDatesOnly(startDate, date);
					if  (compareDays < 0) {
						return (true);
					}

					// Hilight end date with "edges" style
					if  (compareDays == 0) {
						{return "edges";}
					}

					// Hilight inner dates with "between" style
					if ((endDate != null) && (date > startDate) && (date < endDate)) {
						return "between";
					}
				}

				var now = new Date(phpdate);
								
				//var getphpnow=phpdate;
				//var now=addDays(getphpnow,1);
				
				now.setDate(now.getDate()+1)
				if (compareDatesOnly(now, date) < 0) {
					return (true);
				}

				//all other days are enabled
				return false;
			}
			// end hiding contents from old browsers  -->
			// ends hiding contents from old browsers  --><br>



			function validate1()
			{
				var cityCombo=document.getElementById("cityNameIntl");
				var countryCombo=document.getElementById("countryNameIntl");
				document.getElementById("hiddenCityNameIntl").value = cityCombo.options[cityCombo.selectedIndex].innerHTML;
				document.getElementById("hiddenCountryName").value = countryCombo.options[countryCombo.selectedIndex].innerHTML;

				document.getElementById("cityCodeIntl").value = cityCombo.options[cityCombo.selectedIndex].value;
				document.getElementById("countryCodeIntl").value = countryCombo.options[countryCombo.selectedIndex].value;


				if(document.getElementById("countryNameIntl").value == "dotedLine" || document.getElementById("countryNameIntl").value =='')
				{
				 	document.getElementById("countryNameIntl").focus();
					alert("Please Select the Destination Country");
					return false;
				}
				if(document.getElementById("cityNameIntl").value == "dotedLine" || document.getElementById("cityNameIntl").value ==''||document.getElementById("cityNameIntl").value =='0')
				{
				 	document.getElementById("cityNameIntl").focus();
					alert("Please Select the Destination City");
					return false;
				}


		if ( validateDates1() && validateRoomStrength1() && validateHtlChain() )
				 {
					//Checking if the country code is US
					if(document.getElementById("countryCodeIntl").value=="US")
			        {
			        	//Retrieve check in and check out dates
						var inputDate1=document.getElementById("arrDateOway1").value;
			        	var inputDate2=document.getElementById("deptDateOway1").value;

			        	//Format dates into a format accepted by the search URL
						var arrDay=inputDate1.split("/")[0]
	                    var arrMonth=inputDate1.split("/")[1]
	                    var arrYear=inputDate1.split("/")[2]
	                    var deptDay=inputDate2.split("/")[0]
	                    var deptMonth=inputDate2.split("/")[1]
	                    var deptYear=inputDate2.split("/")[2]

	                    //Retrieve number of adults
	                    var numOfAdults=document.getElementById("adults1").value;

	                    //Retrieve number of rooms
	                    var numOfRooms=document.getElementById("rooms1").value;

	                    //Retrieve name of the city
	                    var city=document.getElementById("hiddenCityNameIntl").value;

	                    var url;
	                    var country=document.getElementById("countryCodeIntl").value;
	                    var noOfChildren=document.getElementById("children1").value;

	                    //Checking if city name contains the state code attached to it(inside brackets).
	                    if(city.indexOf('(')!=-1)
	                    {
	                    	//Extract city name
	                    	var actualCityName=trim(city.split('(')[0]);

	                   	 	//Extract state code
	                    	var stateCode=((city.split('(')[1]).split(')'))[0];

	                    	//Start generating the URL
	                    	url="http://ushotels.makemytrip.com/nexres/search/search_results.cgi?src=10022161&doa_mm="+arrMonth+"&doa_dd="+arrDay+"&doa_yy="+arrYear+"&dod_mm="+deptMonth+"&dod_dd="+deptDay+"&dod_yy="+deptYear+"&num_adults="+numOfAdults+"&num_rooms="+numOfRooms+"&city="+actualCityName+"&state="+stateCode+"&country="+country+"&num_children="+noOfChildren;

	                    }
	                    else
	                    {
							url="http://ushotels.makemytrip.com/nexres/search/search_results.cgi?src=10022161&doa_mm="+arrMonth+"&doa_dd="+arrDay+"&doa_yy="+arrYear+"&dod_mm="+deptMonth+"&dod_dd="+deptDay+"&dod_yy="+deptYear+"&num_adults="+numOfAdults+"&num_rooms="+numOfRooms+"&city="+city+"&country="+country+"&num_children="+noOfChildren;
						}
						var temp=1;

						//Appending children details to URL in  case of children, if present.
						while(temp<=noOfChildren)
						{

							url=url+"&minorAge"+temp+"="+childAges[0][temp-1];
							temp=temp+1;
						}
						url=url+"&nps=Y&tab=tab0&unps=&t0_distance=15&avail=Y";

						//Submitting the URL for search
						document.location=url;

					}
					else
					{
						//If country selected is other than US, continue with the usual GTA hotel search flow.
						document.SearchFormIntl.action = "http://hotels.makemytrip.co.in/makemytrip/searchHotelProgress.do?residentOfIndia=Y&method=searchHotels";
						document.SearchFormIntl.submit();
					}

				 }
				 else
				 {
					 window.setTimeout(createArrows1,1);
					 return false;
				 }

			}


function validateDates1()
			{
				var fromDateString = document.getElementById("arrDateOway1").value;
				var toDateString = document.getElementById("deptDateOway1").value;
				//isThisDate(fromDateString,"arrDateOway")

				if (fromDateString.length==0 && toDateString.length==0)
				{
					alert(enterDates);
					return;
				}
				if (fromDateString.length==0)
				{
					alert(enterCheckIn);
					return;
				}
				if (toDateString.length==0)
				{
					alert(enterCheckOut);
					return;
				}

				if(!isThisDate(fromDateString,"arrDateOway1")){
					return false;
				}
				if(!isThisDate(toDateString,"deptDateOway1")){
					return false;
				}
				var fromDate = buildDate(fromDateString);
				var toDate = buildDate(toDateString);
				var todayDate = new Date();
				var todayTime = todayDate.getTime();
				//alert("The from date is:" + fromDate + " and the to date is:" + toDate);
				var fromTime = fromDate.getTime();
				var toTime = toDate.getTime();
				var now=new Date().getTime();
				if (fromTime > toTime)
				{
					alert(checkIn_CheckOut);
					return false;
				}
				else if (fromTime==toTime)
				{
					alert(same_check_in_out);
					return false;
				}
				else
				{
					return true;
				}
			}


			function buildDate(dateString)    // date string is in format dd/mm//yyyy
			{
				var dd = parseInt(eval(dateString.split("/")[0]),10);
				var mm = parseInt(eval(dateString.split("/")[1]),10);
				var yyyy = parseInt(eval(dateString.split("/")[2]),10);
				var date = new Date (yyyy, (mm-1) , dd, 0, 0, 0, 0)
				return date;
			}


			function close(divID)
			{
				document.getElementById(divID).style.display = 'none'
			}




			function toggleDiv(divId)
			{
				createArrows1();
				var divObj = document.getElementById(divId);
				var display = divObj.style.display + "";
				if (display.toUpperCase()=="NONE")
				{
					divObj.style.display =  "block";
				}
				else if (display.toUpperCase()=="BLOCK")
				{
					divObj.style.display =  "none";
				}
			}
function createRooms1()
{
    var table1 = document.getElementById("guestsTable1");
	deleteTableWithHeader1(table1);
	var childrenAgesTable1 = document.getElementById("childrenAgesTable1");
	deleteTable1(childrenAgesTable1);
	var titleSpan1 = document.getElementById("titleSpan1");
	var rooms1 = document.getElementById("rooms1").value;
	for (var count=0;count<rooms1;count++)
	{
		var row = table1.insertRow(count + 1);
		row.valign = "top"
	/*	var cell1 = row.insertCell(0);*/
		var cell1 = row.insertCell(0);
		var cell2 = row.insertCell(1);
		cell1.className = "bluetext"
		cell2.className = "bluetext"
		//cell2.style.padding-left="10px"
		cell1.innerHTML =  "<select name='adults' class='childSelect' onchange='validateRoomStrength1(),updateArray("+count+",0,this)' style='width:40px'><option value='1'>1</option><option value='2'>2</option><option value='3'>3</option><option value='4'>4</option></select>";
		cell2.innerHTML = "&nbsp;&nbsp;&nbsp;&nbsp;<select name='childrenIntl' class='childSelect' style='width:40px'onchange='validateRoomStrength1(),showChildrenAges1(),showHidechildText1(),updateArray("+count+",1,this)'><option value='0' selected>0</option><option value='1'>1</option><option value='2'>2</option><option value='3'>3</option><option value='4'>4</option></select>";
		cell2.align = "left"
		cell1.align = "left";

		if(count>0){
			document.forms[1].adults[count].value=roomDtls1[count][0];
			document.forms[1].childrenIntl[count].value=roomDtls1[count][1];
		}else{
			document.forms[1].adults.value=roomDtls1[count][0];
			document.forms[1].childrenIntl.value=roomDtls1[count][1];
		}
	}
    createArrows1();
	showChildrenAges1();
  }


function createArrows1()
{
     	var rooms1 = document.getElementById("rooms1").value;
		var arrowsTableObj1 = document.getElementById("arrowsTable1");
		deleteTable1(arrowsTableObj1 );
		for (var count=0;count<rooms1;count++)
		{
			var row = arrowsTableObj1 .insertRow(count);
			row.valign = "top"
			var cell = row.insertCell(0);
			cell.className = "bluetext"
			if(count==0){
			cell.innerHTML = "&nbsp;<img src='http://images1.makemytrip.com/mmtimgs/images/arrow2.gif' height='0'><img src='http://images1.makemytrip.com/mmtimgs/images/arrow3.gif' width='25' height='3'/>Room" +  (count + 1)+":";
			}
			else{
			cell.innerHTML = "<img src='http://images1.makemytrip.com/mmtimgs/images/arrow2.gif' height='16'><img src='http://images1.makemytrip.com/mmtimgs/images/arrow3.gif' width='18' height='3'/>Room" +  (count + 1)+":";
			}
		}
}


function deleteTableWithHeader1(table1)
{
	for (var count=table1.rows.length-1;count>0;count--)
	{
		table1.deleteRow(count);
	}
}

function deleteTable1(table1)
{
	for (var count=table1.rows.length-1;count>=0;count--)
	{
		table1.deleteRow(count);
	}
}




function showChildrenAges1()
{
	for(var count=0;count<(document.forms[1].childrenIntl).length;count++){
	}
	var childrenAgeTable1 = document.getElementById("childrenAgesTable1");
	deleteTable1(childrenAgeTable1);
	var childSelects1 = document.getElementsByName("childrenIntl");
	var v = 0;
	for (var count=0;count<childSelects1.length;count++)
	{
		if (childSelects1[count].value>0)
		{
			v +=1
		}
	}
	if (v>0)
	{
		document.getElementById("titleSpan1").style.display = "block";
	}
	else
	{
		document.getElementById("titleSpan1").style.display = "none";
	}
	v = 0;

	for (var count=0;count<childSelects1.length;count++)
	{
		var childAge1 = childSelects1[count].value;
		if (childAge1>0)
		{
			var row = childrenAgeTable1.insertRow( v++);
			var cell = row.insertCell(0);
			var cell2 = row.insertCell(1);
			cell.className = "bluetext"
			cell2.className = "bluetext"
			cell.innerHTML = "&nbsp;&nbsp;Room" + (count + 1) + ":";
			var str = "";
			var childStr = "";
			str += "<table><tr>";
			var dupCnt=0;
			for(var childCount1=1;childCount1<=childAge1;childCount1++)
			{
				childStr += "Child " + childCount1 +  ":&nbsp;&nbsp;&nbsp;"
				str += "<td class='bluetext'>Child " + childCount1 +  ":<BR>";
				var selectName = "Room" + (count + 1);
				str += "<SELECT class='childSelect' name='" + selectName+"' id='Room"+count+"_"+childCount1+"' onchange='updateAgeArray("+count+","+dupCnt+",this)'>";
				for (var ageCount=1;ageCount<=12;ageCount++)//changed from 0 to 1 to make children age to start from 1
				{
					str += "<option value=" + ageCount + ">" + ageCount + "</option>";
				}
				str += "</select>";
				str += "</TD>";
				dupCnt++;
			}
			//alert("str:" + str);
			str += "</tr></table>";
			cell2.innerHTML = str;
			var dupCnt=0;
			for(var childCount=1;childCount<=childAge1;childCount++)
			{
				document.getElementById("Room"+count+"_"+childCount).value=childAges1[count][dupCnt]
				dupCnt++;
			}
		}
	  }
  	createArrows1();
}


function validateRoomStrength1()
{
	var numberOfRooms1 = document.getElementById("rooms1").value;
	var adults1 = document.getElementsByName("adults");
	var children1 = document.getElementsByName("childrenIntl");
	for (var count=0;count<numberOfRooms1;count++)
	{
		var adultsinroom1 = parseInt(adults1[count].value);
		var childrenInRoom1 = parseInt(children1[count].value);
		//alert("childrenInRoom1::" + childrenInRoom1);
		var roomStrength = adultsinroom1 + childrenInRoom1;
		if ( roomStrength > maxRoomStrength)
		{
			alert("Please check that the total number of persons (including children) per room is:" + maxRoomStrength);
			children1[count].focus();
			var childrenAgeTable1 = document.getElementById("childrenAgesTable1");
			deleteTable1(childrenAgeTable1);
			return false;
		}
		children1[count].length=maxRoomStrength-adultsinroom1;
		for(var j=0;j<=maxRoomStrength-adultsinroom1;j++){
			children1[count].options[j]=new Option(j,j,true,false);
		}
		children1[count].value=childrenInRoom1;
		// Based on children slected the number of adults will be displayed
		adults1[count].length=maxRoomStrength-childrenInRoom1;
		for(var j=0;j<maxRoomStrength-childrenInRoom1;j++){
			adults1[count].options[j]=new Option(j+1,j+1,true,false);
		}
		adults1[count].value=adultsinroom1;
	}
//	showChildrenAges();
	return true;
}


function validateHtlChain()
{
	return true;
	var htlChn1=document.forms[1].HotelChain1[0].value;
	var htlChn2=document.forms[1].HotelChain1[1].value;
	var htlChn3=document.forms[1].HotelChain1[2].value;
   	if(htlChn1!="Select" || htlChn2!="Select" || htlChn3!="Select"){
		if(htlChn1!="Select" && htlChn2!="Select" && htlChn1==htlChn2){
			alert(hotelChainSelect)
			document.forms[1].HotelChain1[1].value="Select";
			document.forms[1].HotelChain1[0].focus();
			if(htlChn1==htlChn3){
				document.forms[1].HotelChain1[2].value= "Select";
			}
			return false;
		}
		if(htlChn1!="Select" && htlChn3!="Select" && htlChn1==htlChn3){
			alert(hotelChainSelect)
			document.forms[1].HotelChain1[2].value= "Select";
			document.forms[1].HotelChain1[0].focus();
			return false;
		}
		if(htlChn3!="Select" && htlChn2!="Select" && htlChn3==htlChn2){
			alert(hotelChainSelect)
			document.forms[1].HotelChain1[2].value= "Select";
			document.forms[1].HotelChain1[1].focus();
			return false;
		}
	}

  return true;
}


function explode(divId)
{
	document.getElementById(divId).style.position = "absolute";
	document.getElementById(divId).style.left = ( document.body.scrollLeft + (window.screen.width /4) ) + "px"
	document.getElementById(divId).style.top = (  document.body.scrollTop + (window.screen.height / 11) ) + "px"
//	dojo.lfx.explode(divId, divId,900).play();
}

function loadXmlCountries()
{
if (document.implementation && document.implementation.createDocument)
	{
xmlDoc = document.implementation.createDocument("", "doc", null);
xmlDoc.load("jsp/CountryList.xml");

xmlDoc.onload =loadXML;

}else if (window.ActiveXObject)
	{
 xmlDoc = new ActiveXObject("Microsoft.XMLDOM");
 xmlDoc.async="false";
  xmlDoc.onreadystatechange=verify;
  xmlDoc.load('jsp/CountryList.xml');

  loadXML();

 	}
}


function loadXmlCities(countrycode)
{
if (document.implementation && document.implementation.createDocument)
	{
//xmlDocCities = document.implementation.createDocument("", "doc", null);
//xmlDocCities.load("jsp/CityList.xml");

loadCitiesCountry(countrycode);

}else if (window.ActiveXObject)
	{
 xmlDocCities = new ActiveXObject("Microsoft.XMLDOM");
 xmlDocCities.async="false";
  xmlDocCities.onreadystatechange=verifyCity;
  xmlDocCities.load('jsp/CityList.xml');

 // loadXML();

 	}
	alreadyLoaded =1;
}


function loadcity(countrycode)
{
 //alert(countrycode);
 if(countrycode=='dotedLine')
 {
 	var cityDefaultList = '<select id="cityNameIntl" class="childSelect" style="width:140px;">';
 	cityDefaultList += '<option value="dotedLine">----------------------</option>';
 	cityDefaultList +='</select>';

 	document.getElementById("displaycitylist").innerHTML=cityDefaultList ;

 }
 else
 {
     if(alreadyLoaded ==0){
     loadXmlCities(countrycode);
	 }
	 loadCitiesCountry(countrycode);
}
}
function loadCitiesCountry(countrycode){
var countryNodes = xmlDocCities.getElementsByTagName("country");

	for (i=0;i<countryNodes .length;i++)
	{
	if(countryNodes[i].getAttribute("code")==countrycode)
			{
										var citylist ='<select id="cityNameIntl" class="childSelect" style="width:140px;">';
										var cityNodes = countryNodes[i].childNodes;
										for(j=0;j<cityNodes.length;j++)
													{
													citylist +='<option value="'+cityNodes[j].getAttribute("code")+'">'+cityNodes[j].getAttribute("name") +'</option>';
													}
										citylist +='</select>';
										}
		document.getElementById("displaycitylist").innerHTML=citylist;
	}
}



function loadXML()
{
	var childNodes = xmlDoc.getElementsByTagName("country");
	//var countrylist='<select id="countryNameIntl" class="childSelect" onchange="loadcity(this.value)"><option value="dotedLine">------------------------</option>';
	var countrylist='<select id="countryNameIntl" class="childSelect" onchange="loadcity(this.value);"><option value="dotedLine">-------------------------</option><option value="SG">Singapore</option><option value="MY">Malaysia</option><option value="TH">Thailand</option><option value="AU">Australia</option><option value="MU">Mauritius</option><option value="GB">United Kingdom</option><option value="US">USA</option><option value="CH">Switzerland</option><option value="NZ">New Zealand</option><option value="FR">France</option><option value="LK">Sri Lanka</option><option value="CN">China</option><option value="ZA">South Africa</option><option value="DE">Germany</option><option value="dotedLine">-------------------------</option>';

	for (i=0;i<childNodes.length;i++)
	{
		countrylist +='<option value="'+childNodes[i].getAttribute("code") +'">'+childNodes[i].getAttribute("name")+'</option>';
	}
	countrylist +='</select>';
	document.getElementById("displaycountrylist").innerHTML=countrylist;
}
function verify()
{
	if (xmlDoc.readyState != 4)
	{
	return false;
	}
}
function verifyCity()
{
	if (xmlDocCities.readyState != 4)
	{
	return false;
	}
}
