
$('#search').live('click',function(event){
    
    var flag=true;
   
   if($('#location').val().length==0 && $('#prop_type').val().length==0)
       {
          
           $('#locationError').removeClass('valid');
           $('#locationError').addClass('error');
           /*$('#location').addClass('error');
           $('#typeError').removeClass('valid');
           $('#typeError').addClass('error');
       
           $('#prop_type').addClass('error');*/
           flag=false;
       }
       
  /* if($('#prop_type').val().length==0)  {
      
      
      $('#typeError').removeClass('valid');
      $('#typeError').addClass('error');
       
       $('#prop_type').addClass('error');
       flag=false;
   } */
   
   if(flag)
       {
          var city=$('#location').val().substring(0,$('#location').val().indexOf(":")) ;
          var short_area_name=$('#location').val().substring($('#location').val().indexOf(":")+1, $('#location').val().length); 
          var type=$('#prop_type').val();
         /* window.location="serviced-office-space.php?short_area_name="+short_area_name+"&city="+city+"&type_id="+type;*/
         if($.trim(short_area_name).length==0)
             window.location="search-results.php?type_id="+type;
         else
             window.location="search-results.php?short_area_name="+short_area_name+"&city="+city;//+"&type_id="+type
       }
    
    
});



$('#location, #prop_type').live('change',function(event){
    
    if($(this).val().length>0)
        {
            //$(this).removeClass('error');
            $('#locationError').removeClass('error')
            $('#locationError').addClass('valid');
        }
     /*else
         {
            $(this).addClass('error');
            $('#locationError').removeClass('valid')
            $('#locationError').addClass('error');
         }*/
    
});

/*$('#prop_type').live('change',function(event){
    
    if($(this).val().length>0)
        {
            $(this).removeClass('error');
            $('#typeError').removeClass('error')
            $('#typeError').addClass('valid');
        }
        
     else
         {
             $(this).addClass('error');
            $('#typeError').removeClass('valid')
            $('#typeError').addClass('error');
         }
    
});*/
