﻿$(document).ready(function() {
          $('input').bind('paste', function(e) {
                              e.preventDefault();
                                            });
                                            $('textarea').bind('paste', function(e) {
                              e.preventDefault();
                                            });
                                            });
                                           
    $(document).ready(function() {
    $("#divhometabs").tabs();
    
  });
  
    $(function() 
  {
        $('#A1').tipsy({gravity: 'w'});
        $('#btnsearchagent').tipsy({gravity: 'w'});
        $('#selectsearchbuildercity1').tipsy({gravity: 'w'});
        $('#submitbuttonsearchbuyer').tipsy({gravity: 'w'});
        $('#Select1').tipsy({gravity: 'w'});
        $('#Select2').tipsy({gravity: 'w'}); 
        $('#textbuildername').tipsy({gravity: 'w'});
        $('#buttonsubmitsearchproject').tipsy({gravity: 'w'});
        $('#selectsearchprojectcity').tipsy({gravity: 'w'});
        $('#buttonsubmitsearchagent').tipsy({gravity: 'w'});
        $('#selectcitysearchagent').tipsy({gravity: 'w'});
        $('#buttonsearchbuilder').tipsy({gravity: 'w'});
        $('#dropprojectstate').tipsy({gravity: 'w'});
        $('#dropbuyerstate').tipsy({gravity: 'w'});
        $('#dropagentstate').tipsy({gravity: 'w'});
        $('#dropbuilderstate').tipsy({gravity: 'w'});
        $('#selectsearchbuyercity').tipsy({gravity: 'w'});
  });
$(document).ready(function() {
$("#tabs").tabs();
});

$(document).ready(function() {

$("#dialogsearcbyid").dialog({
autoOpen: false,
height: 150,
width: 350,
modal: true,
buttons: {
},
close: function() {
	
}
});

$( "#dialogsearcbyid" ).dialog({ draggable: false });
$( "#dialogsearcbyid" ).dialog({ resizable: false });
$( "#dialogsearcbyid" ).dialog({ closeOnEscape: true });

		
$( "#dialogsearcbyid" ).dialog( "option", "closeText", 'X' );

});


  function swapimagelowertabs(id)
{
                       if(id=="rent")
                       {
                         document.getElementById('tablebackground').style.backgroundImage='url(Images/rent-final.jpg)';
                         document.getElementById('tablebackground').style.backgroundRepeat="no-repeat";
                       }
                       if(id=="buy")
                       {
                       }
                       if(id=="pg")
                       {
                        document.getElementById('tablebackground').style.backgroundImage='url(Images/PG-final.jpg)';
                        document.getElementById('tablebackground').style.backgroundRepeat="no-repeat";
                       }
}

  function getQuerystring(key, default_)
{
  if (default_==null) default_=""; 
  key = key.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
  var regex = new RegExp("[\\?&]"+key+"=([^&#]*)");
  var qs = regex.exec(window.location.href);
  if(qs == null)
   {
   }
  else
    {
    }
    var currentcity=document.getElementById('querycarr').value;
        var propertytype=document.getElementById('hiddentypeofproperty').value;
        var cityproptype=currentcity+"*"+propertytype;
        if(currentcity=="home")
        {
            newAjaxCall("homedemo*"+cityproptype);
        }
        else
        {
            newAjaxCall("citypages*"+cityproptype);
        }
}
function loggedin()
{
  document.getElementById('divwelcomeuser').innerHTMl="Welcome "+document.getElementById('loginusername').value+"";
  document.getElementById('signin_menu').style.display="None";
  document.getElementById('divregisterlogin').style.display="None";
  document.getElementById('divmyaccount').style.display="inline";
  document.getElementById('hiddenloggeduserid').value=divdata[1];
}
function setlastimagegray(id)
{
if((document.getElementById('hiddenlowerbuttonlastimgclicked').value!=id)&&(document.getElementById('hiddenlowerbuttonlastimgclicked').value!="1"))
{
   document.getElementById(document.getElementById('hiddenlowerbuttonlastimgclicked').value).style.backgroundImage='url(Images/menu--bar1.gif)'; 
   document.getElementById(document.getElementById('hiddenlowerbuttonlastimgclicked').value).style.backgroundRepeat="repeat-x"; 
   document.getElementById('hiddenlowerbuttonlastimgclicked').value="1";

}

}

     
     
       function homebuyproperties()
     {
     
     newAjaxCall('BrowseBuyProperties!1');
     
     
     }
      function homerentproperties()
     {
     
     newAjaxCall('BrowseBuyProperties!2');
     
     
     }
      function homepgproperties()
     {
     
     newAjaxCall('BrowseBuyProperties!3');
     
     
     }
     
     


    function setcolor(dropcity)
    {
    document.getElementById(dropcity.id).style.backgroundColor="white";
    }
    

   function  validatesearchid()
   {
   
             var error="";
   
                       if(document.getElementById('txtsearchid').value!="")
                    {//check it contains only digits
                    var value=document.getElementById('txtsearchid').value;
                    var numericExpression = /^[0-9]+$/;
                            if(value.match(numericExpression))
                            {
                              error="";
                            document.getElementById("lblerrorsearchid").style.display ="none";
                            document.getElementById("lblerrorsearchid").innerHTML  =""; 
                            }

                            else 
                            {
                            document.getElementById("lblerrorsearchid").style.display ="inline"; 
                            document.getElementById("lblerrorsearchid").innerHTML="Enter Only Digits";

                            error+=error+"error" ;

                            }
                    }
                    
                    else
                    {
                         document.getElementById("lblerrorsearchid").style.display ="inline"; 
                         document.getElementById("lblerrorsearchid").innerHTML="Required";
                         error+=error+"error" ;
                    }
                    if(error=="")
                    {
                    var s1= document.getElementById('txtsearchid').value;
                    window.location="propertydetails.aspx?propertyid="+s1+"";
              
                    }
                    else
                    {
                    }
            
             
            
              
           
   
     
   }
     
     
     function searchlocalities(dropcity,droplocality)
     {
     

     if(document.getElementById(dropcity.id).options[document.getElementById(dropcity.id).selectedIndex].value=="")
       {
        document.getElementById(dropcity.id).style.backgroundColor="#FBBEBD";

        }
         else
        {
         var s1= document.getElementById(dropcity.id).options[document.getElementById(dropcity.id).selectedIndex].value ;
         document.getElementById(dropcity.id).style.backgroundColor="white";
           newAjaxCall('fetchsearchagentlocality!'+s1+"!"+droplocality.id);
         }
     } 


