var searchArray = new Array();
var currentIndex=0;
var totalElement=0;
var arrCity = new Array();

var messageType="";

var bslHeight=0;
var bslMaxHeight=0;

var bslOutDivId="";
var bslInDivId="";
var bslIncHeight=10;
var bslDecHeight=10;
var objindiv=0;
var objoutdiv=0;
var displayFlag;
var flag;
var innerDiv;
var outerDiv;
var finishingFlag;
var bslMinHeight=0;
var currentOpenDivOuter='';
var currentOpenDivInner='';
var currentAvailabilityDiv='';
var previousHotelId='';
function SH_bslIncDiv(id)
{
	
	if(bslHeight>=bslMaxHeight)
	{
		SH_showDiv(bslInDivId);
		return true;
	}
	bslHeight=bslHeight+bslIncHeight;
	e=document.getElementById(id);
	e.style.height = bslHeight + 'px';
	t=setTimeout("SH_bslIncDiv('"+id+"');",0);
}

function SH_checkAvailabilityByAjax(url,id,hotel_id)
{
	//alert(url+','+id);
	/*if(currentAvailabilityDiv!='')
	{
		if(document.getElementById('button'+previousHotelId))
		{
			document.getElementById('button'+previousHotelId).style.display="block";
			document.getElementById('button'+previousHotelId).style.visibility="visible";
		}
		if(document.getElementById(currentAvailabilityDiv))
		{
			document.getElementById(currentAvailabilityDiv).style.display="none";
			document.getElementById(currentAvailabilityDiv).style.visibility="hidden";
		}
	}*/
	//currentAvailabilityDiv=id;
	//previousHotelId=hotel_id;
	var xmlHttp_html=GetXmlHttpObject();
	var systemTime= "&ms="+new Date().getTime();
	url=url+systemTime;
	SH_showLoader(id);
	xmlHttp_html.open("GET",url,true);
	xmlHttp_html.onreadystatechange=sendReq;

	function sendReq()
	{
		//alert(xmlHttp_html.readyState);
		if(xmlHttp_html.readyState==4)
		{
			if(xmlHttp_html.status==200)
			{	
				//alert(xmlHttp_html.status);
				getdata=xmlHttp_html.responseText;
				var string='';
				var i;
				//alert(getdata);
			//hideBslLoader(id);	
			}
			var arrData=getdata.split("|");
			//alert(arrData[0]);
			if(arrData[0]=="SUCCESS")
			{
				//alert('hihi');
				document.getElementById(id).innerHTML=arrData[1];
			}
			else
			{
				if(document.getElementById('button'+hotel_id))
				{
					document.getElementById('button'+hotel_id).style.display="block";
					document.getElementById('button'+hotel_id).style.visibility="visible";
				}
				document.getElementById(id).innerHTML=arrData[1];
				
			}
			
		}
		 
	}
	xmlHttp_html.send(null);
}

function SH_validateAvailDate1(url,divId,hotelId)
{
	if(document.getElementById('checkinDay1'+hotelId).value=='')
	{
		alert('Please select a checkin day!');
		document.getElementById('checkinDay1'+hotelId).focus();
		return false;
	}
	if(document.getElementById('checkinMonthYear1'+hotelId).value=='')
	{
		alert('Please select a checkin month!');
		document.getElementById('checkinMonthYear1'+hotelId).focus();
		return false;
	}
	if(document.getElementById('checkoutDay1'+hotelId).value=='')
	{
		alert('Please select a checkout day!');
		document.getElementById('checkoutDay1'+hotelId).focus();
		return false;
	}
	if(document.getElementById('checkoutMonthYear1'+hotelId).value=='')
	{
		alert('Please select a checkout month!');
		document.getElementById('checkoutMonthYear1'+hotelId).focus();
        return false;
	}
	if(SH_validateDate('checkinDay1'+hotelId,'checkinMonthYear1'+hotelId,'checkoutDay1'+hotelId,'checkoutMonthYear1'+hotelId)==true)
	{
		var checkinMonthYear=document.getElementById('checkinMonthYear1'+hotelId).value;
		var checkoutMonthYear=document.getElementById('checkoutMonthYear1'+hotelId).value;
		var checkinDay=document.getElementById('checkinDay1'+hotelId).value;
		var checkoutDay=document.getElementById('checkoutDay1'+hotelId).value;
		var arrCheckin;
		var arrCheckout;
		var checkinDate;
		var checkoutDate;
		arrCheckin=checkinMonthYear.split("|");
		arrCheckout=checkoutMonthYear.split("|");
		checkinDate=arrCheckin[1]+'-'+arrCheckin[0]+'-'+checkinDay;
		checkoutDate=arrCheckout[1]+'-'+arrCheckout[0]+'-'+checkoutDay;
		url+='arrival_date='+checkinDate+'&departure_date='+checkoutDate+'&hotel_id='+hotelId;
		SH_checkAvailabilityByAjax(url,divId,hotelId);
		return true;
	}
	else
	{
		return false;
	}
}

