﻿
    jQuery(document).ready ( function (){
           
    });
    
// Search Hostel
function searchByCountryHostel(rbByCounty,rbByHostel,ddlCountry,ddlCity,txtHostelName)
{   
      var rbCounty=document.getElementById(rbByCounty);
      var City=document.getElementById(ddlCity);
      var Country=document.getElementById(ddlCountry);
      var HostelName=document.getElementById(txtHostelName);
      
      if(rbCounty.checked ==1)
      { 
        HostelName.disabled=true;
        City.disabled=false;
        Country.disabled=false;
        HostelName.value='';
      }
      else
      {
        HostelName.disabled=false;
        City.disabled=true;
        Country.disabled=true;
        City.selectedIndex=0;
        Country.selectedIndex=0;
      }
      clearDropdown(ddlCity);
}
    
function clearDropdown(dropDownId)
{
    var dropDown=document.getElementById(dropDownId);
    
    var len = dropDown.options.length;
    for(i=len-1; i>0; i--)
    {
        dropDown.options.remove(i);
    }
}

function disableSerachCriteria(txtHostelName,rbByCounty,rbByHostel,ddlCountry,ddlCity)
{
     var HostelName=document.getElementById(txtHostelName);
     var rbCounty=document.getElementById(rbByCounty);
     var rbHostel=document.getElementById(rbByHostel);
     var City=document.getElementById(ddlCity);
     var Country=document.getElementById(ddlCountry);
      
      if(rbHostel.checked ==1)
      {
        HostelName.disabled=false;
        City.disabled=true;
        Country.disabled=true;
        City.selectedIndex=0;
        Country.selectedIndex=0;
      }
      else
      { 
        HostelName.disabled=true;
        City.disabled=false;
        Country.disabled=false;
      }
}
    
function CVsearchByCountry(source, arguments)
{
     var argument= arguments.Value.split('#');
    
    var ddlCountryCriteria=jQuery('#'+argument[0]).val();
    var rbByCountry=document.getElementById(argument[1]);

     if(rbByCountry.checked==1)
     {
        if(ddlCountryCriteria >0)
        {
            arguments.IsValid = true;
            return true;
        }
        else
        {
            arguments.IsValid = false;
            return false;
        }
        
     }
     else
     {
        arguments.IsValid = true;
        return true;
     }
}   
    
function CVSearchByHostel(source, arguments)
{   
    var argument= arguments.Value.split('#');
    
    var txtCriteria=jQuery('#'+argument[0]).val();
    var rbByHostel=document.getElementById(argument[1]);
    
     if(rbByHostel.checked==1)
     {
         if(jQuery.trim(txtCriteria) =='')
         {
            arguments.IsValid = false;
            return false;
         }
         else
         {
            arguments.IsValid = true;
            return true;
         }
     }
     else
     {
        arguments.IsValid = true;
        return true;
     }
}
    
    
//function defaultdropdownPerson()
//{
//    var DivRoomAvailability=jQuery('Div[id$=DivRoomAvailability]');
//    
//    //var obj=jQuery(DivRoomAvailability).find("input[@type='hidden']").attr("id");
//    var obj=jQuery(DivRoomAvailability)
//    //alert(obj);
//    
//    var a=jQuery(obj).find("select[id$='ddlBeds']");
//    for(var i=0;i<a.length;i++)
//    {
//        var d=jQuery(a[i]).val();
//        alert(d);
//        //d.options[d.selectedIndex].value;
//    }
//    
//}