//================================Start AsyncCallBack scripts=================================================
var __nonMSDOMBrowser = (window.navigator.appName.toLowerCase().indexOf('explorer') == -1);
var _strpathCar="UcSearchCar1_";

function setPagePathCAR(paraPath)
{
	_strpathCar=Trim(paraPath);
}

function getCountryParamsCar()
{
	document.all(_strpathCar+'hidSeacrhFor').value='country';	
	var strMenuItemType;
	if (document.all(_strpathCar+'hidMenuItemId').value=='')
	{
		strMenuItemType="CARHIRE"
	}
	else
	{
		strMenuItemType=document.all(_strpathCar+'hidMenuItemId').value
	}
	var strVal=document.all(_strpathCar+'hidSeacrhFor').value + ":" + strMenuItemType + ":" + document.getElementById(_strpathCar+'ddlServices').value
	//alert(strVal)
	return strVal;
}

function fillCountriesCar(strCountries,cont)
{
	if(document.getElementById(_strpathCar+'lblHeader'))
		document.getElementById(_strpathCar+'lblHeader').innerHTML=document.getElementById(_strpathCar+'ddlServices').options[document.getElementById(_strpathCar+'ddlServices').selectedIndex].text;
	//=====================================================================================================
	
	var arrDiv=strCountries.split('*');	
	
	var arrCountryItems = arrDiv[0].split(',');	
	
	//=======new addition on 25-jan-2006
	if(document.all(_strpathCar+'ddlServices').value=="3")  
	{
		//that is SHOW ANY FOR CITIES IN CASE OF CAR RENTAL
		getCitiesCar("-1:Any",null);
	}
	else
		getCitiesCar(arrDiv[1],null);
	//=============================
	
	document.getElementById(_strpathCar+'ddlCountries').innerHTML="";

	for (cntr = 0;cntr < arrCountryItems.length; cntr++)
	{
		var arrCountryIndvItem=arrCountryItems[cntr].split(':');
		
		if(arrCountryIndvItem.length>1)
		{
			var oOption = document.createElement("OPTION"); 
			var oOptionToSelect;
			oOption.text=arrCountryIndvItem[1]; 
			oOption.value=arrCountryIndvItem[0]; 

			if(__nonMSDOMBrowser)
				document.getElementById(_strpathCar+'ddlCountries').add(oOption,null); 				
			else
				document.getElementById(_strpathCar+'ddlCountries').add(oOption); 				
		}
	}
}
//=======================end addition on 6-dec-2005

function getCityParamsCar()
{
	document.all(_strpathCar+'hidSeacrhFor').value='city';	
	var strMenuItemType;
	if (document.all(_strpathCar+'hidMenuItemId').value=='')
	{
		strMenuItemType="CARHIRE"
	}
	else
	{
		strMenuItemType=document.all(_strpathCar+'hidMenuItemId').value
	}
	//=====new add by irabanta on 25-jan-2006
	var strVal;
	if(document.all(_strpathCar+'ddlServices').value=="3") //case of car rental
		strVal=document.all(_strpathCar+'hidSeacrhFor').value + ":" + strMenuItemType + ":-1";  //-1 in country indicates city should be only any
	else
		strVal=document.all(_strpathCar+'hidSeacrhFor').value + ":" + strMenuItemType + ":" + document.getElementById(_strpathCar+'ddlCountries').value
	//=====xxxxxxxxxxxxx====================
	//alert(strVal)
	return strVal;
}

function getCitiesCar(strCityDet,cont)
{
	var arrDiv=strCityDet.split('*');	
	var arrCityItems = arrDiv[0].split(',');	

	document.getElementById(_strpathCar+'ddlCities').innerHTML="";
	
	for (cntr = 0;cntr < arrCityItems.length; cntr++)
	{
		var arrCityIndvItem=arrCityItems[cntr].split(':');
		//alert(arrCityIndvItem.length.toStringCar());
		if(arrCityIndvItem[0].length>0)
		{
			var oOption = document.createElement("OPTION"); 
			var oOptionToSelect;
			oOption.text=arrCityIndvItem[1]; 
			oOption.value=arrCityIndvItem[0]; 

			if(__nonMSDOMBrowser)
				document.getElementById(_strpathCar+'ddlCities').add(oOption,null); 				
			else
				document.getElementById(_strpathCar+'ddlCities').add(oOption); 				
		}
	}
}	