function SH_changeDate(url,id)
{
	//alert(url+','+id);
	var xmlHttp_html=GetXmlHttpObject();
	var systemTime= "&ms="+new Date().getTime();
	url=url+systemTime;
	SH_showLoader(id);
	xmlHttp_html.open("GET",url,true);
	xmlHttp_html.onreadystatechange=sendReq;
	currentAvailabilityDiv='';
	previousHotelId='';
	function sendReq()
	{
		//alert(xmlHttp_html.readyState);
		if(xmlHttp_html.readyState==4)
		{
			if(xmlHttp_html.status==200)
			{	
				//alert(xmlHttp_html.status);
				getdata=xmlHttp_html.responseText;
				var string='';
				var i;
				//alert(getdata);
			//hideBslLoader(id);	
			}
			//alert(id);
				document.getElementById(id).innerHTML=getdata;
	
		}
		 
	}
	xmlHttp_html.send(null);
}

function SH_displayAvailabilityDiv(availDivId,buttonId)
{
	if(document.getElementById(buttonId))
	{
		document.getElementById(buttonId).style.display="none";
		document.getElementById(buttonId).style.visibility="hidden";
	}
	if(document.getElementById(availDivId))
	{
		document.getElementById(availDivId).style.display="block";
		document.getElementById(availDivId).style.visibility="visible";
	}
}

function SH_displayDiv(outid,inid,height)
{
	if(height=="" ||height=="undefined")
		height=20;
	if(objoutdiv||objindiv)
	{
		hideDiv(objoutdiv.id,objindiv.id);
	}
	
	objoutdiv=document.getElementById(outid);
	objindiv=document.getElementById(inid);
	bslInDivId=inid;
	bslOutDivId=outid;
	bslMaxHeight=height;
	bslHeight=0;
	displayFlag=true;
	SH_bslIncDiv(bslOutDivId);
	SH_bslIncDiv(bslInDivId);

}
function SH_showDiv(id)
{
	document.getElementById(id).style.visibility="visible";
	document.getElementById(id).style.display='block';
	
	return true;
}
function SH_hide(id)
{
	document.getElementById(id).style.visibility="hidden";
	document.getElementById(id).style.display='none';
	displayFlag=false;
	return true;
}
function hideDiv(outdiv,indiv)
{
	
	document.getElementById(indiv).style.visibility="hidden";
	document.getElementById(indiv).style.display='none';
	e=document.getElementById(indiv);
	e.style.height = 0 + 'px';
	e=document.getElementById(outdiv);
	e.style.height = 0 + 'px';
	bslHeight=0;
	displayFlag=false;
	return true;
}

function SH_showAvailableRooms(url,id)
{
	var xmlHttp_html=GetXmlHttpObject();
	var systemTime= "&ms="+new Date().getTime();
	url=url+systemTime;
	
	xmlHttp_html.open("GET",url,true);
	//xmlHttp_html.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
	//xmlHttp_html.setRequestHeader("Content-length", parameters.length);
   // xmlHttp_html.setRequestHeader("Connection", "close");
  	xmlHttp_html.onreadystatechange=sendReq;

	function sendReq()
	{
		//alert(xmlHttp_html.readyState);
		if(xmlHttp_html.readyState==4)
		{
		//alert(xmlHttp_html.status);
			if(xmlHttp_html.status==200)
			{
				getdata=xmlHttp_html.responseText;
				//alert(getdata);
				document.getElementById(id).innerHTML=getdata;
                
			}
			else
				document.getElementById(id).innerHTML="";
			//hideBslLoader(id);
		}


	}
	xmlHttp_html.send(null);

}



function SH_bslDecDiv(id)
{

	if(bslHeight<=bslMinHeight)
	{
		SH_hide(bslInDivId);
		return true;
	}
	bslHeight=bslHeight-bslDecHeight;
	e=document.getElementById(id);
	e.style.height = bslHeight + 'px';
	t=setTimeout("SH_bslDecDiv('"+id+"');",0);
}
function SH_hideDiv(outid,inid,height)
{
	finishingFlag=false;
	bslInDivId=inid;
	bslOutDivId=outid;
	bslHeight=height;
	SH_bslDecDiv(bslOutDivId);
	SH_bslDecDiv(bslInDivId);
	displayFlag=false;
	currentOpenDivOuter='';
	currentOpenDivInner='';
}

