﻿ var Path="http://www.realsoil.com/"
  function ticker(imageID) 
{
    var imageObj = document.getElementById(imageID);
    if (imageObj == null || imageObj == undefined) 
    {
        return;
    }
    imageObj.src = Path + "helper/ticker" + "?par=" + escape((new Date()).toString());
}

var xmlHttp

function GetStates(str)
{
    if (str.length==0)
    {   
        document.getElementById("States").innerHTML="<select id='States' name='States'><option value='--Select States--'>--Select States--</option></select>";
      
        return;
    }
    document.getElementById("States").innerHTML="<span class='errmsg'>Loading States...</span><img src='http://images.realsoil.com/progress.gif' alt='progress' />";
    xmlHttp=GetXmlHttpObject();
    if (xmlHttp==null)
    {
        alert ("Your browser does not support AJAX!");
        return;
    } 
    

    var url=Path +"helper/getstates/" + str;

    xmlHttp.onreadystatechange=countryChanged;
    xmlHttp.open("GET",url,true);
    xmlHttp.send(null);
} 

function countryChanged() 
{ 
    if (xmlHttp.readyState==4)
    { 
        document.getElementById("States").innerHTML=xmlHttp.responseText;
    }
}


function GetCities(str)
{

    if (str=="--Select State--")
    {   
        document.getElementById("cities").innerHTML="<select id='City' name='City'><option value='--Select City--'>--Select City--</option></select>";
      
        return;
    }
    document.getElementById("cities").innerHTML="<span class='errmsg'>Loading Cities...</span><img src='http://images.realsoil.com/progress.gif' alt='progress'/>";
    xmlHttp=GetXmlHttpObject();
    if (xmlHttp==null)
    {
        alert ("Your browser does not support AJAX!");
        return;
    } 

    var url=Path +"helper/getcities/" + str;

    xmlHttp.onreadystatechange=stateChanged;
    xmlHttp.open("GET",url,true);
    xmlHttp.send(null);
} 

function stateChanged() 
{ 
    if (xmlHttp.readyState==4)
    { 
        document.getElementById("cities").innerHTML=xmlHttp.responseText;
    }
}

function GetXmlHttpObject()
{
    var xmlHttp=null;
    try
    {
        // Firefox, Opera 8.0+, Safari
        xmlHttp=new XMLHttpRequest();
    }
    catch (e)
    {
        // Internet Explorer
        try
        {
            xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
        }
        catch (e)
        {
            xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
        }
    }
    return xmlHttp;
}

function GetCity(str)
{

    if (str=="--Select State--")
    {   
        document.getElementById("city").innerHTML="<select id='CityID' name='CityID'><option value='--Select City--'>--Select City--</option></select>";
      
        return;
    }
    document.getElementById("city").innerHTML="<span class='errmsg'>Loading Cities...</span><img src='http://images.realsoil.com/progress.gif' alt='progress' />";
    xmlHttp=GetXmlHttpObject();
    if (xmlHttp==null)
    {
        alert ("Your browser does not support AJAX!");
        return;
    } 

    var url=Path +"helper/getcitiesid/" + str;

    xmlHttp.onreadystatechange=cityChanged;
    xmlHttp.open("GET",url,true);
    xmlHttp.send(null);
} 

function cityChanged() 
{ 
    if (xmlHttp.readyState==4)
    { 
        document.getElementById("city").innerHTML=xmlHttp.responseText;
    }
}

function GetLocations(str)
{
    if (str=="--Select State--")
    {   
        document.getElementById("Locations").innerHTML="<select id='Location' name='Location'><option value='--Select Location--'>--Select Location--</option></select>";
      
        return;
    }
    document.getElementById("Locations").innerHTML="<span class='errmsg'>Loading Locations...</span><img src='http://images.realsoil.com/progress.gif' alt='progress' />";
    xmlHttp=GetXmlHttpObject();
    if (xmlHttp==null)
    {
        alert ("Your browser does not support AJAX!");
        return;
    } 

    var url=Path +"helper/getlocations/" + str;

    xmlHttp.onreadystatechange=LocationChanged;
    xmlHttp.open("GET",url,true);
    xmlHttp.send(null);
} 

function LocationChanged() 
{ 
    if (xmlHttp.readyState==4)
    { 
        document.getElementById("Locations").innerHTML=xmlHttp.responseText;
    }
}