function errorCityCar(res,cont)
{
	alert(res);
}
function fillCityAsAnyCar()
{
	var oOption1 = document.createElement("OPTION"); 
	oOption1.text="Any"; 
	oOption1.value="-1";
	if(__nonMSDOMBrowser)
		document.getElementById(_strpathCar+'ddlCities').add(oOption1,null); 				
	else
		document.getElementById(_strpathCar+'ddlCities').add(oOption1); 				
}


//=======================================restore previous settings==========================================
function restorePreviousCar()
{
	if(document.all('hidCurProperty').value.length>0)
	{
		document.getElementById(_strpathCar+'ddlServices').value=document.all('hidCurProperty').value;
		WebForm_DoAsyncCallback('frmDefault',getPreviousCountryParamsCar(),fillPreviousCountriesCar,"",errorCityCar);
	}
}
function getPreviousCountryParamsCar()
{
	document.all(_strpathCar+'hidSeacrhFor').value='country';	
	var strMenuItemType;
	if (document.all(_strpathCar+'hidMenuItemId').value=='')
	{
		strMenuItemType="CARHIRE"
	}
	else
	{
		strMenuItemType=document.all(_strpathCar+'hidMenuItemId').value
	}
	var strVal=document.all(_strpathCar+'hidSeacrhFor').value + ":" + strMenuItemType + ":" + document.getElementById(_strpathCar+'ddlServices').value + "|" + document.all('hidCurCountry').value;
 	return strVal;
}

function fillPreviousCountriesCar(paraCountryDet)
{
	var arrDiv=paraCountryDet.split('*');  //becoz countries and cities are separated by *
	//-----------set corresponding cities-----------------
	document.getElementById(_strpathCar+'ddlCities').innerHTML="";
	//new addition by irabanta on 25-jan-2006
	if(document.all(_strpathCar+'ddlServices').value=="3")  //car rental case
	{
		fillCityAsAnyCar();
	}//xxxxxxxxxxxxxxxxxxxxxxxx
	else if(arrDiv.length>1)
	{
		if(arrDiv[1].length==0)
		{//in case of empty
			fillCityAsAnyCar();
		}
		else
		{
			getPreviousCitiesNewCar(arrDiv[1],null); //all cities
		}
	}
	else
	{ //means, there is no city
		fillCityAsAnyCar();
	}
	//----------------------------------------------------
	
	var arrCityItems = arrDiv[0].split(',');
	document.getElementById(_strpathCar+'ddlCountries').innerHTML="";
	var index=-1;
	for (cntr = 0;cntr < arrCityItems.length; cntr++)
	{
		index=index+1;
		var arrCityIndvItem=arrCityItems[cntr].split(':');
		if(arrCityIndvItem[0].length>0)
		{
			var oOption = document.createElement("OPTION"); 
			oOption.text=arrCityIndvItem[1]; 
			oOption.value=arrCityIndvItem[0];
			if(__nonMSDOMBrowser)
				document.getElementById(_strpathCar+'ddlCountries').add(oOption,null); 				
			else
				document.getElementById(_strpathCar+'ddlCountries').add(oOption); 				
		}
		else
		{//no countries found
			var oOption = document.createElement("OPTION"); 
			oOption.text="Any"; 
			oOption.value="-1";
			if(__nonMSDOMBrowser)
				document.getElementById(_strpathCar+'ddlCountries').add(oOption,null); 				
			else
				document.getElementById(_strpathCar+'ddlCountries').add(oOption);
		}
	}
	if(index>-1)
		document.getElementById(_strpathCar+'ddlCountries').value=document.all('hidCurCountry').value;
	else
		{//no countries found
			var oOption = document.createElement("OPTION"); 
			oOption.text="Any"; 
			oOption.value="-1";
			if(__nonMSDOMBrowser)
				document.getElementById(_strpathCar+'ddlCountries').add(oOption,null); 				
			else
				document.getElementById(_strpathCar+'ddlCountries').add(oOption);
		}
}	

