﻿// JScript File

//function searchResults()
//{  
//    var ddlCity = document.getElementById('ctl00_ddlCitySearch');
//    var locId = ddlCity.value;            
//    var cityName = ddlCity.options[ddlCity.selectedIndex].innerText;
//    
//    if(locId == 'Any City')
//        locId = -1;        
//    //showProcessImage();      
//    //UserMaster.SearchPropertyByCity(locId,searchResults_CallBack);       
//    
//    //window.location.href = "/HomeForRent.aspx?locid=" + locId;
//    window.location.href = "/"+ cityName +"/"+ locId +"/SearchResults.aspx";
//}

//function searchResults_CallBack(response)
//{
//    document.getElementById('Message').innerHTML = "";
//    if(response!=null && response.error==null && response.value!=null)
//    {   
//        if(window.location.href.search('HomeForRent.aspx')!=-1)
//            hideHomeForRentPage();
//               
//        if(response.value == 0)        
//            document.getElementById('divContentPage').innerHTML = "Error While Searching Property.";        
//        else
//        {                 
//            document.title = "The Best Place for Searching Your New Home.";
//            document.getElementById('divContentPage').innerHTML = response.value;
//            pgSz = document.getElementById('hdnPageSize').value;            
//            propertyResultsPaging(1,pgSz);
//        }
//    }     
//}

//function showPropertyDetails(propId, address)
//{     
//    var URL = window.location.href;
//    var pgArr = URL.split('#');
//    var pgName = pgArr[pgArr.length - 1];
//    URL = URL.replace("#","");    
//    URL = URL.replace(pgName,"#Property+" + address + "+"+ propId);    
//    window.location.href = URL;
//    globaladdress = address;
    
//    globalHomesForRentResult = document.getElementById('divContentPage').innerHTML;      
//    showProcessImage();   
//    UserMaster.ShowPropertyDetails(propId,showPropertyDetails_CallBack);
//}
//function showPropertyDetails_CallBack(response)
//{
//    document.getElementById('Message').innerHTML = "";
//    if(response!=null && response.error==null && response.value!=null)
//    {        
//        if(response.value == 0)        
//            document.getElementById('divContentPage').innerHTML = "Error While Fetching Property Details.";        
//        else
//        { 
//            //document.title = "Your New Property - Home etc... might be at " + globaladdress;
//            document.title = "Details Of the Property..." ;
//            document.getElementById('divContentPage').innerHTML = response.value;
//        }
//    }    
//}




//----------------------------------------------------------------------------------------------
//----------------------------------    For Home For Rent Page    ------------------------------
//----------------------------------------------------------------------------------------------

function hideHomeForRentPage()
{
    document.getElementById('spnHomeForRent').innerHTML = "<a href='javascript:showHomeForRentPage()'><img border=0 style='vertical-align:bottom;' src='/images/nolines_plus.gif' /></a><strong>Advance Search</strong>";
    document.getElementById('ctl00_CPHUser_divHomeForRent').style.display = "none";
}

function showHomeForRentPage()
{   
    document.getElementById('spnHomeForRent').innerHTML = "<a href='javascript:hideHomeForRentPage()'><img border=0 style='vertical-align:bottom;' src='/images/nolines_minus.gif' /></a><strong>Advance Search</strong>";
    document.getElementById('ctl00_CPHUser_divHomeForRent').style.display = "block";
}

function redirectToHomesForRent()
{
    if(window.location.href.search('SearchResults.aspx')!=-1 || window.location.href.search('HomeForRent.aspx')!=-1)
        showHomeForRentPage();
    else
        window.location.href = "/HomeForRent.aspx";
}


