 
function validateFrmCars(){
	hideCarErrors();
	if(jQuery('#carDepartTime').val()=="-1"){
		jQuery('#carDepartTimeError').get(0).style.display ="inline";
		return false;
	}
	if(jQuery('#numofdays').val()=="-1"){
		jQuery('#numofdaysError').get(0).style.display ="inline";
		return false;
	}
	
	if(jQuery('#carServicetype').val()=="-1"){
		jQuery('#carServiceError').get(0).style.display ="inline";
		return false;
	}
	return true;

}

function loadDropoffTextString(needed) {
	if(needed=='' || needed=="YES"){
		$('destination').value="Same as pick-up location";
	}
}

function hideCarErrors(){
	jQuery('#carDepartTimeError').get(0).style.display ="none";
	jQuery('#numofdaysError').get(0).style.display ="none";
	jQuery('#carServiceError').get(0).style.display ="none";
}

function  loaddestinationsForCars(day) {		
	var options;
	jQuery('#numofdaysError').get(0).style.display ="none";
	jQuery('#carServiceError').get(0).style.display ="none";
	if($$$('#frmSearchCar').valid()){	
	var originLocationValue = jQuery('#carOriginLocationValue').val();
	var startDate = jQuery('#startDate').val();
	jQuery.blockUI({ message: '<strong>Please Wait...</strong>' });
	       jQuery.getJSON("/car/populateService.action?originValue="+originLocationValue+"&startDate="+startDate+"&day="+day, function (data) {  
			var options = '<option value="-1" >- Select Usage - </option>';
			jQuery.each(data, function(index){			
					 options += '<option value="' + data[index].id + '">' + data[index].name + '</option>';
			 });
		 jQuery("select#carServicetype").html(options);
		 jQuery("select#dropofflocation").html('<option value="-1">- Select Any - </option>');
			}); 
		jQuery.unblockUI();	
	}else{
		    for(var  i=1;i<=31 ;i++){			
		    options += '<option value="' + i+ '">' + i+ '</option>';
			 }		
		 jQuery("select#numofdays").html(options);
	 }
}

function loadDropoffLocation(){
	var options="";
	if( jQuery('#carServicetype').val()=="1" ){
		options += ' <option value="2">Domestic</option><option value="1">International</option><option value="3">Railway Station</option><option value="4">Others</option>';
	}
	if( jQuery('#carServicetype').val()=="2" ){
		options += ' <option value="8hr/80km">8hr/80km</option>';
	}
	if( jQuery('#carServicetype').val()=="3"){
		options += ' <option value="225 km">225 km</option><option value="250 km">250 km</option>';
	}
	if( jQuery('#carServicetype').val()=="-1"){
		options += ' <option value="-1">Select Any</option>';
	}
	jQuery("select#dropofflocation").html(options);
}