function getPreviousCitiesNewCar(strCityDet,cont)
{
	var arrCityItems = strCityDet.split(',');
	document.getElementById(_strpathCar+'ddlCities').innerHTML="";

	var index=-1;
	for (cntr = 0;cntr < arrCityItems.length; cntr++)
	{
		index=index+1;
		var arrCityIndvItem=arrCityItems[cntr].split(':');
		if(arrCityIndvItem[0].length>0)
		{
			var oOption = document.createElement("OPTION"); 
			oOption.text=arrCityIndvItem[1]; 
			oOption.value=arrCityIndvItem[0];
			if(__nonMSDOMBrowser)
				document.getElementById(_strpathCar+'ddlCities').add(oOption,null); 				
			else
				document.getElementById(_strpathCar+'ddlCities').add(oOption); 				
		}
		else
		{
			fillCityAsAnyCar();
		}
	}
	if(index>-1)
	{
		document.getElementById(_strpathCar+'ddlCities').value=document.all('hidCurCity').value;
	}
}	
//================================end AsyncCallBack scripts=================================================

/*
WARNING: this script file is duplicate of servicesSearch.js.
TODO: if any functionality is needed to be changed, then do it in the CarRentalSearch.js
		Then copy the codings from there and overwrite here.
		Then replace ucSearch word by ucCentralPane_ucSearch
*/

function onvalidateCar()
{
	document.all(_strpathCar+'hidCountry').value=document.getElementById(_strpathCar+'ddlCountries').value;
	document.all(_strpathCar+'hidCityXid').value=document.getElementById(_strpathCar+'ddlCities').value;
	
	//=======================for restore values =================================================
	document.all('hidCurProperty').value=document.getElementById(_strpathCar+'ddlServices').value;
	document.all('hidCurCountry').value=document.getElementById(_strpathCar+'ddlCountries').value;
	document.all('hidCurCity').value=document.getElementById(_strpathCar+'ddlCities').value;
	//========================end new addition on 6-dec-2005======================================
	if (document.all(_strpathCar+'txtpickupdate').value=="")
	{
		alert ("Please select a Pickup date ")
		//document.all(_strpathCar+'txtpickupdate').focus()
		return false;
	}
	
	if (document.all(_strpathCar+'txtdropOffdate').value=="")
	{
		alert ("Please select a Dropoff date")
		//document.all(_strpathCar+'txtdropOffdate').focus()
		return false;
	}
	
	if (document.all(_strpathCar+'ddStartTime').value == "-1")
	{
	alert("Please Select your Pick-up time") 
	return false;
	}

	//alert(document.all(_strpathCar+'ddlEndTime').value);
	if (document.all(_strpathCar+'ddlEndTime').value == "-1")
	{
	alert("Please Select your Drop-Off time") 
	return false;
	}	
	if (document.all(_strpathCar+'ddlCountries').value=="")
	{
		alert ("No valid Country found")
		return false;
	}
	
	if (document.all(_strpathCar+'ddlCities').value=="")
	{
		alert ("Select a city")
		return false;
	}
	
	var arrivaldate=document.all(_strpathCar+'txtPickupdate').value
	
	var departuredate=document.all(_strpathCar+'txtdropOffdate').value
	
	if(isValidDate(document.all(_strpathCar+'txtPickupdate').value,'1')==false)
		return false;

	if(isValidDate(document.all(_strpathCar+'txtdropoffdate').value,'1')==false)
		return false;
	
	if (document.all(_strpathCar+'dateformatvalue').value == 103 || document.all(_strpathCar+'dateformatvalue').value =="")
	{
		splitdatevaluein=document.all(_strpathCar+'txtPickupDate').value.split('/');
		dateValuedayin=splitdatevaluein[0]
		dateValuemonthin=splitdatevaluein[1]
		dateValueyearin=splitdatevaluein[2]
		dateValuein=dateValuemonthin+'/'+dateValuedayin+'/'+dateValueyearin
		cd=new Date(dateValuein)
		
		splitdatevalue=document.all(_strpathCar+'txtDropoffDate').value.split('/');
		dateValueday=splitdatevalue[0]
		dateValuemonth=splitdatevalue[1]
		dateValueyear=splitdatevalue[2]
		dateValue=dateValuemonth+'/'+dateValueday+'/'+dateValueyear
		cd1=new Date(dateValue)
	}
	else
	{
		cd=new Date(document.all(_strpathCar+'txtPickupDate').value)
		cd1=new Date(document.all(_strpathCar+'txtdropoffdate').value)
	}

	if(cd1<cd)
	{
		alert("Dropoff date should be greater than Pickup date ")
		return false;
	}
	
	//---------checkindate should be 3 days greater than today's date
	varstrCurDate=document.all(_strpathCar+'hidCurDate').value;
	var curDate=new Date(varstrCurDate);
	if(cd<=curDate)
	{
		alert('Arrival Date must be at least 3 days from the current date!');
		return false;
	}
	//=============================================================
	//Added by Mintu on Nov 26 2005
	varstrServiceType = document.all(_strpathCar+'ddlServices').value;
	varstrNoofDays = document.all(_strpathCar+'txtNoOfDays').value;
	var itype = parseInt(varstrServiceType);
	var ino=parseInt(varstrNoofDays);
	if(itype==17) //&& isNaN(ino)==false)
	{
		if(ino<7 || ino>37)
		{
			alert('The Service is available between 7 days and 37 days only');
			return false;
		}
	}
	
	//=============================================================
	
	document.all(_strpathCar+'txtNoOfDays').value = (( cd1 - cd ) / (  24 * 60 * 60 * 1000 ));
	
	if (document.all(_strpathCar+'minqty').value!=0)
	{
		noofnights=eval(document.all(_strpathCar+'txtNoOfDays').value)
		minqty=eval(document.all(_strpathCar+'minqty').value)
		maxqty=eval(document.all(_strpathCar+'maxqty').value)
		
		if((noofnights < minqty)||(noofnights > maxqty))
		{
			alert ('The service is available between '+document.all(_strpathCar+'minqty').value+' Days and '+document.all(_strpathCar+'maxqty').value+' Days only ')
			//document.all(_strpathCar+'txtPickUpdate').focus()
			return false;
		}
	}
	//================
	//document.all(_strpathCar+'divSearch').style.display='none';
	VisibleAnimation();
	//================	
	return true;
}
/* end of Validate */

