function ValidateDate(StartDate,EndDate)
{

     var dayfrom=StartDate.substring(0,2);
     var monthfrom=StartDate.substring(3,5);
     var yearfrom=StartDate.substring(6,10);
     var FromDate=new Date(yearfrom,monthfrom,dayfrom);
     var dayTo=EndDate.substring(0,2);
     var monthTo=EndDate.substring(3,5);
     var yearTo=EndDate.substring(6,10);
     var ToDate=new Date(yearTo,monthTo,dayTo);
     if(FromDate >= ToDate)
     {
        return false;
     }
     else
     {
        return true;
     }
}

function Validate(theForm)
{
        if(theForm.txt_cityid.value=="")
        {
            alert('Please select the city');
            theForm.txt_cityid.focus();
            return false;
        }
        if(theForm.txtarrivaldate.value=="")
        {
            alert('Please enter the arrival date');
            theForm.txtarrivaldate.focus();
            return false;
        }
        if(theForm.txtdeparturedate.value=="")
        {
            alert('Please enter the departure date');
            theForm.txtdeparturedate.focus();
            return false;
        }        

        if(theForm.txtarrivaldate.value!="" && theForm.txtdeparturedate.value!="")
        {
            var arrivaldate = theForm.txtarrivaldate.value;
            var departuredate = theForm.txtdeparturedate.value;
            var Validate= ValidateDate(arrivaldate,departuredate);
           if(Validate==false)
           {
                alert('Departure date should be greater than arrival date');
                theForm.txtdeparturedate.focus();
                return false;
           }
        }
 }
 
 function Validate1(theForm)
 {
         if(theForm.txtarrivaldate1.value=="")
         {
             alert('Please enter the arrival date');
             theForm.txtarrivaldate1.focus();
             return false;
         }
         if(theForm.txtdeparturedate1.value=="")
         {
             alert('Please enter the departure date');
             theForm.txtdeparturedate1.focus();
             return false;
         }        
 
         if(theForm.txtarrivaldate1.value!="" && theForm.txtdeparturedate1.value!="")
         {
             var arrivaldate = theForm.txtarrivaldate1.value;
             var departuredate = theForm.txtdeparturedate1.value;
             var Validate= ValidateDate(arrivaldate,departuredate);
            if(Validate==false)
            {
                 alert('Departure date should be greater than arrival date');
                 theForm.txtdeparturedate1.focus();
                 return false;
            }
         }
 }