lreJS = new Object();
lreJS.hostName = 'http://www.luxuryrealestate.com/';
lreJS.blankPage = '<html><body bgcolor="white"></body></html>';

function lre_loadPage(frm)
{
        if(typeof(frm) == "undefined")
        {
                frm = lremain;
        }

        if(window.location.hash == "" && (window.location.search == "" || window.location.search == "?nav=lre") )
        {
                // Standard search page - nothing funky in the URL
                frm.location = lreJS.hostName + removeLeadingSlash(lreConfig.searchPage);
        }
        else if (window.location.hash == "")
        {
                var action = 'index';
                if(window.location.search.indexOf("action=show") > 0)
                {
                    action = 'show';
                }

                // We're passing information to the frame via whatever arguments we have in our url after ?
                frm.location = lreJS.hostName + 'reciprocity/' + action + window.location.search;
        }
        else
        {
                // This is a single listing, we got here from an email link
                frm.location = lreJS.hostName + 'reciprocity/show?' +  window.location.hash.substring(1);
        }
}


function lre_dynamic_loadPage(pageToLoad, metadata)
{
        if(pageToLoad == '')
        {
                lremain.location = lreJS.hostName + 'reciprocity/index?bruid=' + lreConfig.firmKey + '&Keyword=' + metadata;
        }
        else
        {
                //lremain.location = lreJS.hostName + removeLeadingSlash(lreConfig.searchPage);
                lre_loadPage();
        }
}

function removeLeadingSlash(str)
{
        while(str.indexOf("/") == 0)
        {
                str = str.substring(1);
        }

        return str;
}