function findcityCar(city,citypid)
{
	var Pid=document.all(_strpathCar+'ddlCountry').options[document.all(_strpathCar+'ddlCountry').selectedIndex].value;	
	var Loc =document.all(_strpathCar+'CityXid1').value;
	var LocPid =document.all(_strpathCar+'City1').value;	
	var LocCountry =document.all(_strpathCar+'CountryXid1').value;	
	var serviceId=document.all(_strpathCar+'ddlServices').value;

	if (serviceId=="3")
	{
		if((Pid!=""))
		{	
			if ((Pid=="326") || (Pid=="314"))
			{
			document.all(_strpathCar+'ddlCategory').disabled = true; 
			} 
			else
			{
			document.all(_strpathCar+'ddlCategory').disabled = false;
			}
		}	
	}
		
	var flag;
	
	var sLoc;
	sLoc = "";		
	sLoc = '<SELECT  name=city class=select>';

	
	var aLoc1 = Loc.split(':');
	var aLocPid1 = LocPid.split(':');
	var aLocCountry1 = LocCountry.split(':');
	lop = aLoc1.length;	
    for (j = 0;j < lop; j++)
	{
		al = aLoc1[j]
		aLoc = al.split('|');
		ali = aLocPid1[j]
		aLocPid = ali.split('|');

		alc = aLocCountry1[j]
		aLocCountry = alc.split('|');
		b = aLoc.length;
		for(i = 0; i < b; i++)
		{
			if(Pid == aLocCountry[i])
			{

				flag = true;
				sLoc = sLoc + '<option value="'+ aLoc[i] +'">'+ aLocPid[i] +'</option>';
				city1=aLoc[i]

			}
			if(flag == true && i < b)
			{

				if(Pid != aLocCountry[i + 1])
				{
					//break;
				}
			}			
		}
		if (flag == true)
			sLoc = sLoc //+ '<option value="">----------</option>';
	}
		
	sLoc = sLoc + '</select>&nbsp;<b class="red">*</b>';
	document.all(_strpathCar+'CityID').innerHTML = sLoc;
	//document.frmsearch.city.value=city1
	//alert(city1);
}
/* end of findcityCar*/