function SH_callByAjax(evt,url,id,key)
{
	var myKeyCode="";
	if(window.event)
	{
		myKeyCode=evt.keyCode;
	}
	else
		myKeyCode=evt.which;
	if(myKeyCode=="")
		myKeyCode=evt.keyCode;
	//var character = String.fromCharCode(myKeyCode);
//	alert('Character was ' + character);

	//url=url+character;
	if(key=='')
	{
		if(document.getElementById('searchhotel'))
		{
			document.getElementById('searchhotel').style.display="none";
			document.getElementById('searchhotel').style.visibility="hidden";
		}
		return;
	}
	

	if(myKeyCode==38)
	{
		SH_previousIndex();
	}
	if(myKeyCode==40)
	{
		SH_nextIndex();
		
	}
	if(myKeyCode==13)
	{
		SH_fillInBoxByKey(evt);

	}
	
	if(myKeyCode!=37 && myKeyCode!=38 && myKeyCode!=39 && myKeyCode!=40 && myKeyCode!=13)
	{
		
		url="searchbyajax.php"+url;
		// for live
		url="/hotels/"+url;
		//for local
		//url="http://192.168.1.10/mastholiday.com/hotels/"+url;
		SH_getResult(url,id);
	}

}

function SH_callByAjax1(url,city,id)
{
	
	if(isCityExist(city)==true)
	{
		//if(displayFlag==true)
		//{
			//hideDiv('out'+city,id);
			//SH_hideDiv(currentOpenDivOuter,currentOpenDivInner,90);
			
		//}
		
			SH_displayDiv('out'+city,id,120);
		
		//if(displayFlag==true)
		//{
			
		//	SH_hideDiv(currentOpenDivOuter,currentOpenDivInner,90);
			
		//}
		//else
		//{
		//	SH_displayDiv('out'+city,id,90);
		//}
		return;
	}
	var xmlHttp_html=GetXmlHttpObject();
	var systemTime= "&ms="+new Date().getTime();
	url=url+systemTime;
	SH_displayDiv('out'+city,id,40);
	SH_showLoader(id);
	xmlHttp_html.open("GET",url,true);
		xmlHttp_html.onreadystatechange=sendReq;
	function sendReq()
	{
		//alert(xmlHttp_html.readyState);
		if(xmlHttp_html.readyState==4)
		{
			//alert(xmlHttp_html.status);
			if(xmlHttp_html.status==200)
			{	
				getdata=xmlHttp_html.responseText;
				//initShowHideDivs1();
				//if(document.getElementById(id))
				document.getElementById(id).innerHTML=getdata;
				//alert(currentOpenDivOuter+','+currentOpenDivInner);
				//if(displayFlag==true)
				//{
					//hideDiv('out'+city,id);
					//SH_hideDiv(currentOpenDivOuter,currentOpenDivInner,90);
					
				//}
				//else
				//{
					SH_displayDiv('out'+city,id,120);
				//}
				arrCity[arrCity.length]=city;
				
				//initShowHideDivs();
			}
				
		}
	
	}
	xmlHttp_html.send(null); 
}

function isCityExist(city)
{
	var i=0;
	for(i=0;i<arrCity.length;++i)
	{
		if(arrCity[i]==city)
			return true;
	}
		return false;
}


function SH_getResult(url,id)
{
	//alert(url);
	var xmlHttp_html=GetXmlHttpObject();
	var systemTime= "&ms="+new Date().getTime();
	url=url+systemTime;
	SH_showLoader(id);
	xmlHttp_html.open("GET",url,true);
	//xmlHttp_html.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
	//xmlHttp_html.setRequestHeader("Content-length", parameters.length);
   // xmlHttp_html.setRequestHeader("Connection", "close");
  	xmlHttp_html.onreadystatechange=sendReq;

	function sendReq()
	{
		//alert(xmlHttp_html.readyState);
		if(xmlHttp_html.readyState==4)
		{
			//alert(xmlHttp_html.status);
			if(xmlHttp_html.status==200)
			{	
				getdata=xmlHttp_html.responseText;
				//alert(getdata);
				var string='';
				var i;
				if(getdata!='')
				{
					searchArray=getdata.split("|");
					if(document.getElementById('searchhotel'))
					{
						document.getElementById('searchhotel').style.display="block";
						document.getElementById('searchhotel').style.visibility="visible";
					}
					totalElement=searchArray.length;
					currentIndex=0;
					string=searchArray[0];
				}
				else
				{
					if(document.getElementById('searchhotel'))
					{
						document.getElementById('searchhotel').style.display="none";
						document.getElementById('searchhotel').style.visibility="hidden";
					}
				}
				document.getElementById(id).innerHTML=string;

			}
			else
				document.getElementById(id).innerHTML="";
			//hideBslLoader(id);	
		}
		
	
	}
	xmlHttp_html.send(null); 
		
}