function GetBedorRest(dCtl)
{ 
    var selectedItem = dCtl.selectedIndex;

    if(selectedItem >= 0 && selectedItem <= 7)
    {
        document.getElementById("lblrooms").innerHTML = "Bed Room(s)";
        document.getElementById("Rooms").style.display = "";
        return;
    }
    else if(selectedItem >= 8 && selectedItem <= 19)
    {
        document.getElementById("lblrooms").innerHTML = "Rest Room(s)";
        document.getElementById("Rooms").style.display = "";
        return;
    } 
    else if(selectedItem >= 20 && selectedItem <= 27)
    {
        document.getElementById("lblrooms").innerHTML="";
        document.getElementById("Rooms").style.display = "none";
        return;
    } 
} 
function QuickSearchPostType(str)
{
    if(str == 'Rent In'|| str=='Rent Out')
    {      
        document.getElementById("PriceMin").style.display = "none";
        document.getElementById("PriceMax").style.display = "none";
        document.getElementById("RentFrom").style.display = "";
        document.getElementById("RentTo").style.display = ""; 
        document.getElementById("PCategory").style.display = "";
        document.getElementById("PostType").style.display = "";
        document.getElementById("PreferType").style.display ="none";               
    }
    else if(str == 'Buy' ||str=='Sell')
    {        
        document.getElementById("PriceMin").style.display = "";
        document.getElementById("PriceMax").style.display = "";
        document.getElementById("PCategory").style.display = "";
        document.getElementById("PostType").style.display = ""; 
        document.getElementById("RentFrom").style.display = "none";
        document.getElementById("RentTo").style.display = "none";
        document.getElementById("PreferType").style.display ="";                  
    }
    else if(str == 'Paying Guest')
    {        
        document.getElementById("PriceMin").style.display = "none";
        document.getElementById("PriceMax").style.display = "none";
        document.getElementById("PCategory").style.display = "none";
        document.getElementById("PostType").style.display = "none"; 
        document.getElementById("RentFrom").style.display = "";
        document.getElementById("RentTo").style.display = "";   
    }
}


function checkMaxValue(J,O)
{
var K=document.getElementById(J);
var Q=document.getElementById(J).selectedIndex;
var P=document.getElementById(O);
var R=document.getElementById(O).selectedIndex;
if((R<Q)&(R!=0))
{
alert("Price Maximum value should be less than Price Minimum value.");
var L=document.getElementById(O);
for(r=0;r<L.options.length;r++)
{
var M=L.options[r];
var N=M.text;
if(N=="-Price Max-")
{
M.selected=true;
}
else
{
document.getElementById(O).selectedIndex=L.options[0].text;
}}}}
function PostTypeChange(postType)
{ 

    if(postType == 'Rent In')
    {
        document.getElementById("PriceFrom").style.display = "none";
        document.getElementById("PriceTo").style.display = "none";
        document.getElementById("RentFrom").style.display = "";
        document.getElementById("RentTo").style.display = "";
        document.getElementById("PropertyType").disabled = false;               
        document.getElementById("lblpricefrom").innerHTML = "Rent from";
        document.getElementById("lblpriceto").innerHTML = "Rent to";
        
    }
    else if(postType == 'Buy')
    {
        document.getElementById("PriceFrom").style.display = "";
        document.getElementById("PriceTo").style.display = "";
        document.getElementById("RentFrom").style.display = "none";
        document.getElementById("RentTo").style.display = "none";
        document.getElementById("PropertyType").disabled = false;        
        document.getElementById("lblpricefrom").innerHTML = "Price from";
        document.getElementById("lblpriceto").innerHTML = "Price to";
    }
    else if(postType == 'Paying Guest')
    {
        document.getElementById("PriceFrom").style.display = "none";
        document.getElementById("PriceTo").style.display = "none";
        document.getElementById("RentFrom").style.display = "";
        document.getElementById("RentTo").style.display = "";
        document.getElementById("PropertyType").selectedIndex=1;          
        document.getElementById("PropertyType").disabled = true;
        document.getElementById("lblpricefrom").innerHTML = "Rent from";
        document.getElementById("lblpriceto").innerHTML = "Rent to";
    }
}

function labelChanged() 
{ 
    if (xmlHttp.readyState==4)
    { 
        document.getElementById("BedRooms").innerHTML=xmlHttp.responseText;
    }
}
//validation
function ValHome()
{
var KeyWord=document.getElementById("Cities");

 if (KeyWord.value=="-1")
   {   
   alert("Please select a City ");
   return false;
   }
   else
   return true;
}
//validation
function ValHeader()
{
var CityKeyWord=document.getElementById("SearchCities");
var KeyWord=document.getElementById("KeyWord");
   if (CityKeyWord.value=="-1")
   {
       alert("Please select a City.");
       return false;
   }
   else if(KeyWord.value=="")
   {
       alert("Please enter Search Keyword.");
       return false;
   }
   else     
        return true;
}