function checkinfocusCar()
{
	var currentdate=new Date();
	currentdate.setDate(currentdate.getDate()+2)	//arrival date should be atleast 3rd day from today
		
	arrivalDate=document.all(_strpathCar+'txtPickUpdate').value;
	nights = document.all(_strpathCar+'txtNoOfDays').value;
	var arrivalDateSplit,arrivalday,arrivalmonth,arrivalyear,arrivalDatemdy,arrivaldatefinal;
	var Addmillisec,depart,departDay,departMon,departYear,actualmonth;

	if ((nights !="") && ((isNaN(nights)) || (nights <=0)))
	{
		alert("No. Of Nights should Be A Numeric value Greater than Zero")
		document.all(_strpathCar+'txtNoOfDays').focus();
		return false;
	}
	else
	{
		if (arrivalDate !='')
		{
			
			if(isValidDate(arrivalDate,'1')) 
			{
				arrivalDateSplit=arrivalDate.split("/")
				arrivalday=arrivalDateSplit[0]
				arrivalmonth=arrivalDateSplit[1]
				arrivalyear=arrivalDateSplit[2]
	
				arrivalDatemdy=arrivalmonth + "/" + arrivalday + "/" + arrivalyear;

				arrivaldatefinal= new Date(arrivalDatemdy); 

				if ( arrivaldatefinal < currentdate) 
				{	
					alert("Pickup must be at least 3 days from the current date")
					//document.all(_strpathCar+'txtPickUpDate').focus();
					return  false 
				}
				else
				{
					if(nights!="")
					{
						Addmillisec = (nights * 24 * 60 * 60 * 1000)
						depart = new Date((arrivaldatefinal.getTime() + Addmillisec ))
						departDay = depart.getDate();
						departMon = depart.getMonth();
						/*if(__nonMSDOMBrowser)
							departYear = depart.getFullYear();
						else
							departYear = depart.getYear();
						*/
						departYear = depart.getFullYear();
						var actualmonth=departMon + 1
					
				  		document.all(_strpathCar+'txtdropoffdate').value=departDay + "/" + actualmonth + "/" + departYear
				  		
						var cIndate=arrivaldatefinal
						var cOutdate=actualmonth + "/" + departDay + "/"  + departYear
						
						//getselectedHoliday(cIndate,cOutdate)
					}//end nights not null condn
				}//end arrival-current condn
			}//end validate condition
		}//end if no arrival date condn
		else
		{
			alert("Pickup Date is compulsory for Search")
			return false;
		}//end else no arrival date 
	}
}
/* End of checkinfocus*/
function checkoutfocusCar()
{
	var currentdate=new Date();
	currentdate.setDate(currentdate.getDate()+2)	//arrival date should be atleast 3rd day from today
		
	departureDate=document.all(_strpathCar+'txtdropoffdate').value;
	arrivalDate=document.all(_strpathCar+'txtpickupdate').value;
	nights = document.all(_strpathCar+'txtNoOfDays').value;
	var arrivalDateSplit,arrivalday,arrivalmonth,arrivalyear,arrivalDatemdy,arrivaldatefinal;
	var departureDateSplit,departureday,departuremonth,departureyear,departureDatemdy,departuredatefinal;
	var Addmillisec,arrive,arriveDay,arriveMon,arriveYear,actualmonth;
	
	if(departureDate !='')
	{
		if(isValidDate(departureDate,'1'))
		{
			departureDateSplit=departureDate.split("/")
			departureday=departureDateSplit[0];
			departuremonth=departureDateSplit[1];
			departureyear=departureDateSplit[2];

			departureDatemdy=departuremonth + "/" + departureday + "/" + departureyear;
			departuredatefinal=new Date(departureDatemdy)

			if ((nights=="")&&(arrivalDate!=""))
			{
				arrivalDateSplit=arrivalDate.split("/")
				arrivalday=arrivalDateSplit[1]
				arrivalmonth=arrivalDateSplit[0]
				arrivalyear=arrivalDateSplit[2]

				arrivalDatemdy=arrivalmonth + "/" + arrivalday + "/" + arrivalyear;
				arrivaldatefinal= new Date(arrivalDatemdy); 
				getNoOfDays(departureDatemdy,arrivalDatemdy);
				
			}//end if nights call function
			else
			{
				if(nights!="")
				{
					Addmillisec = (nights * 24 * 60 * 60 * 1000)
					arrive = new Date((departuredatefinal.getTime() - Addmillisec ))
					arriveDay = arrive.getDate();
					arriveMon = arrive.getMonth();
					if(__nonMSDOMBrowser)
						departYear = depart.getFullYear();
					else
						departYear = depart.getYear();
					var actualmonth=arriveMon + 1
						
					validdate= actualmonth+ "/" + arriveDay + "/" + arriveYear
					arrdt1=new Date(validdate); 
					if ( arrdt1 < currentdate   ) 
					{	
						alert('Inputted Dropoff Date and No of Nights values  \n make Pickup Date Lesser Than 3 days from the current date')
						//document.all(_strpathCar+'txtdropoffdate').focus();
						return  false; 
					}//end if nights not null 
					else
					{
					document.all(_strpathCar+'txtPickupdate').value=arriveDay + "/" + actualmonth + "/" + arriveYear;
					//getselectedHoliday(arrdt1,departuredatefinal)
					}
				}//end else nights not null 
			}//end else nights function call 
		}//end if -else validate condition
	}//end if no depart date condn
	else
	{
		alert("Dropff Date is compulsory for Search")
		return false;
	}//end else no depart date condn
}
/* end of chekoutfoucs*/