function SH_nextIndex()
{
	//alert(searchArray[currentIndex]);
	
	if(totalElement>0 && currentIndex<(totalElement-1))
	{
		
		currentIndex++;
	}
	else
	{
		document.getElementById(searchArray[currentIndex]).style.background="#FFFFFF";
		currentIndex=1;
	}
	if(document.getElementById(searchArray[currentIndex]))
	{
		if(document.getElementById(searchArray[currentIndex-1]))
		{
			document.getElementById(searchArray[currentIndex-1]).style.background="#FFFFFF";
			//document.getElementById(searchArray[currentIndex-1]).style.color="#000000";
		}
		document.getElementById(searchArray[currentIndex]).focus();
		document.getElementById(searchArray[currentIndex]).style.background="#E8FBFF";
		//document.getElementById(searchArray[currentIndex]).style.color="#FFFFFF";
	}

}

function SH_removeSearchDiv()
{
	if(document.getElementById('searchhotel'))
	{
		document.getElementById('searchhotel').style.display="none";
		document.getElementById('searchhotel').style.visibility="hidden";
	}
	if(document.getElementById('destination'))
	{
		//document.getElementById('destination').focus();

	}
}

function SH_previousIndex()
{
	//alert(searchArray[currentIndex]);
	
	if(totalElement>0 && currentIndex>1)
	{
		
		currentIndex--;
	}
	else
	{
		
		document.getElementById(searchArray[currentIndex]).style.background="#FFFFFF";
		currentIndex=totalElement-1;
	}
	if(document.getElementById(searchArray[currentIndex]))
	{
		if(document.getElementById(searchArray[currentIndex+1]))
		{
			document.getElementById(searchArray[currentIndex+1]).style.background="#FFFFFF";

		}
		document.getElementById(searchArray[currentIndex]).focus();
		document.getElementById(searchArray[currentIndex]).style.background="#E8FBFF";
		//document.getElementById(searchArray[currentIndex]).style.color="#FFFFFF";
	}
}

function SH_showLoader(divId)
{
	
	if(document.getElementById(divId))
		document.getElementById(divId).innerHTML="<div id='loaderDiv' style='padding-left: 10px'><b>Loading</b>...</div>";
	 
}

function SH_onMouseOver(id)
{
	if(document.getElementById(searchArray[currentIndex]))
	{
		document.getElementById(searchArray[currentIndex]).style.background="#FFFFFF";
		//document.getElementById(searchArray[currentIndex]).style.color="#000000";
	}
	document.getElementById(id).style.background="#E8FBFF";
	//document.getElementById(id).style.color="#FFFFFF";
	var i;
	for(i=1;i<totalElement;++i)
	{
		if(id==searchArray[i])
		{
			currentIndex=i;
			break;
		}
	}
}

function SH_onMouseOut(id)
{
	document.getElementById(id).style.background="#FFFFFF";
	document.getElementById(id).style.color="#000000";
}


function SH_fillInBoxByMouse(id)
{
	if(document.getElementById('destination'))
	{
		document.getElementById('destination').value=id;
		document.getElementById('destination').focus();

	}
	if(document.getElementById('searchhotel'))
	{
		document.getElementById('searchhotel').style.display="none";
		document.getElementById('searchhotel').style.visibility="hidden";
	}
	totalElement=0;
	currentIndex=0;
	return false;
}

function SH_fillInBoxByKey(evt)
{
	//alert('hihi');
	if(evt.keyCode==38)
	{
		SH_previousIndex();
	}
	if(evt.keyCode==40)
	{
		//alert('hihi');
		SH_nextIndex();
		
	}
	if(evt.keyCode==13 || evt.keyCode==32)
	{
		if(document.getElementById('destination'))
		{
			document.getElementById('destination').value=searchArray[currentIndex];
			document.getElementById('destination').focus();

		}
		if(document.getElementById('searchhotel'))
		{
			document.getElementById('searchhotel').style.display="none";
			document.getElementById('searchhotel').style.visibility="hidden";
		}
		totalElement=0;
		currentIndex=0;
	}
}