function GetListBoxCities(str)
{

    if (str=="--Select State--")
    {   
        document.getElementById("City").innerHTML="<select id='City' name='City'><option value='--Select City--'>--Select City--</option></select>";
      
        return;
    }
    document.getElementById("City").innerHTML="<span class='errmsg'>Loading Cities...</span><img src='http://images.realsoil.com/progress.gif' alt='progress' />";
    xmlHttp=GetXmlHttpObject();
    if (xmlHttp==null)
    {
        alert ("Your browser does not support AJAX!");
        return;
    } 

    var url=Path +"helper/getcitylist/" + str;

    xmlHttp.onreadystatechange=CityListChanged;
    xmlHttp.open("GET",url,true);
    xmlHttp.send(null);
} 

function CityListChanged() 
{ 
    if (xmlHttp.readyState==4)
    { 
        document.getElementById("City").innerHTML=xmlHttp.responseText;
    }
}


function GetQuickSearchResults(str)
{

    if (str.length==0)
    {   
        document.getElementById("QuickSearchResults").innerHTML="Could not load search results.";
        return;
    }
   
    if(document.getElementById("topPager")!=null)
        {
         document.getElementById("sharedpropertiesgrid").style.display ="";        
        document.getElementById("topPager").style.display ="none";
        }
      if(document.getElementById("bottomPager")!=null)
        {
         document.getElementById("sharedpropertiesgridbottom").style.display ="";   
        document.getElementById("bottomPager").style.display ="none";
        }
    
    

    xmlHttp=GetXmlHttpObject();
    if (xmlHttp==null)
    {
        alert ("Your browser does not support AJAX!");
        return;
    } 
    var url=Path +"search/quicksearchresult?" + str;
    
    xmlHttp.onreadystatechange=resultsChange;
    
    xmlHttp.open("GET",url,true);
    xmlHttp.send(null);
} 
function resultsChange() 
{ 
    if (xmlHttp.readyState==4)
    { 
        document.getElementById("QuickSearchResults").innerHTML=xmlHttp.responseText;
        if(document.getElementById("topPager")!=null)
        {
        document.getElementById("topPager").style.display ="";
        }
         if(document.getElementById("bottomPager")!=null)
        {
        document.getElementById("bottomPager").style.display ="";
        }
    }
}

function GetKeyWordSearchResults(str)
{
    if (str.length==0)
    {   
        document.getElementById("KeyWordSearchGrid").innerHTML="Could not load search results.";
        return;
    }

    if(document.getElementById("topPager")!=null)
        {
        document.getElementById("sharedpropertiesgrid").style.display ="";        
        document.getElementById("topPager").style.display ="none";
        }
      if(document.getElementById("bottomPager")!=null)
        {
         document.getElementById("sharedpropertiesgridbottom").style.display ="";
        document.getElementById("bottomPager").style.display ="none";
        }
    

    xmlHttp=GetXmlHttpObject();
    if (xmlHttp==null)
    {
        alert ("Your browser does not support AJAX!");
        return;
    } 
   
    var url=Path +"search/keywordsearch?" + str;
    
    xmlHttp.onreadystatechange=resultsKeyWordChanged;
    
    xmlHttp.open("GET",url,true);
    xmlHttp.send(null);
} 
function resultsKeyWordChanged() 
{ 
    if (xmlHttp.readyState==4)
    { 
        document.getElementById("KeywordResults").innerHTML=xmlHttp.responseText;
         if(document.getElementById("topPager")!=null)
        {
        document.getElementById("topPager").style.display ="";
        }
         if(document.getElementById("bottomPager")!=null)
        {
        document.getElementById("bottomPager").style.display ="";
        }
    }
}