function O_checkinfocusCar()
{
	var currentdate=new Date();
	currentdate.setDate(currentdate.getDate()+2)	//arrival date should be atleast 3rd day from today
		
	arrivalDate=document.frmsearch.arrivalDate.value;
	nights = document.frmsearch.txtNoOfNight.value;

	var arrivalDateSplit,arrivalday,arrivalmonth,arrivalyear,arrivalDatemdy,arrivaldatefinal;
	var Addmillisec,depart,departDay,departMon,departYear,actualmonth;

	if ((nights !="") && ((isNaN(nights)) || (nights <=0)))
	{
		alert("No. Of Nights should Be A Numeric value Greater than Zero")
		document.frmsearch.txtNoOfNight.focus();
		return false;
	}
	else
	{
		if (arrivalDate !='')
		{
			//alert(arrivalDate);
			if(isValidDate(arrivalDate,'1')) 
			{
				arrivalDateSplit=arrivalDate.split("/")
				arrivalday=arrivalDateSplit[0]
				arrivalmonth=arrivalDateSplit[1]
				arrivalyear=arrivalDateSplit[2]
	
				arrivalDatemdy=arrivalmonth + "/" + arrivalday + "/" + arrivalyear;
				arrivaldatefinal= new Date(arrivalDatemdy); 

				if ( arrivaldatefinal < currentdate) 
				{	
					alert("Pickup must be at least 3 days from the current date")
					document.frmsearch.arrivalDate.focus();
					return  false 
				}
				else
				{
					if(nights!="")
					{
						Addmillisec = (nights * 24 * 60 * 60 * 1000)
						depart = new Date((arrivaldatefinal.getTime() + Addmillisec ))
						departDay = depart.getDate();
						departMon = depart.getMonth();
						if(__nonMSDOMBrowser)
							departYear = depart.getFullYear();
						else
							departYear = depart.getYear();
						var actualmonth=departMon + 1
					
				  		document.frmsearch.Deptdate.value=departDay + "/" + actualmonth + "/" + departYear
						var cIndate=arrivaldatefinal
						var cOutdate=actualmonth + "/" + departDay + "/"  + departYear
						
						//getselectedHoliday(cIndate,cOutdate)
					}//end nights not null condn
				}//end arrival-current condn
			}//end validate condition
		}//end if no arrival date condn
		else
		{
			alert("Pickup Date is compulsory for Search")
			return false;
		}//end else no arrival date 
	}
}
/* End of checkinfocus*/
function O_checkoutfocusCar()
{
	var currentdate=new Date();
	currentdate.setDate(currentdate.getDate()+2)	//arrival date should be atleast 3rd day from today
		
	departureDate=document.frmsearch.Deptdate.value;
	arrivalDate=document.frmsearch.arrivalDate.value;
	nights = document.frmsearch.txtNoOfNight.value;

	var arrivalDateSplit,arrivalday,arrivalmonth,arrivalyear,arrivalDatemdy,arrivaldatefinal;
	var departureDateSplit,departureday,departuremonth,departureyear,departureDatemdy,departuredatefinal;
	var Addmillisec,arrive,arriveDay,arriveMon,arriveYear,actualmonth;
	
	if(departureDate !='')
	{
		if(isValidDate(departureDate,'2'))
		{
			departureDateSplit=departureDate.split("/")
			departureday=departureDateSplit[0];
			departuremonth=departureDateSplit[1];
			departureyear=departureDateSplit[2];

			departureDatemdy=departuremonth + "/" + departureday + "/" + departureyear;
			departuredatefinal=new Date(departureDatemdy)

			if ((nights=="")&&(arrivalDate!=""))
			{
				arrivalDateSplit=arrivalDate.split("/")
				arrivalday=arrivalDateSplit[0]
				arrivalmonth=arrivalDateSplit[1]
				arrivalyear=arrivalDateSplit[2]

				arrivalDatemdy=arrivalmonth + "/" + arrivalday + "/" + arrivalyear;
				arrivaldatefinal= new Date(arrivalDatemdy); 
				getNoOfDays(departureDatemdy,arrivalDatemdy);
			}//end if nights call function
			else
			{
				if(nights!="")
				{
					Addmillisec = (nights * 24 * 60 * 60 * 1000)
					arrive = new Date((departuredatefinal.getTime() - Addmillisec ))
					arriveDay = arrive.getDate();
					arriveMon = arrive.getMonth();
					if(__nonMSDOMBrowser)
						departYear = depart.getFullYear();
					else
						departYear = depart.getYear();
					var actualmonth=arriveMon + 1
						
					validdate= actualmonth+ "/" + arriveDay + "/" + arriveYear
					arrdt1=new Date(validdate); 
					if ( arrdt1 < currentdate   ) 
					{	
						alert('Inputted Dropoff Date and No of Nights values  \n make Pickup Date Lesser Than 3 days from the current date')
						document.frmsearch.Deptdate.focus();
						return  false; 
					}//end if nights not null 
					else
					{
					document.frmsearch.arrivalDate.value=arriveDay + "/" + actualmonth + "/" + arriveYear;
					//getselectedHoliday(arrdt1,departuredatefinal)
					}
				}//end else nights not null 
			}//end else nights function call 
		}//end if -else validate condition
	}//end if no depart date condn
	else
	{
		alert("Dropff Date is compulsory for Search")
		return false;
	}//end else no depart date condn
}
/* end of chekoutfoucs*/
function O_findcityCar(city,citypid)
{
	var Pid=document.frmsearch.Country.options[document.frmsearch.Country.selectedIndex].value;
	var Loc =document.frmsearch.CityXid1.value;
	var LocPid =document.frmsearch.City1.value;	
	var LocCountry =document.frmsearch.CountryXid1.value;	
	var serviceId=document.frmsearch.serviceType.value;
	//alert(Pid)
	if (serviceId=="3")
	{
		if((Pid!=""))
		{	
			if ((Pid=="326") || (Pid=="314"))
			{
			document.frmsearch.category.disabled = true; 
			} 
			else
			{
			document.frmsearch.category.disabled = false;
			}
		}	
	}
		
	var flag;
	
	var sLoc;
	sLoc = "";		
	sLoc = '<SELECT  name=city class=select>';

	
	var aLoc1 = Loc.split(':');
	var aLocPid1 = LocPid.split(':');
	var aLocCountry1 = LocCountry.split(':');
	
	lop = aLoc1.length;	
    for (j = 0;j < lop; j++)
	{
		al = aLoc1[j]
		aLoc = al.split('|');
		ali = aLocPid1[j]
		aLocPid = ali.split('|');
		alc = aLocCountry1[j]
		aLocCountry = alc.split('|');
		
		b = aLoc.length;
		for(i = 0; i < b; i++)
		{
			if(Pid == aLocCountry[i])
			{
				flag = true;
				sLoc = sLoc + '<option value="'+ aLoc[i] +'">'+ aLocPid[i] +'</option>';
				city1=aLoc[i]

			}
			if(flag == true && i < b)
			{
				if(Pid != aLocCountry[i + 1])
				{
					//break;
				}
			}			
		}
		if (flag == true)
			sLoc = sLoc //+ '<option value="">----------</option>';
	}
		
	sLoc = sLoc + '</select>&nbsp;<b class="red">*</b>';
	document.all.ucCentralPane_ucSearch_CityID.innerHTML = sLoc;
	//document.frmsearch.city.value=city1
	//alert(city1);
}
/* end of findcityCar*/
function O_validateCar()
{
	if (document.frmsearch.arrivalDate.value=="")
	{
		alert ("Please select a Pickup date ")
		document.frmsearch.arrivalDate.focus()
		return false;
	}
	
	if (document.frmsearch.Deptdate.value=="")
	{
		alert ("Please select a Dropoff date")
		document.frmsearch.Deptdate.focus()
		return false;
	}
	
	if (document.frmsearch.pickuptime.value == "")
	{
	alert("Please Select your Pick-up time") 
	return false;
	}	
	
	if (document.frmsearch.dropofftime.value == "")
	{
	alert("Please Select your Drop-Off time") 
	return false;
	}	
	
	if (document.frmsearch.Country.value=="")
	{
		alert ("No valid Country found")
		return false;
	}
	
		
	var arrivaldate=document.frmsearch.arrivalDate.value
	var departuredate=document.frmsearch.Deptdate.value
	//alert(arrivaldate)
	/*if(arrivaldate==departuredate)
	{
		alert("Pickup and Dropoff dates cannot not be same ")
		return false
	}*/

	if(isValidDate(document.frmsearch.arrivalDate.value,'i')==false)
		return false;
	if(isValidDate(document.frmsearch.Deptdate.value,'o')==false)
		return false;
	
	if (document.frmsearch.dateformatvalue.value == 103 || document.frmsearch.dateformatvalue.value =="")
	{
		splitdatevaluein=document.frmsearch.arrivalDate.value.split('/');
		dateValuedayin=splitdatevaluein[0]
		dateValuemonthin=splitdatevaluein[1]
		dateValueyearin=splitdatevaluein[2]
		dateValuein=dateValuemonthin+'/'+dateValuedayin+'/'+dateValueyearin
		cd=new Date(dateValuein)
		
		splitdatevalue=document.frmsearch.Deptdate.value.split('/');
		dateValueday=splitdatevalue[0]
		dateValuemonth=splitdatevalue[1]
		dateValueyear=splitdatevalue[2]
		dateValue=dateValuemonth+'/'+dateValueday+'/'+dateValueyear
		cd1=new Date(dateValue)
	}
	else
	{
		cd=new Date(document.frmsearch.arrivalDate.value)
		cd1=new Date(document.frmsearch.Deptdate.value)
	}
	
	if(cd1<cd)
	{
		alert("Pickup date should be greater than Dropoff date")
		return false;
	}
	
	document.frmsearch.NoofNights.value = (( cd1 - cd ) / (  24 * 60 * 60 * 1000 ));
	
	if (document.frmsearch.minqty.value!=0)
	{
		noofnights=eval(document.frmsearch.NoofNights.value)
		minqty=eval(document.frmsearch.minqty.value)
		maxqty=eval(document.frmsearch.maxqty.value)
		
		if((noofnights < minqty)||(noofnights > maxqty))
		{
			alert ('The service is available between '+document.frmsearch.minqty.value+' Days and '+document.frmsearch.maxqty.value+' Days only ')
			document.frmsearch.arrivalDate.focus()
			return false;
		}
	}

	return true;
}

/* end of Validate */