function checkKey(evt,url,id)
{
	if (navigator.appName=="Microsoft Internet Explorer")
	{
		if (evt.keyCode>64 && evt.keyCode<122 || evt.keyCode==32)
		{
			callByAjax(url,id)
		}
		else 
			return false;
	}
	else
	{
		if (evt.which>64 && evt.which<122 || evt.which==32)
		{
			callByAjax(url,id)
		}
		else 
			return false; 
	}
	
}

function SH_validateAvailDate()
{
	
	if(document.getElementById('checkinDay1').value=='')
	{
		alert('Please select a checkin day!');
		document.getElementById('checkinDay1').focus();
		return false;
	}
	if(document.getElementById('checkinMonthYear1').value=='')
	{
		alert('Please select a checkin month!');
		document.getElementById('checkinMonthYear1').focus();
		return false;
	}
	if(document.getElementById('checkoutDay1').value=='')
	{
		alert('Please select a checkout day!');
		document.getElementById('checkoutDay1').focus();
		return false;
	}
	if(document.getElementById('checkoutMonthYear1').value=='')
	{
		alert('Please select a checkout month!');
		document.getElementById('checkoutMonthYear1').focus();
		return false;
	}
	if(SH_validateDate('checkinDay1','checkinMonthYear1','checkoutDay1','checkoutMonthYear1')==true)
	{
		document.searchForm1.submit();
		return true;
	}
	else
	{
		return false;
	}
}

function SH_validateSearch()
{
	if(document.getElementById('destination').value=='')
	{
		alert('Please enter the destination to search!');
		document.getElementById('destination').focus();
		return false;
	}
	if(document.getElementById('checkinDay').value=='')
	{
		alert('Please select a checkin day!');
		document.getElementById('checkinDay').focus();
		return false;
	}
	if(document.getElementById('checkinMonthYear').value=='')
	{
		alert('Please select a checkin month!');
		document.getElementById('checkinMonthYear').focus();
		return false;
	}
	if(document.getElementById('checkoutDay').value=='')
	{
		alert('Please select a checkout day!');
		document.getElementById('checkoutDay').focus();
		return false;
	}
	if(document.getElementById('checkoutMonthYear').value=='')
	{
		alert('Please select a checkout month!');
		document.getElementById('checkoutMonthYear').focus();
		return false;
	}
	if(SH_validateDate('checkinDay','checkinMonthYear','checkoutDay','checkoutMonthYear')==true)
	{
		document.searchForm.submit();
		return true;
	}
	else
	{
		return false;
	}

}

function SH_validateDate(checkinDay,checkinMonthYear,checkoutDay,checkoutMonthYear)
{
	var checkinDay=parseInt(document.getElementById(checkinDay).value);
	var checkoutDay=parseInt(document.getElementById(checkoutDay).value);
	var checkinMonth;
	var checkoutMonth;
	var checkinYear;
	var checkoutYear;
	var ckiMonthYear=document.getElementById(checkinMonthYear).value;
	var ckoMonthYear=document.getElementById(checkoutMonthYear).value;
	var arrCheckin = new Array();
	var arrCheckout = new Array();
	var curdate=new Date();
	var flag=false;
	var flag1=false;
	arrCheckin=ckiMonthYear.split('|');
	arrCheckout=ckoMonthYear.split('|');
	checkinMonth=parseInt(arrCheckin[0]);
	checkinYear=parseInt(arrCheckin[1]);
	checkoutMonth=parseInt(arrCheckout[0]);
	checkoutYear=parseInt(arrCheckout[1]);
	//alert(checkinMonth);
	//alert(curdate.getMonth()+1);
	if((checkinYear>curdate.getFullYear()) || ((checkinMonth>curdate.getMonth()+1) && checkinYear>=curdate.getFullYear()) || ((checkinDay>=curdate.getDate()) && (checkinMonth>=curdate.getMonth()+1) && checkinYear>=curdate.getFullYear()))
	{
			flag=true;
	}
	if(!flag)
	{
		alert('Checkin date should be greater the current date!');
		return false;
	}
	flag1=false;
	//alert(checkinDay);
	//alert(checkoutDay);
	
	if((checkoutYear>checkinYear) || ((checkoutMonth>checkinMonth) && checkoutYear>=checkinYear) || ((checkoutDay>checkinDay) && (checkoutMonth>=checkinMonth) && checkoutYear>=checkinYear))
	{
			flag1=true;
	}
	if(!flag1)
	{
		alert('Checkout date should be greater than checkin date!');
		return false;
	}
	return true;

}