function GetSearchResults(str)
{
    if (str.length==0)
    {   
        document.getElementById("SearchResults").innerHTML="Could not load search results.";
        return;
    }

    if(document.getElementById("topPager")!=null)
        {
         document.getElementById("sharedpropertiesgrid").style.display ="";        
        document.getElementById("topPager").style.display ="none";
        }
      if(document.getElementById("bottomPager")!=null)
        {
         document.getElementById("sharedpropertiesgridbottom").style.display ="";
        document.getElementById("bottomPager").style.display ="none";
        }
    

    xmlHttp=GetXmlHttpObject();
    if (xmlHttp==null)
    {
        alert ("Your browser does not support AJAX!");
        return;
    } 
   
    var url=Path +"search/homesearch?" + str;
    
    xmlHttp.onreadystatechange=resultsStateChanged;
    
    xmlHttp.open("GET",url,true);
    xmlHttp.send(null);
} 

function resultsStateChanged() 
{ 
    if (xmlHttp.readyState==4)
    { 
        document.getElementById("SearchResults").innerHTML=xmlHttp.responseText;
         if(document.getElementById("topPager")!=null)
        {
        document.getElementById("topPager").style.display ="";
        }
         if(document.getElementById("bottomPager")!=null)
        {
        document.getElementById("bottomPager").style.display ="";
        }
    }
}


function GetAgentBuilderResults(str)
{

    if (str.length==0)
    {   
        document.getElementById("AgentBuilderSearchResult").innerHTML="Could not load search results.";
        return;
    }

    if(document.getElementById("topPager")!=null)
        {
         document.getElementById("agentbuildersearch").style.display ="";        
        document.getElementById("topPager").style.display ="none";
        }
      if(document.getElementById("bottomPager")!=null)
        {
         document.getElementById("agentbuildersearchbottom").style.display ="";       
        document.getElementById("bottomPager").style.display ="none";
        }
    xmlHttp=GetXmlHttpObject();
    if (xmlHttp==null)
    {
        alert ("Your browser does not support AJAX!");
        return;
    } 
   
    var url=Path +"search/realtorgrid?" + str;
    
    xmlHttp.onreadystatechange=resultsAgentBuilderChanged;
    
    xmlHttp.open("GET",url,true);
    xmlHttp.send(null);
} 

function resultsAgentBuilderChanged() 
{ 
    if (xmlHttp.readyState==4)
    { 
        document.getElementById("AgentBuilderSearchResult").innerHTML=xmlHttp.responseText;
      if(document.getElementById("topPager")!=null)
        {
        document.getElementById("topPager").style.display ="";
        }
         if(document.getElementById("bottomPager")!=null)
        {
        document.getElementById("bottomPager").style.display ="";
        }
    }
}
function GetReqSearchResults(str)
{
 
    if (str.length==0)
    {   
        document.getElementById("RequirmentGridResults").innerHTML="Could not load search results.";
        return;
    }

     if(document.getElementById("topPager")!=null)
        {
         document.getElementById("propertyrequirment").style.display ="";        
        document.getElementById("topPager").style.display ="none";
        }
      if(document.getElementById("bottomPager")!=null)
        {
        document.getElementById("propertyrequirmentbottom").style.display ="";     
        document.getElementById("bottomPager").style.display ="none";
        }
    
    xmlHttp=GetXmlHttpObject();
    if (xmlHttp==null)
    {
        alert ("Your browser does not support AJAX!");
        return;
    } 
   
    var url=Path +"search/RequirementSearch?" + str;
    
    xmlHttp.onreadystatechange=reqresultsChanged;
    
    xmlHttp.open("GET",url,true);
    xmlHttp.send(null);
} 
function GetRequirementGridResults(str)
{
 
    if (str.length==0)
    {   
        document.getElementById("RequirmentGridResults").innerHTML="Could not load search results.";
        return;
    }

     if(document.getElementById("topPager")!=null)
        {
         document.getElementById("propertyrequirment").style.display ="";        
        document.getElementById("topPager").style.display ="none";
        }
      if(document.getElementById("bottomPager")!=null)
        {
        document.getElementById("propertyrequirmentbottom").style.display ="";     
        document.getElementById("bottomPager").style.display ="none";
        }
    
    xmlHttp=GetXmlHttpObject();
    if (xmlHttp==null)
    {
        alert ("Your browser does not support AJAX!");
        return;
    } 
   
    var url=Path +"account/propertiesrequirmentgrid?" + str;
    
    xmlHttp.onreadystatechange=reqresultsChanged;
    
    xmlHttp.open("GET",url,true);
    xmlHttp.send(null);
} 

