﻿//******************Surbhi Arora*****************************
//*******************Luxury Train Cms************************
//***********************************************************
function valid(TrainName,CountryId,StateId,CityId,arrivaldate)
{
   
var arr=new Array ();
    if (document .getElementById (TrainName ).value ==""  )
    {
    arr [0]="Name can not be blank.";
   
    }
    else 
    {
    arr [0]="";
    }
    
    
    
    
    if (document .getElementById (CountryId ).value=="" || document .getElementById (CountryId ).value =="Select any country")
    {
    arr [1]="address can not be blank.";
    
    }
    else 
    {
    arr [1]="";
    }
    
    if (document .getElementById (StateId ).value =="" || document .getElementById (StateId).value =="select any state")
    {
   arr [2]= "email id can not be blank.";
   
    }
    else 
    {
    arr [2]="";
    }
    if (document .getElementById (arrivaldate ).value=="" )
    {
    arr [3]="Arrival Date can not be blank.";
    }
    else 
    {
    arr [3]="";
    }
    
    if (document .getElementById (CityId).value ==""|| document .getElementById (CityId).value=="select any city")
    {
    arr[4]="Departure Date can not be blank.";
     
    }
    else 
    {
    arr [4]="";
    }
     if (document .getElementById (arrivaldate ).value !="" && document.getElementById (CityId ).value!="")
    {
    
    var In=new Date (document .getElementById (arrivaldate ).value);
    
    var Out=new Date (document.getElementById (CityId  ).value );
    if (In >=Out )
    {
    arr [5]="arrival date should be smaller than departure date";
   
    }
    else 
    {
    arr [5]="";
    }
    }
    var messArr=new Array ();
    for (var i=0;i< arr .length ;i++)
    {
    if (arr [i]!="")
    {
    messArr[i] =arr [i]+"\n";
    
    }
    }
  
    if (messArr.length  !=0)
    {
   
     alert (messArr .join (" "));
    return false ;
    }

   
}
function validation(TrainName,Description,CountryId,StateId,CityId)
{

var arr=new Array ();
    if (document .getElementById (TrainName ).value ==""  )
    {
    arr [0]="Name can not be blank.";
   
    }
    else 
    {
    arr [0]="";
    }
    
    
    if (FCKeditorAPI.GetInstance(Description ).GetXHTML () =="")
    {
    arr [1]= "Description can not be blank.";
    
    }
    else 
    {
    arr [1]="";
    }
   
    
    if (document .getElementById (CountryId ).value=="" || document .getElementById (CountryId ).value =="Select any country")
    {
    arr [2]="select any country";
    
    }
    else 
    {
    arr [2]="";
    }
    
    if (document .getElementById (StateId ).value =="" || document .getElementById (StateId).value =="select any state")
    {
   arr [3]= "select any state";
   
    }
    else 
    {
    arr [3]="";
    }
    if (document .getElementById (CityId).value ==""|| document .getElementById (CityId).value=="select any city")
    {
    arr[4]="select any city";
     
    }
    else 
    {
    arr [4]="";
    }
    var messArr=new Array ();
    for (var i=0;i< arr .length ;i++)
    {
    if (arr [i]!="")
    {
    messArr[i] =arr [i]+"\n";
    
    }
    }
  
    if (messArr.length  !=0)
    {
   
     alert (messArr .join (" "));
    return false ;
    }

   
}
function LuxuryCruise (name,description ,city)
{

 var arr=new Array ();
    if (document .getElementById (name).value=="")
    {
    arr [0]=" Name can not be blank.";
    }
   else 
   {
   arr [0]="";
   }
   
     if (FCKeditorAPI.GetInstance(Description ).GetXHTML () =="")
    {
    arr [1]= "Description can not be blank.";
    
    }
    else 
    {
    arr [1]="";
    }
   
    
    if (document .getElementById (CountryId ).value=="" || document .getElementById (CountryId ).value =="Select any country")
    {
    arr [2]="select any country";
    
    }
    else 
    {
    arr [2]="";
    }
    
    if (document .getElementById (StateId ).value =="" || document .getElementById (StateId).value =="select any state")
    {
   arr [3]= "select any state";
   
    }
    else 
    {
    arr [3]="";
    }
    if (document .getElementById (CityId).value ==""|| document .getElementById (CityId).value=="select any city")
    {
    arr[4]="select any city";
     
    }
    else 
    {
    arr [4]="";
    }
    var mess=new  Array ();
    for (var i=0;i<mess.length ;i++)
    {
    if(arr [i]!="")
    {
    mess [i]=arr [i]+"\n";
    }
    }
    if (mess.length !=0)
    {
    alert (mess .join (""));
    return false ;
    }
}
function MetaTagValidation(subject,content)
{

var arr=new Array ();
if (document .getElementById (subject ).value=="")
{
arr [0]= "Subject can not be blank.";
}
else 
{
arr [0]="";
}
if (document .getElementById (content ).value=="")
{
arr [1]="Content can not be blank.";
}
else 
{
arr [1]="";
}
var mess=new Array ();
for (var i=0;i<arr .length ;i++)
{
    if (arr [i]!="")
    {
    mess [i]=arr [i]+"\n";
    }
}

if (mess .length !=0)
{
alert (mess .join (""));
return false ;
}
}

function Validate(checkIn,CheckOut)
{
 
    
    if( document .getElementById (checkIn ).value=="")
    {
    alert ("check in date can not be blank");
    return false ;
    }
    
    if (document.getElementById (CheckOut).value=="")
    {
    alert ("check out date can not be blank");
    return false ;
    }
   
    if (document .getElementById (checkIn ).value !="" && document.getElementById (CheckOut ).value!="")
    {
    
    var In=new Date (document .getElementById (checkIn ).value);
    
    var Out=new Date (document.getElementById (CheckOut ).value );
    if (In >=Out )
    {
    alert ("check in date should be smaller than check out date");
    return false ;
    }
    }
    }