function SH_showHideRoomDetail(id)
{
		if(document.getElementById('div'+id))
		{
			//alert(id);
			//document.getElementById('tr'+id).style.display="block";
			if(document.getElementById('div'+id).style.visibility=="visible")
			{
				document.getElementById('div'+id).style.visibility="hidden";
				document.getElementById('div'+id).style.display="none";
			}
			else
			{
				document.getElementById('div'+id).style.visibility="visible";
				document.getElementById('div'+id).style.display="block";
			}
		}
	
}


function SH_openBigImage(img_url)
{
	if(document.getElementById('bigImgDiv'))
	{
		document.getElementById('bigImgDiv').innerHTML='<img src='+img_url+'>';
	}
}

function SH_bookHotel(url,strSelectedRooms)
{
	var flag=false;
	//alert(strSelectedRooms);
	var arrSelectedRooms=strSelectedRooms.split("~");
	var i=0;
	var nrRoomsStr='';
	for(i=0;i<arrSelectedRooms.length;++i)
	{
		if(document.getElementById('select'+arrSelectedRooms[i]).value!='')
		{
			nrRoomsStr=nrRoomsStr+'&nr_rooms_'+arrSelectedRooms[i]+'='+document.getElementById('select'+arrSelectedRooms[i]).value;
			flag=true;
		}
	}
	if(flag==false)
	{
		alert('Please select atleast one room!');
		return false;
	}
	else
	{
		url=url+nrRoomsStr;
		location.href=url;
	}
}

function SH_setIntialDate()
{
     var currentDate = new Date();
    var currentYear = 1900 + currentDate.getYear();
    var dailyMS = 24*60*60*1000;
    var arrivalDate = new Date(currentDate.getTime());
    var departureDate = new Date(currentDate.getTime() + 1*dailyMS);
    var arrivalYear = 1900+arrivalDate.getYear();
    var arrivalMonth = 1+arrivalDate.getMonth();
    var arrivalDay = arrivalDate.getDate();
    var departureYear = 1900+departureDate.getYear();
    var departureMonth = 1+departureDate.getMonth();
    var departureDay = departureDate.getDate();
    var a=document.searchForm;
    if ((a.checkinDay.selectedIndex == 0) && (a.checkinMonthYear.selectedIndex == 0) && (a.checkoutDay.selectedIndex == 0) && (a.checkoutMonthYear.selectedIndex == 0))
    {
        var arrivalMonthIndex=1;
        var departureMonthIndex=1;
        if(departureDay<arrivalDay)
            {
                departureMonthIndex=2;
            }
        a.checkinDay.options[arrivalDay].selected = true;
        a.checkinMonthYear.options[arrivalMonthIndex].selected = true;
        a.checkoutDay.options[departureDay].selected = true;
        a.checkoutMonthYear.options[departureMonthIndex].selected = true;
    }
}

function SH_setIntialDate1()
{
     var currentDate = new Date();
    var currentYear = 1900 + currentDate.getYear();
    var dailyMS = 24*60*60*1000;
    var arrivalDate = new Date(currentDate.getTime());
    var departureDate = new Date(currentDate.getTime() + 1*dailyMS);
    var arrivalYear = 1900+arrivalDate.getYear();
    var arrivalMonth = 1+arrivalDate.getMonth();
    var arrivalDay = arrivalDate.getDate();
    var departureYear = 1900+departureDate.getYear();
    var departureMonth = 1+departureDate.getMonth();
    var departureDay = departureDate.getDate();
    var a=document.searchForm1;
    if ((a.checkinDay1.selectedIndex == 0) && (a.checkinMonthYear1.selectedIndex == 0) && (a.checkoutDay1.selectedIndex == 0) && (a.checkoutMonthYear1.selectedIndex == 0))
    {
        var arrivalMonthIndex=1;
        var departureMonthIndex=1;
        if(departureDay<arrivalDay)
            {
                departureMonthIndex=2;
            }
        a.checkinDay1.options[arrivalDay].selected = true;
        a.checkinMonthYear1.options[arrivalMonthIndex].selected = true;
        a.checkoutDay1.options[departureDay].selected = true;
        a.checkoutMonthYear1.options[departureMonthIndex].selected = true;
    }
}