function reqresultsChanged() 
{ 
    if (xmlHttp.readyState==4)
    { 
        document.getElementById("RequirmentGridResults").innerHTML=xmlHttp.responseText;
       if(document.getElementById("topPager")!=null)
        {
        document.getElementById("topPager").style.display ="";
        }
         if(document.getElementById("bottomPager")!=null)
        {
        document.getElementById("bottomPager").style.display ="";
        }

    }
}
function GetGridResults(str)
{ 
 
    if (str.length==0)
    {   
        document.getElementById("GridResults").innerHTML="Could not load search results.";
        return;
    }
   
        if(document.getElementById("topPager")!=null)
        {
         document.getElementById("propertyinfo").style.display ="";        
         document.getElementById("topPager").style.display ="none";
        }
      if(document.getElementById("bottomPager")!=null)
        {
        document.getElementById("bottomPager").style.display ="none";
        document.getElementById("propertyinfobottom").style.display ="";  
        }
 

    xmlHttp=GetXmlHttpObject();
    if (xmlHttp==null)
    {
        alert ("Your browser does not support AJAX!");
        return;
    } 
  
    var url=Path +"account/propertiesinfogrid?" + str;
    
    xmlHttp.onreadystatechange=resultsChanged;
    
    xmlHttp.open("GET",url,true);
    xmlHttp.send(null);
} 

function resultsChanged() 
{ 
    if (xmlHttp.readyState==4)
    { 
        document.getElementById("GridResults").innerHTML=xmlHttp.responseText;
        if(document.getElementById("topPager")!=null)
        {
        document.getElementById("topPager").style.display ="";
        }
         if(document.getElementById("bottomPager")!=null)
        {
        document.getElementById("bottomPager").style.display ="";
        }
    }
}

function GetGridReplies(str)
{

    if (str.length==0)
    {   
        document.getElementById("GridReplies").innerHTML="Could not load search results.";
        return;
    }

     if(document.getElementById("bottomPager")!=null)
        {
         document.getElementById("recievedgrid").style.display ="";
         document.getElementById("bottomPager").style.display ="none";
         }    
      
         
    xmlHttp=GetXmlHttpObject();
    if (xmlHttp==null)
    {
        alert ("Your browser does not support AJAX!");
        return;
    } 

    var url=Path +"account/responsereceivedgrid?" + str;
    
    xmlHttp.onreadystatechange=resulChanged2;
    
    xmlHttp.open("GET",url,true);
    xmlHttp.send(null);
}

function resulChanged2() 
{ 
    if (xmlHttp.readyState==4)
    { 
        document.getElementById("GridReplies").innerHTML=xmlHttp.responseText;
     
         if(document.getElementById("bottomPager")!=null)
        {
        document.getElementById("bottomPager").style.display ="";
        }
    }
}


function GetFavoriteProperty(str)
{

    if (str.length==0)
    {   
        document.getElementById("FavoriteProperty").innerHTML="Could not load search results.";
        return;
    }
   
     if(document.getElementById("bottomPager")!=null)
        {
         document.getElementById("Searchmanagement").style.display ="";
          document.getElementById("bottomPager").style.display ="none";
         }    
      
      

    xmlHttp=GetXmlHttpObject();
    if (xmlHttp==null)
    {
        alert ("Your browser does not support AJAX!");
        return;
    } 

    var url=Path +"account/searchmanagment?" + str;
    
    xmlHttp.onreadystatechange=ChangeFavoriteProperty;
    
    xmlHttp.open("GET",url,true);
    xmlHttp.send(null);
}

function ChangeFavoriteProperty() 
{ 
    if (xmlHttp.readyState==4)
    { 
        document.getElementById("favoriteproperty").innerHTML=xmlHttp.responseText;
   
         if(document.getElementById("bottomPager")!=null)
        {
        document.getElementById("bottomPager").style.display ="";
        }
    }
}
function GetRecentProperties(str)
{
    if (str.length==0)
    {   
        document.getElementById("RecentProperties").innerHTML="Could not load search results.";
        return;
    }
   
    if(document.getElementById("bottomPager")!=null)
        {
         document.getElementById("Searchmanagement").style.display ="";        
        document.getElementById("bottomPager").style.display ="none";
        }

    xmlHttp=GetXmlHttpObject();
    if (xmlHttp==null)
    {
        alert ("Your browser does not support AJAX!");
        return;
    } 

    var url=Path +"account/searchmanagment?" + str;
    
    xmlHttp.onreadystatechange=ChangeRecentlyViewProperty;
    
    xmlHttp.open("GET",url,true);
    xmlHttp.send(null);
}

function ChangeRecentlyViewProperty() 
{ 
    if (xmlHttp.readyState==4)
    { 
        document.getElementById("RecentProperties").innerHTML=xmlHttp.responseText;
    
         if(document.getElementById("bottomPager")!=null)
        {
        document.getElementById("bottomPager").style.display ="";
        }
    }
}


function GetPropertyTypes(str)
{
var PropertyCategory;

    if(str=="-1")
    {
        alert("Select Property Category");
        return false;
    }
    else if(str=="Residential")
    {
        PropertyCategory=1;        
    }
    else if(str=="Commercial")
    {
        PropertyCategory=2;
    }
    else if(str=="Land")
    {
        PropertyCategory=3;             
    }
  if (str.length==0)
    {   
        document.getElementById("PropertyType").innerHTML="Could not load search results.";
        return;
    }
   
    document.getElementById("PropertyType").innerHTML="<span class='errmsg'>Loading Search Results...</span><img src='http://images.realsoil.com/progress.gif' alt='progress' />";
    xmlHttp=GetXmlHttpObject();
    if (xmlHttp==null)
    {
        alert ("Your browser does not support AJAX!");
        return;
    } 

    var url=Path +"helper/propertytype/" + PropertyCategory;
    
    xmlHttp.onreadystatechange=ChangePropertyType;
    
    xmlHttp.open("GET",url,true);
    xmlHttp.send(null);
}

function ChangePropertyType() 
{ 
    if (xmlHttp.readyState==4)
    { 
        document.getElementById("PropertyType").innerHTML=xmlHttp.responseText;
    }
}

function GetRealtorPropertiesGrid(str)
{

    if (str.length==0)
    {   
        document.getElementById("AgentPropertiesGrid").innerHTML="Could not load search results.";
        return;
    }

     if(document.getElementById("topPager")!=null)
        {
         document.getElementById("sharedpropertiesgrid").style.display ="";
         document.getElementById("topPager").style.display ="none";
        }
     if(document.getElementById("bottomPager")!=null)
        {
         document.getElementById("sharedpropertiesgridbottom").style.display ="";   
        document.getElementById("bottomPager").style.display ="none";
        }
    
   

    xmlHttp=GetXmlHttpObject();
    if (xmlHttp==null)
    {
        alert ("Your browser does not support AJAX!");
        return;
    } 
   
    var url=Path +"search/agentpropertiesinfogrid?" + str;
    
    xmlHttp.onreadystatechange=AgentProperitesGrid;
    
    xmlHttp.open("GET",url,true);
    xmlHttp.send(null);
} 

function AgentProperitesGrid() 
{ 
    if (xmlHttp.readyState==4)
    { 
        document.getElementById("AgentPropertiesGrid").innerHTML=xmlHttp.responseText;
       if(document.getElementById("topPager")!=null)
        {
        document.getElementById("topPager").style.display ="";
        }
       if(document.getElementById("bottomPager")!=null)
        {
        document.getElementById("bottomPager").style.display ="";
        }

    }
}
function textCounter(field,  maxlimit)
{
    if (field.value.length > maxlimit)
        field.value = field.value.substring(0, maxlimit);        
   
}

function Validate()
{
    var ID=document.getElementById("PropertyID").value;
    if(ID=="")
    {
    alert("Please enter Property ID. ");   
 
    return false;
    }
    
for (var i = 0; i < ID.length; i++)
 {
    var ch = ID.substring(i, i+1);
    if ((ch < "0" || "9" < ch) && ch != '.') 
    {
    alert("Please enter Property ID in digits only.\n\n eg : 1234567" );
    return false;
    }
   
}
 return true;
}

	

function GetNRIProperties(str)
{
    if (str.length==0)
    {   
        document.getElementById("NRI").innerHTML="Could not load search results.";
        return;
    }

    if(document.getElementById("bottomPager")!=null)
        {
         document.getElementById("nriproperties").style.display ="";
         document.getElementById("bottomPager").style.display ="none";
        }
    

    xmlHttp=GetXmlHttpObject();
    if (xmlHttp==null)
    {
        alert ("Your browser does not support AJAX!");
        return;
    } 

    var url=Path +"properties/nripropertiesGrid?" + str;
    
    xmlHttp.onreadystatechange=NRIresult;
    
    xmlHttp.open("GET",url,true);
    xmlHttp.send(null);
}

function NRIresult() 
{ 
    if (xmlHttp.readyState==4)
    { 
        document.getElementById("NRI").innerHTML=xmlHttp.responseText;
    
         if(document.getElementById("bottomPager")!=null)
        {
        document.getElementById("bottomPager").style.display ="";
        }

    }
}

function CheckAll(frm)
{
	var obj=frm.elements["ContactsFrom"];
    for (var i = 0; i <  obj.length; i++) {
	
    if(obj[i].type =='checkbox') {
   
			if(document.getElementById("selectAll").checked) 
			{
				obj[i].checked=true;
			}
			else
			{
				obj[i].checked=false;
			}
	}
  }
}


 function unSelectAll(frm,checkBox){
 var obj=frm.elements["ContactsFrom"];
	if(checkBox.checked == false)
	document.getElementById("selectAll").checked=false;
		
	
	unSelectAll1(frm);

}

function unSelectAll1(frm){
	  var count = 0;
	  var obj=frm.elements["ContactsFrom"];
	for (var i = 0; i < obj.length; i++) 
	{
					
				if(obj[i].type =='checkbox'){
				if(obj[i].checked) 
				{
					count++;
				}			
		}		
	}

	if(count == 3 || count==5){
		document.getElementById("selectAll").checked = true;
	}
	
}



 function unSelectAllContacts(frm,checkBox){
 var obj=frm.elements["ContactsFrom"];
	if(checkBox.checked == false)
	document.getElementById("selectAll").checked=false;
		
	
	unSelectAll11(frm);

}

function unSelectAll11(frm){
	  var count = 0;
	  var obj=frm.elements["ContactsFrom"];
	for (var i = 0; i < obj.length; i++) 
	{
					
				if(obj[i].type =='checkbox'){
				if(obj[i].checked) 
				{
					count++;
				}			
		}		
	}

	if(count == 5){
		document.getElementById("selectAll").checked = true;
	}
	
}

function GetAdminGrid(str)
{
 
    if (str.length==0)
    {   
        document.getElementById("AdminGrid").innerHTML="Could not load search results.";
        return;
    }

    if(document.getElementById("bottomPager")!=null)
        {
         document.getElementById("adminproperties").style.display ="";
         document.getElementById("bottomPager").style.display ="none";
        }
    xmlHttp=GetXmlHttpObject();
    if (xmlHttp==null)
    {
        alert ("Your browser does not support AJAX!");
        return;
    } 
  
    var url=Path +"admin/ListOfProperties?" + str;
    
    xmlHttp.onreadystatechange=adminresultsChanged1;
    
    xmlHttp.open("GET",url,true);
    xmlHttp.send(null);
} 

function adminresultsChanged1() 
{ 
    if (xmlHttp.readyState==4)
    { 
        document.getElementById("AdminGrid").innerHTML=xmlHttp.responseText;
         if(document.getElementById("bottomPager")!=null)
        {
        document.getElementById("bottomPager").style.display ="";
        }
        
    }
}
function GetFeedbackGrid(str)
{
 
    if (str.length==0)
    {   
        document.getElementById("AdminFeedbackGrid").innerHTML="Could not load search results.";
        return;
    }

    if(document.getElementById("bottomPager")!=null)
        {
         document.getElementById("adminfeedback").style.display ="";
         document.getElementById("bottomPager").style.display ="none";
        }
    
    xmlHttp=GetXmlHttpObject();
    if (xmlHttp==null)
    {
        alert ("Your browser does not support AJAX!");
        return;
    } 
  
    var url=Path +"admin/feedbacklist?" + str;
    
    xmlHttp.onreadystatechange=adminresultsChanged;
    
    xmlHttp.open("GET",url,true);
    xmlHttp.send(null);
} 

function adminresultsChanged() 
{ 
    if (xmlHttp.readyState==4)
    { 
        document.getElementById("AdminFeedbackGrid").innerHTML=xmlHttp.responseText;
         if(document.getElementById("bottomPager")!=null)
        {
        document.getElementById("bottomPager").style.display ="";
        }
    }
}
function GetErrorLogGrid(str)
{
 
    if (str.length==0)
    {   
        document.getElementById("AdminErrorLogGrid").innerHTML="Could not load search results.";
        return;
    }

    if(document.getElementById("bottomPager")!=null)
        {
         document.getElementById("adminErrorLog").style.display ="";
         document.getElementById("bottomPager").style.display ="none";
        }
    
    xmlHttp=GetXmlHttpObject();
    if (xmlHttp==null)
    {
        alert ("Your browser does not support AJAX!");
        return;
    } 
  
    var url=Path +"admin/errorloglist?" + str;
    
    xmlHttp.onreadystatechange=errorlogresultsChanged;
    
    xmlHttp.open("GET",url,true);
    xmlHttp.send(null);
} 

function errorlogresultsChanged() 
{ 
    if (xmlHttp.readyState==4)
    { 
        document.getElementById("AdminErrorLogGrid").innerHTML=xmlHttp.responseText;
         if(document.getElementById("bottomPager")!=null)
        {
        document.getElementById("bottomPager").style.display ="";
        }
    }
}
function GetServicesResults(str)
{
   if (str.length==0)
    {   
        document.getElementById("ServicesGrid").innerHTML="Could not load search results.";
       
       
        return;
    }

   if(document.getElementById("topPager")!=null)
        {
         document.getElementById("Services").style.display ="";
         document.getElementById("topPager").style.display ="none";
         } 
         if(document.getElementById("bottomPager")!=null)
        {
        document.getElementById("bottomPager").style.display ="none";
         document.getElementById("Servicesbottom").style.display ="";
        }
        
 

    xmlHttp=GetXmlHttpObject();
    if (xmlHttp==null)
    {
        alert ("Your browser does not support AJAX!");
        return;
    } 
  
    var url=Path +"home/directoryservicesgrid?" + str;
    
    xmlHttp.onreadystatechange=ServicesGridChanged;
    
    xmlHttp.open("GET",url,true);
    xmlHttp.send(null);
} 

function ServicesGridChanged() 
{ 
    if (xmlHttp.readyState==4)
    { 
        document.getElementById("ServicesGrid").innerHTML=xmlHttp.responseText;
        if(document.getElementById("topPager")!=null)
        {
        document.getElementById("topPager").style.display ="";
        }
         if(document.getElementById("bottomPager")!=null)
        {
        document.getElementById("bottomPager").style.display ="";
        }
    }
}

function GetNewsResults(str)
{
   if (str.length==0)
    {   
        document.getElementById("NewsGrid").innerHTML="Could not load search results.";
       
       
        return;
    }

   if(document.getElementById("topPager")!=null)
        {
         document.getElementById("News").style.display ="";
         document.getElementById("topPager").style.display ="none";
         } 
         if(document.getElementById("bottomPager")!=null)
        {
        document.getElementById("bottomPager").style.display ="none";
         document.getElementById("Newsbottom").style.display ="";
        }
        
 

    xmlHttp=GetXmlHttpObject();
    if (xmlHttp==null)
    {
        alert ("Your browser does not support AJAX!");
        return;
    } 
  
    var url=Path +"home/newsgrid?" + str;
    
    xmlHttp.onreadystatechange=NewsGridChanged;
    
    xmlHttp.open("GET",url,true);
    xmlHttp.send(null);
} 

function NewsGridChanged() 
{ 
    if (xmlHttp.readyState==4)
    { 
        document.getElementById("NewsGrid").innerHTML=xmlHttp.responseText;
        if(document.getElementById("topPager")!=null)
        {
        document.getElementById("topPager").style.display ="";
        }
         if(document.getElementById("bottomPager")!=null)
        {
        document.getElementById("bottomPager").style.display ="";
        }
    }
}

function GetReplyGrid(str)
{
    if (str.length==0)
    {   
        document.getElementById("ReplyGrid").innerHTML="Could not load search results.";
        return;
    }

    if(document.getElementById("bottomPager")!=null)
        {
         document.getElementById("recievedgrid").style.display ="";
         document.getElementById("bottomPager").style.display ="none";
        }
   
    xmlHttp=GetXmlHttpObject();
    if (xmlHttp==null)
    {
        alert ("Your browser does not support AJAX!");
        return;
    } 

    var url=Path +"account/RepliesSentGrid?" + str;
    
    xmlHttp.onreadystatechange=resultChanged1;
    
    xmlHttp.open("GET",url,true);
    xmlHttp.send(null);
}

function resultChanged1() 
{ 
    if (xmlHttp.readyState==4)
    { 
        document.getElementById("ReplyGrid").innerHTML=xmlHttp.responseText;
     
         if(document.getElementById("bottomPager")!=null)
        {
        document.getElementById("bottomPager").style.display ="";
        }
    }
}
 
  function checkAll(field)
        {
       
        for (i = 0; i <field.length; i++)
           field[i].checked = true ;
        }

 function uncheckAll(field)
        {
        for (i = 0; i <field.length; i++)
	        field[i].checked = false ;
        }
        
     
