/* ##########################################################################################################################

    Namespace : NRT.MySite
    Classes   : UI
    Summary	  : Contains all the scripts to handle the entire client side functionality for the
                NRT MySite User-Interface functionality. 
    Copyright : (c) 2006 NRT Inc. All rights reserved.

    RevisionHistory: 
    -------------------------------------------------------------------------------------------------------------------------
    Date		Name		    Description
    -------------------------------------------------------------------------------------------------------------------------
    08/10/2006	Dale Lawless	Initial Creation

###########################################################################################################################*/

NRT.MySite.UI = function ()
{    
    return {
        /*******************************************************************************************************************
        *									P U B L I C   M E T H O D S
        *******************************************************************************************************************/
        /*==================================================================================
            Method		: clear
            Summary		: Clear the Textbox to allow data entry
            Author		: Dale Lawless
            Create Date	: 08/10/2006
        ====================================================================================*/
        clear: function (element) 
        {
            try
            {
                element.style.display = 'inline';
                element.value = '';
                _oUtility.setFocus(element);
            }
            catch(err)
            {
                _oErrorHandler.Error('NRT.MySite.UI.clear', _oErrorHandler.ERRORTYPE_JS, err);
            }
        },

        /*==================================================================================
            Method		: clearAgentInfo
            Summary		: Clears out the agent information on the calling window.
            Author		: Dale Lawless
            Create Date	: 01/11/2007
        ====================================================================================*/
        clearAgentInfo: function ()
        {    
            var oAgentID = null;
            var oAgentName = null;
            var oDisplayAgent = null;
            var oClearAgent = null;
            var oDisplayAgentParent = null;
            var oDisplayAgentTeamParent = null;
            
            try
            {
                // Agent ID
                oAgentID = _oUtility.getElementByTagNameAndID('hdnAgentID','INPUT');
                if (oAgentID !== null) {
                    oAgentID.value = 0;
                } else {
                    oAgentID = window.opener._oUtility.getElementByTagNameAndID('hdnAgentID','INPUT');
                    if (oAgentID !== null) { oAgentID.value = 0; }
                }
                
                // Agent name
                oAgentName = _oUtility.getElementByTagNameAndID('hdnAgentName','INPUT');
                if (oAgentName !== null) {
                    oAgentName.value = '';
                } else {
                    oAgentName = window.opener._oUtility.getElementByTagNameAndID('hdnAgentName','INPUT');
                    if (oAgentName !== null) { oAgentName.value = ''; }
                }
                    
                // Display Agent
                oDisplayAgent = document.getElementById('spnDisplayAgent');
                if (oDisplayAgent !== null) {
                    oDisplayAgent.innerHTML = '';
                } else {
if (window.opener !== null && typeof window.opener !== 'undefined') {
                    oDisplayAgent = window.opener.document.getElementById('spnDisplayAgent','INPUT');
                    if (oDisplayAgent !== null) { oDisplayAgent.innerHTML = ''; }
}                    
                }
                
// AgentTeamText selector
oSelAgentText = document.getElementById('spnSelectAgentText');
if (oSelAgentText === null && window.opener !== null && typeof window.opener !== 'undefined') {
oSelAgentText = window.opener.document.getElementById('spnSelectAgentText');
}
// AgentTeamText selector
oSelAgentTeamText = document.getElementById('spnSelectAgentTeamText');
if (oSelAgentTeamText === null && window.opener !== null && typeof window.opener !== 'undefined') {
oSelAgentTeamText = window.opener.document.getElementById('spnSelectAgentTeamText');
}

                //Display the parentElement if it is a DIV, do nothing if the parentElement is a PANEL
                oDisplayAgentParent = oSelAgentText.parentElement;
                if (oDisplayAgentParent !== null && typeof oDisplayAgentParent !== 'undefined' )
                {
                    var parentId = oDisplayAgentParent.id;
                    if (parentId.indexOf("_divSelectAgent") > 0)
                    {
                        oDisplayAgentParent.style.display = 'inline';
                    }
                }
                    
                //Display the parentElement if it is a DIV, do nothing if the parentElement is a PANEL
                if (oSelAgentTeamText != null)
                {
                    oDisplayAgentTeamParent = oSelAgentTeamText.parentElement;
                    if (oDisplayAgentTeamParent !== null && typeof oDisplayAgentTeamParent !== 'undefined' )
                    {
                        var parentId = oDisplayAgentTeamParent.id;
                        if (parentId.indexOf("_divSelectAgentTeam") > 0)
                        {
                            oDisplayAgentTeamParent.style.display = 'inline';
                        }
                    }
                 }   
                // Clear Agent
                oClearAgent = document.getElementById('spnClearAgent');
                if (oClearAgent !== null) 
                {
                    oClearAgent.style.display = 'none';
oSelAgentText.style.display = '';
                } else {
if (window.opener !== null && typeof window.opener !== 'undefined') {
                    oClearAgent = window.opener.document.getElementById('spnClearAgent','INPUT');
                    if (oClearAgent !== null) { 
                        oClearAgent.style.display = 'none'; 
oSelAgentText.style.display = '';
                    }
}
                }
            }
            catch(err)
            {
                _oErrorHandler.Error('NRT.MySite.UI.clearAgentInfo', _oErrorHandler.ERRORTYPE_JS, err);
            }
        },

        /*==================================================================================
            Method		: clearTeamInfo
            Summary		: Clears out the team information on the calling window.
            Author		: Dale Lawless
            Create Date	: 10/26/2007
        ====================================================================================*/
        clearTeamInfo: function ()
        {    
            var oTeamID = null;
            var oTeamName = null;
            var oDisplayTeam = null;
            var oClearTeam = null;
            
            try
            {
                // Team ID
                oTeamID = _oUtility.getElementByTagNameAndID('hdnTeamID','INPUT');
                if (oTeamID !== null) {
                    oTeamID.value = 0;
                } else {
                    oTeamID = window.opener._oUtility.getElementByTagNameAndID('hdnTeamID','INPUT');
                    if (oTeamID !== null) { oTeamID.value = 0; }
                }
                
                // Team name
                oTeamName = _oUtility.getElementByTagNameAndID('hdnTeamName','INPUT');
                if (oTeamName !== null) {
                    oTeamName.value = '';
                } else {
                    oTeamName = window.opener._oUtility.getElementByTagNameAndID('hdnTeamName','INPUT');
                    if (oTeamName !== null) { oTeamName.value = ''; }
                }
                    
                // Display Team
                oDisplayTeam = document.getElementById('spnDisplayTeam','INPUT');
                if (oDisplayTeam !== null) {
                    oDisplayTeam.innerHTML = '';
                } else {
if (window.opener !== null && typeof window.opener !== 'undefined') {
                    oDisplayTeam = window.opener.document.getElementById('spnDisplayTeam','INPUT');
                    if (oDisplayTeam !== null) { oDisplayTeam.innerHTML = ''; }
}
                }
                
// AgentTeamText selector
oSelAgentText = document.getElementById('spnSelectAgentText');
if (oSelAgentText === null && window.opener !== null && typeof window.opener !== 'undefined') {
oSelAgentText = window.opener.document.getElementById('spnSelectAgentText');
}

                // Clear Team
                oClearTeam = document.getElementById('spnClearTeam');
                if (oClearTeam !== null) 
                {
                    oClearTeam.style.display = 'none';
oSelAgentText.style.display = '';
                } else {
if (window.opener !== null && typeof window.opener !== 'undefined') {
                    oClearTeam = window.opener.document.getElementById('spnClearTeam','INPUT');
                    if (oClearTeam !== null) { 
                        oClearTeam.style.display = 'none'; 
oSelAgentText.style.display = '';
                    }
}
                }
            }
            catch(err)
            {
                _oErrorHandler.Error('NRT.MySite.UI.clearTeamInfo', _oErrorHandler.ERRORTYPE_JS, err);
            }
        },        
    
        /*==================================================================================
            Method		: getSelectedCheckBoxes
            Summary		: Returns an array of all selected check boxes.
            Author		: Dale Lawless
            Create Date	: 01/05/2007
        ====================================================================================*/
        getSelectedCheckBoxes: function (checkboxName)
        {   
            var aSelectedCheckBoxes = [];
            var allInputs = null; 
            var x = 0;
            
            try
            {		
                allInputs = _oUtility.getElementsByTagNameAndID(checkboxName,'INPUT');
                
                // Set all check boxes to disabled
                for (x = 0; x < allInputs.length; x += 1)
                {
                    // Make sure it's a checkbox box
                    if (allInputs[x].type === 'checkbox')
                    {
                        // Make sure it was checked
                        if (allInputs[x].checked === true) 
                        {
                            // Add the checkbox to the array
                            aSelectedCheckBoxes.push(allInputs[x]);
                        }
                    }
                }
                return aSelectedCheckBoxes;
            }
            catch(err)
            {
                _oErrorHandler.Error('NRT.MySite.UI.getSelectedCheckBoxes', _oErrorHandler.ERRORTYPE_JS, err);
            }			
        },

        /*==================================================================================
            Method		: initialize
            Summary		: Initialization script to set variables throughout MySite user-interface.
            Author		: Dale Lawless
            Create Date	: 02/06/2007
        ====================================================================================*/
        initialize: function (Settings)
        {    
            var sArray = null;
            
            try
            {
                // Set MySite Configuration Settings
                sArray = Settings.split("|");
                    
                if (sArray.length > 0)	   			
            {
                    // Sets the MySite javascript variables from Config settings 
                    _WebsiteID = sArray[0];
                    _MetroMySiteName = sArray[1];
                    _CookieExpireDays = sArray[2];	
                    _CookieLoginExpireMin = sArray[3];
                    _MaxSavedProperties = sArray[4];
                    _MaxSavedSearches = sArray[5];
                    _SavedSearchXSLTPath = sArray[6];
                    _SavedSearchDetailsXSLTPath = sArray[7];
                    _ShowGlobalAlerts = sArray[8];
                    _ShowEmailAlerts = sArray[9];
                    _ShowFreq = sArray[10];
                    _ShowAdditionalEmail = sArray[11];
                    _ShowSendToAgent = sArray[12];
                    _AllowDisableAccount = sArray[13];	
                    _EmailFrom = sArray[14];
                    _AltEmailTo = sArray[15];	
                    _AgentLinkURL = sArray[16];
                    _WebsiteHasTeams = sArray[17];
            }
                                
            // Prefill Email Address on Login Window
            if (NRT.MySite.UI.pageIsMySiteLogin())		
            {
                NRT.MySite.Login.prefillEmailAddress();
            }
                
            // Prefill Email Address on Authentication Panel
            if (NRT.MySite.UI.pageIsPropertySearch() || NRT.MySite.UI.pageIsPropertyResults() || NRT.MySite.UI.pageIsPropertyDetails() )
            {
                NRT.MySite.Authentication.prefillEmailAddress();
            }
                
            // Set Forms Authentication Cookie for pages that fetch the consumer id
            NRT.MySite.Authentication.setFormsAuthCookie();	  
            }
            catch(err)
            {
                _oErrorHandler.Error('NRT.MySite.initialize', _oErrorHandler.ERRORTYPE_JS, err);
                return;
            }
        },
                
        /*==================================================================================
            Method		: initTab
            Summary		: Initializes the tab on my saved home page when it is first loaded.
            Author		: Dale Lawless
            Create Date	: 12/06/2006
        ====================================================================================*/
        initTab: function () 
        {   
            var aTabs = null;
            
            try
            {
                NRT.MySite.TabCaptions.init();
                aTabs = NRT.MySite.TabCaptions.getTabCaptions();
                if (aTabs !== null)
                {
                    _oTab.setTabs(aTabs);
                    _oTab.setTabAlign('LEFT');
                    _oTab.load();
                }
            }
            catch(err)
            {
                _oErrorHandler.Error('NRT.MySite.UI.initTab', _oErrorHandler.ERRORTYPE_JS, err);
                return;
            }
        },

        /*==================================================================================
            Method		: pageIsMySiteHome
            Summary		: Determines if the current page is the login page.
            Author		: Dale Lawless
            Create Date	: 01/26/2007
        ====================================================================================*/
        pageIsMySiteHome: function () 
        {   
            var sSearchString  = ''; 
            var sPageName = '';
            
            try
            {
                sSearchString = window.location.pathname.toUpperCase();
                sPageName = sSearchString.search(/MYSITEHOME.ASPX/);
                if (sPageName > 0) 
                {
                    return true;  
                } else {
                    return false;
                }
            }
            catch(err)
            {
                _oErrorHandler.Error('NRT.MySite.UI.pageIsMySiteHome', _oErrorHandler.ERRORTYPE_JS, err);
                return;
            }
        },

        /*==================================================================================
            Method		: pageIsMySiteLogin
            Summary		: Determines if the current page is the login page.
            Author		: Dale Lawless
            Create Date	: 01/26/2007
        ====================================================================================*/
        pageIsMySiteLogin: function () 
        {   
            var sSearchString  = ''; 
            var sPageName = '';    
            
            try
            {
                sSearchString = window.location.pathname.toUpperCase();
                sPageName = sSearchString.search(/MYSITELOGIN.ASPX/);
                if (sPageName > 0)
                {
                    return true; 
                } else {
                    return false;
                }
            }
            catch(err)
            {
                _oErrorHandler.Error('NRT.MySite.UI.pageIsMySiteLogin', _oErrorHandler.ERRORTYPE_JS, err);
                return;
            }
        },
        
        /*==================================================================================
            Method		: pageIsMySiteMain
            Summary		: Determines if the current page is the mysite main page.
            Author		: Dale Lawless
            Create Date	: 02/17/2007
        ====================================================================================*/
        pageIsMySiteMain: function () 
        {    
            var sSearchString  = ''; 
            var sPageName = '';    
            
            try
            {
                sSearchString = window.location.pathname.toUpperCase();
                sPageName = sSearchString.search(/MYSITEMAIN.ASPX/);
                if (sPageName > 0)
                {
                    return true;   
                } else {
                    return false; 
                }
            }
            catch(err)
            {
                _oErrorHandler.Error('NRT.MySite.UI.pageIsMySiteMain', _oErrorHandler.ERRORTYPE_JS, err);
                return;
            }
        },

        /*==================================================================================
            Method		: pageIsMySiteRegister
            Summary		: Determines if the current page is the register page.
            Author		: Dale Lawless
            Create Date	: 11/08/2007
        ====================================================================================*/
        pageIsMySiteRegister: function () 
        {   
            var sSearchString  = ''; 
            var sPageName = '';    
            
            try
            {
                sSearchString = window.location.pathname.toUpperCase();
                sPageName = sSearchString.search(/MYSITEREGISTER.ASPX/);
                if (sPageName > 0)
                {
                    return true; 
                } else {
                    return false;
                }
            }
            catch(err)
            {
                _oErrorHandler.Error('NRT.MySite.UI.pageIsMySiteRegister', _oErrorHandler.ERRORTYPE_JS, err);
                return;
            }
        },
        
        /*==================================================================================
            Method		: pageIsPropertyDetails
            Summary		: Determines if the current page is the Property Details page.
            Author		: Dale Lawless
            Create Date	: 01/26/2007
        ====================================================================================*/
        pageIsPropertyDetails: function () 
        {   
            var sSearchString  = ''; 
            var sPageName = '';    
            
            try
            {
                sSearchString = window.location.pathname.toUpperCase();
                sPageName = sSearchString.search(/PROPERTYDETAILS.ASPX/);
                if (sPageName > 0) 
                {
                    return true;  
                } else {
                    return false; 
                }
            }
            catch(err)
            {
                _oErrorHandler.Error('NRT.MySite.UI.pageIsPropertyDetails', _oErrorHandler.ERRORTYPE_JS, err);
                return;
            }
        },
        
        /*==================================================================================
            Method		: pageIsPropertySearch
            Summary		: Determines if the current page is the Property Search page.
            Author		: Dale Lawless
            Create Date	: 01/26/2007
        ====================================================================================*/
        pageIsPropertySearch: function () 
        {  
            var sSearchString  = ''; 
            var sPageName = '';    
            
            try
            {
                sSearchString = window.location.pathname.toUpperCase();
                sPageName = sSearchString.search(/PROPERTYSEARCH.ASPX/);
                if (sPageName > 0)
                {
                    return true;  
                } else {
                    return false; 
                }
            }
            catch(err)
            {
                _oErrorHandler.Error('NRT.MySite.UI.pageIsPropertySearch', _oErrorHandler.ERRORTYPE_JS, err);
                return;
            }
        },
        
        /*==================================================================================
            Method		: pageHasAuthentication
            Summary		: Determines if the current page contains an authentication panel.
            Author		: Dale Lawless
            Create Date	: 10/30/2007
        ====================================================================================*/
        pageHasAuthentication: function () 
        {   
            var oDivAuthSavedSearchLogin = document.getElementById('divAuthSavedSearchLogin');

            try {
                if (oDivAuthSavedSearchLogin !== null && typeof oDivAuthSavedSearchLogin !== 'undefined') {
                    if (oDivAuthSavedSearchLogin.style.visibility !== "hidden" || oDivAuthSavedSearchLogin.style.display  !== "none" || oDivAuthSavedSearchLogin.disabled !== true) {
                        return true;
                    } else {
                        return false;  
                    }                        
                }
            } catch(err) {
                _oErrorHandler.Error('NRT.MySite.UI.pageHasAuthentication', _oErrorHandler.ERRORTYPE_JS, err);
                return;
            }
        },
                
        /*==================================================================================
            Method		: pageIsHomePage
            Summary		: Determines if the current page is the Property Search page.
            Author		: Uma Chandrasekar
            Create Date	: 03/13/2007
        ====================================================================================*/
        pageIsHomePage: function () 
        {   
            var sSearchString  = ''; 
            var sPageName = '';    

            try
            {
                sSearchString = window.location.pathname.toUpperCase();
                if (sSearchString.search(/.ASPX/)<=0)
                {
                    sPageName = 1
                } else {
                    sPageName = sSearchString.search(/DEFAULT.ASPX/);
                }
                    
                if (sPageName > 0)
                {
                    return true;
                } else {
                    return false;  
                }
            }
            catch(err)
            {
                _oErrorHandler.Error('NRT.MySite.UI.pageIsHomePage', _oErrorHandler.ERRORTYPE_JS, err);
                return;
            }
        },

        /*==================================================================================
            Method		: pageIsPropertyResults
            Summary		: Determines if the current page is the Property Results page.
            Author		: Dale Lawless
            Create Date	: 01/26/2007
        ====================================================================================*/
        pageIsPropertyResults: function () 
        {  
            var sSearchString  = ''; 
            var sPageName = '';    
            
            try
            {
                sSearchString = window.location.pathname.toUpperCase();
                sPageName = sSearchString.search(/PROPERTYRESULTS.ASPX/);
                if (sPageName > 0) 
                {
                    return true;
                } else {
                    return false;
                }
            }
            catch(err)
            {
                _oErrorHandler.Error('NRT.MySite.UI.pageIsPropertyResults', _oErrorHandler.ERRORTYPE_JS, err);
                return;
            }
        },
        

        /*==================================================================================
            Method		: redirectToHomePage
            Summary		: Redirect the user to the home page.
            Author		: Dale Lawless
            Create Date	: 01/17/2007
        ====================================================================================*/
        redirectToHomePage: function () 
        {
            try
            {
                window.location = _oUtility.getAppPath() + _HomePageURL;
            }
            catch(err)
            {
                _oErrorHandler.Error('NRT.MySite.UI.redirectToHomePage', _oErrorHandler.ERRORTYPE_JS, err);
                return;
            }
        },
        
        /*==================================================================================
            Method		: redirectToLoginPage
            Summary		: Redirect the user to the login page.
            Author		: Dale Lawless
            Create Date	: 01/24/2007
        ====================================================================================*/
        redirectToLoginPage: function (tabID) 
        {
            try
            
            {
     //           var qs = window.location.search;  NO NO NO YOU ADD BRANDING 2 with this
                if (_LoginPageURL.lastIndexOf('?') > -1) {
         //            qs = qs.replace("?","&");                 
                 window.location = _oUtility.getAppPath() + _LoginPageURL;// + qs;
                } else {
                    window.location = _oUtility.getAppPath() + _LoginPageURL;// + qs;
                }
            }
            catch(err)
            {
                _oErrorHandler.Error('NRT.MySite.UI.redirectToLoginPage', _oErrorHandler.ERRORTYPE_JS, err);
                return;
            }
        },
        
        /*==================================================================================
            Method		: redirectToMyAccount
            Summary		: Redirect the user to the My Account page.
            Author		: Dale Lawless
            Create Date	: 01/24/2007
        ====================================================================================*/
        redirectToMyAccount: function () 
        {
            try
            {
                if (NRT.MySite.UI.pageIsMySiteHome())
                {
                    NRT.MySite.UI.tabClick(2);
                } else {
                    var qs = window.location.search; 
                    qs = qs.toLowerCase();

                    if ( (_WebsiteID === '10') &&  (qs.lastIndexOf('ab=1&agentid=') > -1) )
                    {
                        var newURL = qs.replace("tab=0","");
                        if (_MyAccountURL.lastIndexOf('?') > -1)
                        {
                            newURL = newURL.replace("?","&");
                            newURL = newURL.replace("&&","&");                            
                        }
                        newURL = newURL.replace("?&","?");
                        var compareURL = _MyAccountURL.toLowerCase();
                        if (compareURL.lastIndexOf('&ab=1&agentid=') > -1)
                        {
                            window.location = _oUtility.getAppPath() + _MyAccountURL;
                        } else {
                            window.location = _oUtility.getAppPath() + _MyAccountURL + newURL;                        
                        }                        
                    } else {
                        window.location = _oUtility.getAppPath() + _MyAccountURL;
                    }                    
                }
            }
            catch(err)
            {
                _oErrorHandler.Error('NRT.MySite.UI.redirectToMyAccount', _oErrorHandler.ERRORTYPE_JS, err);
                return;
            }
        },
                        
        /*==================================================================================
            Method		: redirectToMySavedProperties
            Summary		: Redirect the user to the My Saved Properties page.
            Author		: Dale Lawless
            Create Date	: 01/24/2007
        ====================================================================================*/
        redirectToMySavedProperties: function () 
        {
            try
            {
                if (NRT.MySite.UI.pageIsMySiteHome())
                {
                    NRT.MySite.UI.tabClick(1);
                } else {
                    if (!NRT.MySite.UI.pageIsHomePage())
                    {
                        Progress.fn.show('',true,'Loading Saved Properties');
                    }
                    
                    var qs = window.location.search; 
                    qs = qs.toLowerCase();

                    if ( (_WebsiteID === '10') &&  (qs.lastIndexOf('ab=1&agentid=') > -1) )
                    {
                        var newURL = qs.replace("tab=0","");
                        if (_MySavedPropertiesURL.lastIndexOf('?') > -1)
                        {
                            newURL = newURL.replace("?","&");
                            newURL = newURL.replace("&&","&");                            
                        }
                        newURL = newURL.replace("?&","?");           
                        var compareURL = _MySavedPropertiesURL.toLowerCase();
                        if (compareURL.lastIndexOf('&ab=1&agentid=') > -1)
                        {
                            window.location = _oUtility.getAppPath() + _MySavedPropertiesURL;
                        } else {
                            window.location = _oUtility.getAppPath() + _MySavedPropertiesURL + newURL;                        
                        }                                                             
                    } else {
                        window.location = _oUtility.getAppPath() + _MySavedPropertiesURL;
                    }                    
                }
            }
            catch(err)
            {
                _oErrorHandler.Error('NRT.MySite.UI.redirectToMySavedProperties', _oErrorHandler.ERRORTYPE_JS, err);
                return;
            }
        },
        
        /*==================================================================================
            Method		: redirectToMySavedSearches
            Summary		: Redirect the user to the My Saved Searches page.
            Author		: Dale Lawless
            Create Date	: 01/24/2007
        ====================================================================================*/
        redirectToMySavedSearches: function () 
        {
            try
            {
                if (NRT.MySite.UI.pageIsMySiteHome())
                {
                    NRT.MySite.UI.tabClick(0);
                } else {
                    if (!NRT.MySite.UI.pageIsHomePage())
                    {
                        Progress.fn.show('',true,'Loading Saved Searches');
                    }
                    
                    var qs = window.location.search; 
                    qs = qs.toLowerCase();

                    if ( (_WebsiteID === '10') &&  (qs.lastIndexOf('ab=1&agentid=') > -1) )
                    {
                        var newURL = qs.replace("tab=0","");
                        if (_MySavedSearchesURL.lastIndexOf('?') > -1)
                        {
                            newURL = newURL.replace("?","&");
                            newURL = newURL.replace("&&","&");                            
                        }
                        newURL = newURL.replace("?&","?");                        
                        var compareURL = _MySavedSearchesURL.toLowerCase();
                        if (compareURL.lastIndexOf('&ab=1&agentid=') > -1)
                        {
                            window.location = _oUtility.getAppPath() + _MySavedSearchesURL;
                        } else {
                            window.location = _oUtility.getAppPath() + _MySavedSearchesURL + newURL;                        
                        }                                                                            
                    } else {
                        window.location = _oUtility.getAppPath() + _MySavedSearchesURL;
                    }                    
                }
            }
            catch(err)
            {
                _oErrorHandler.Error('NRT.MySite.UI.redirectToMySavedSearches', _oErrorHandler.ERRORTYPE_JS, err);
                return;
            }
        },

        /*==================================================================================
            Method		: redirectToRegistrationPage
            Summary		: Redirect the user to the registration page.
            Author		: Dale Lawless
            Create Date	: 01/24/2007
        ====================================================================================*/
        redirectToRegistrationPage: function () 
        {
            try
            {
                // See if we required user to log in first to view property details
                if (NRT.Utility.getQueryStringParam('RedirectURL') !== null)
                {
                    window.location = _oUtility.getAppPath() + _RegisterPageURL + '?RedirectURL=' + _oUtility.decodeURL(NRT.Utility.getQueryStringParam('RedirectURL'));
                }
                else
                {
                    window.location = _oUtility.getAppPath() + _RegisterPageURL;// + window.location.search;
                }
            }
            catch(err)
            {
                _oErrorHandler.Error('NRT.MySite.UI.redirectToRegistrationPage', _oErrorHandler.ERRORTYPE_JS, err);
                return;
            }
        },
    
        /*==================================================================================
            Method		: redirectToPropertyResultsPage
            Summary		: Redirect the user to the property results page.
            Author		: Dale Lawless
            Create Date	: 01/24/2007
        ====================================================================================*/
        redirectToPropertyResultsPage: function (ConsumerSearchID,SearchOptionID) 
        {  
            var DTSince = null;
            var dtToday = null;
            var dtMonth = null;
            var dtDay = null;
            var dtYear = null;
            var iConsumerId = 0;
            var oLastLoginDate  = null; 
            var sURL = '';
            
            try
            {
                switch (SearchOptionID)
                {
                    case 0:
                        // All Matches
                        DTSince = null;
                        break;
                    case 1:
                        // Today's matches
                        dtToday = new Date();
                        dtMonth = dtToday.getMonth() + 1;
                        dtDay = dtToday.getDate();
                        dtYear = dtToday.getFullYear();
                        DTSince = dtMonth + '/' + dtDay + '/' + dtYear;
                        break;
                    case 2:
                        // Since Last Login
                        //Make AJAX call to get the last login date
                        iConsumerId = NRT.MySite.Authentication.getConsumerID();
                        oLastLoginDate = MySiteProvider.GetLastLoginDate(_WebsiteID, iConsumerId);
                        if (oLastLoginDate !== null && typeof oLastLoginDate !== 'undefined')
                        {
                            DTSince = oLastLoginDate.value;
                        }
                        break;
                }
                    
                sURL = _oUtility.getAppPath() + _PropertyResultsURL;
                
                if (sURL.indexOf('?') > -1)
                {
                    sURL += '&ConsumerSearchID=' + ConsumerSearchID + '&CallingPage=7' + '&SearchOption=' + SearchOptionID;
                } else {
                    sURL += '?ConsumerSearchID=' + ConsumerSearchID + '&CallingPage=7' + '&SearchOption=' + SearchOptionID;
                }
                    
                if (DTSince !== null && typeof DTSince !== 'undefined')
                {
                    sURL += '&DTSince=' + DTSince ;
                }
                
                window.location = sURL;
                
            }
            catch(err)
            {
                _oErrorHandler.Error('NRT.MySite.UI.redirectToPropertyResultsPage', _oErrorHandler.ERRORTYPE_JS, err);
                return;
            }
        },
            
        /*==================================================================================
            Method		: redirectToPropertySearchPage
            Summary		: Redirect the user to the login page.
            Author		: Dale Lawless
            Create Date	: 01/24/2007
        ====================================================================================*/
        redirectToPropertySearchPage: function () 
        {
            try
            {
                if (_WebsiteID === '10')
                {
                    var qs = window.location.search;
                    qs = qs.toLowerCase();
                    if (qs.lastIndexOf('ab=1&agentid=') > -1)
                    {
                        var newURL = qs.replace("?","&");      
                        newURL = newURL.replace(/propsearch=[0-9]+/,"");                                             
                        
                        var compareURL = _PropertySearchURL.toLowerCase();
                        if (compareURL.lastIndexOf('ab=1&agentid=') > -1)
                        {
                            window.location = _oUtility.getAppPath() + _PropertySearchURL;
                        } else {
                            window.location = _oUtility.getAppPath() + _PropertySearchURL + newURL;                        
                        }
                    } else {
                        window.location = _oUtility.getAppPath() + _PropertySearchURL;                                        
                    }
                } else {
                    window.location = _oUtility.getAppPath() + _PropertySearchURL;                    
                }                                
            }
            catch(err)
            {
                _oErrorHandler.Error('NRT.MySite.UI.redirectToPropertySearchPage', _oErrorHandler.ERRORTYPE_JS, err);
                return;
            }
        },
                
        /*==================================================================================
            Method		: setAgentInfo
            Summary		: Displays the agent information on the calling window
                          This is updated after the user elects to use the Agent Lookup 
                          functionality.
            Author		: Dale Lawless
            Create Date	: 01/11/2007
        ====================================================================================*/
        setAgentInfo: function (personnelID,agentName)
        {    
            var oAgentID = null; 
            var oAgentName = null;
            var oDisplayAgent = null;
            var oClearAgent = null;
            var oDisplayAgentParent = null;
            var oDisplayAgentTeamParent = null;
            try
            {
                // Clear out any previously selected Teams
                NRT.MySite.UI.clearTeamInfo();
            
                // Agent ID
                oAgentID = _oUtility.getElementByTagNameAndID('hdnAgentID','INPUT');
                if (oAgentID !== null)
                {
                    oAgentID.value = personnelID;
                } else {
                    oAgentID = window.opener._oUtility.getElementByTagNameAndID('hdnAgentID','INPUT');
                    if (oAgentID !== null)
                    {
                        oAgentID.value = personnelID;
                    }
                }
                
                // Agent name
                oAgentName = _oUtility.getElementByTagNameAndID('hdnAgentName','INPUT');
                if (oAgentName !== null)
                {
                    oAgentName.value = agentName;
                } else{
                    oAgentName = window.opener._oUtility.getElementByTagNameAndID('hdnAgentName','INPUT');
                    if (oAgentName !== null)
                    {
                        oAgentName.value = agentName;
                    }
                }
                
            // AgentTeamText selector
            oSelAgentText = document.getElementById('spnSelectAgentText');
            if (oSelAgentText === null && (window.opener !== null && typeof window.opener !='undefined')) {
            oSelAgentText = window.opener.document.getElementById('spnSelectAgentText');
            }
            // AgentTeamText selector
            oSelAgentTeamText = document.getElementById('spnSelectAgentTeamText');
            if (oSelAgentTeamText === null && (window.opener !== null && typeof window.opener !='undefined')) {
            oSelAgentTeamText = window.opener.document.getElementById('spnSelectAgentTeamText');
}

                    //Clear the parentElement if it is a DIV, do nothing if the parentElement is a PANEL
                    oDisplayAgentParent = oSelAgentText.parentElement;
                    if (oDisplayAgentParent !== null && typeof oDisplayAgentParent !== 'undefined' )
                    {
                        var parentId = oDisplayAgentParent.id;
                        if (parentId.indexOf("_divSelectAgent") > 0)
                        {
                            oDisplayAgentParent.style.display = 'none';
                        }
                    }
                    //Clear the parentElement if it is a DIV, do nothing if the parentElement is a PANEL
                    if (oSelAgentTeamText != null)
                    {
                        oDisplayAgentTeamParent = oSelAgentTeamText.parentElement;
                        if (oDisplayAgentTeamParent !== null && typeof oDisplayAgentTeamParent !== 'undefined' )
                        {
                            var parentId = oDisplayAgentTeamParent.id;
                            if (parentId.indexOf("_divSelectAgentTeam") > 0)
                            {
                                oDisplayAgentTeamParent.style.display = 'none';
                            }
                        }
                    }
                    
                // Display Agent
                oDisplayAgent = document.getElementById('spnDisplayAgent');
                if (oDisplayAgent !== null)
                {
                    oDisplayAgent.innerHTML = agentName;

                oSelAgentText.style.display = 'none';
                } else {
                    oDisplayAgent = window.opener.document.getElementById('spnDisplayAgent');
                    if (oDisplayAgent !== null) 
                    {
                        oDisplayAgent.innerHTML = agentName;

                oSelAgentText.style.display = 'none';
                    } else {
                oSelAgentText.style.display = '';                       
                    }
                    
                }
                
                // Clear Agent
                oClearAgent = document.getElementById('spnClearAgent');
                if (oClearAgent !== null)
                {
                    oClearAgent.style.display = 'inline';
                } else {
                    oClearAgent = window.opener.document.getElementById('spnClearAgent');
                    if (oClearAgent !== null) 
                    {
                        oClearAgent.style.display = 'inline';
                    }
                }
            }
            catch(err)
            {
                _oErrorHandler.Error('NRT.MySite.UI.setAgentInfo', _oErrorHandler.ERRORTYPE_JS, err);
            }
        },

        /*==================================================================================
            Method		: setTeamInfo
            Summary		: Displays the team information on the calling window
                          This is updated after the user elects to use the Team Lookup 
                          functionality.
            Author		: Dale Lawless
            Create Date	: 10/26/2007
        ====================================================================================*/
        setTeamInfo: function (TeamID,TeamName)
        {    
            var oTeamID = null; 
            var oTeamName = null;
            var oDisplayTeam = null;
            var oClearTeam = null;
            try
            {
                // Clear out any previously selected Agents
                NRT.MySite.UI.clearAgentInfo();
            
                // Team ID
                oTeamID = _oUtility.getElementByTagNameAndID('hdnTeamID','INPUT');
                if (oTeamID !== null)
                {
                    oTeamID.value = TeamID;
                } else {
                    oTeamID = window.opener._oUtility.getElementByTagNameAndID('hdnTeamID','INPUT');
                    if (oTeamID !== null)
                    {
                        oTeamID.value = TeamID;
                    }
                }
                
                // Team name
                oTeamName = _oUtility.getElementByTagNameAndID('hdnTeamName','INPUT');
                if (oTeamName !== null)
                {
                    oTeamName.value = TeamName;
                } else{
                    oTeamName = window.opener._oUtility.getElementByTagNameAndID('hdnTeamName','INPUT');
                    if (oTeamName !== null)
                    {
                        oTeamName.value = TeamName;
                    }
                }
                
// AgentTeamText selector
oSelAgentText = document.getElementById('spnSelectAgentText');
if (oSelAgentText === null && window.opener !== null) {
oSelAgentText = window.opener.document.getElementById('spnSelectAgentText');
}
                
                // Display Team
                oDisplayTeam = document.getElementById('spnDisplayTeam');
                if (oDisplayTeam !== null)
                {
                    oDisplayTeam.innerHTML = TeamName;

oSelAgentText.style.display = 'none';
                } else {
                    oDisplayTeam = window.opener.document.getElementById('spnDisplayTeam');
                    if (oDisplayTeam !== null) 
                    {
                        oDisplayTeam.innerHTML = TeamName;

oSelAgentText.style.display = 'none';
                    } else {
oSelAgentText.style.display = '';
                    }
                    
                }
                
                // Clear Team
                oClearTeam = document.getElementById('spnClearTeam');
                if (oClearTeam !== null)
                {
                    oClearTeam.style.display = 'inline';
                } else {
                    oClearTeam = window.opener.document.getElementById('spnClearTeam');
                    if (oClearTeam !== null) 
                    {
                        oClearTeam.style.display = 'inline';
                    }
                }
            }
            catch(err)
            {
                _oErrorHandler.Error('NRT.MySite.UI.setTeamInfo', _oErrorHandler.ERRORTYPE_JS, err);
            }
        },
                
        /*==================================================================================
            Method		: setCheckBoxTextStyle
            Summary		: Called when a checkbox is clicked. Will bold or remove 
                          the bolding of the text.
            Author		: Dale Lawless
            Create Date	: 01/05/2007
        ====================================================================================*/
        setCheckBoxTextStyle: function (control)
        {
            var divTextControl = null;
            
            try
            {
                divTextControl = control.parentNode;
                                
                // Determine how do display the text
                if (control.checked)
                {
                    divTextControl.style.fontWeight='bold'; 
                } else {
                    divTextControl.style.fontWeight='';
                }
            }
            catch(err)
            {
                _oErrorHandler.Error('NRT.MySite.UI.setCheckBoxTextStyle', _oErrorHandler.ERRORTYPE_JS, err);
                return;
            }
        },
                        
        /*==================================================================================
            Method		: showAgentLookupWindow 
            Summary		: Opens a new window for the Agent Lookup functionality.
            Author		: Dale Lawless
            Create Date	: 01/11/2007
        ====================================================================================*/
        showAgentLookupWindow: function ()
        {    
            var sURL = '';
            
            try
            {
                sURL = '/MySite/AgentSearch.aspx' + NRT.Utility.Branding.getBranding('?');
                _oUtility.showNewWindow(sURL,'',_WinW_AgentLookup,_WinH_AgentLookup);
            }
            catch(err)
            {
                _oErrorHandler.Error('NRT.MySite.UI.showAgentLookupWindow', _oErrorHandler.ERRORTYPE_JS, err);
            }
        },

        /*==================================================================================
            Method		: showAgentTeamSearchWindow
            Summary		: Opens a new window for the Search Agent or Team Lookup functionality.
            Author		: Dale Lawless
            Create Date	: 10/26/2007
        ====================================================================================*/
        showAgentTeamSearchWindow: function (searchtype)
        {    
            var sURL = '';
            
            try
            {
                if (searchtype === 'agent') {
                    sURL = '/MySite/AgentSearch.aspx?st=a' + NRT.Utility.getBranding('?');
                    _oUtility.showNewWindow(sURL,'',_WinW_AgentLookup,_WinW_AgentLookup);                
                } else if (searchtype === 'team') {
                    sURL = '/MySite/AgentSearch.aspx?st=t' + NRT.Utility.getBranding('?');
                    _oUtility.showNewWindow(sURL,'',_WinW_TeamLookup,_WinH_TeamLookup);                                
                }
            }
            catch(err)
            {
                _oErrorHandler.Error('NRT.MySite.UI.showAgentTeamSearchWindow', _oErrorHandler.ERRORTYPE_JS, err);
            }
        },
        
        /*==================================================================================
            Method		: showConfirmationLayeredWindow
            Summary		: Displays a confirmation layered window.
            Author		: Dale Lawless
            Create Date	: 01/20/2007
        ====================================================================================*/
        showConfirmationLayeredWindow: function (ConfirmType,ConsumerID) 
        {        
            var sQueryString = null;
            
            try
            {
                switch (ConfirmType)
                {
                    case _ConfirmationType_SavedSearches:
                        sQueryString = 'controlType=SaveSearchConfirmation&ConsumerID=' + ConsumerID;
                        _oUtility.showLayeredPage(sQueryString, _WinW_Confirmation, _WinTitle_Confirmation_SS, _DefFocusItemID_Confirmation, _DefFocusItemType_Confirmation);
                        break;
                    case _ConfirmationType_SavedProperties:
                        sQueryString = 'controlType=SavePropertyConfirmation';
                        _oUtility.showLayeredPage(sQueryString, _WinW_Confirmation, _WinTitle_Confirmation_SP, _DefFocusItemID_Confirmation, _DefFocusItemType_Confirmation);
                        break;
                }
            }
            catch(err)
            {
                _oErrorHandler.Error('NRT.MySite.UI.showConfirmationLayeredWindow', _oErrorHandler.ERRORTYPE_JS, err);
                return;
            }
        },
                        
        /*==================================================================================
            Method		: showLayeredWindow
            Summary		: Displays the Window as a Layered Window
            Author		: Dale Lawless
            Create Date	: 08/10/2006
        ====================================================================================*/
        showLayeredWindow: function (control, title, width, defaultfocusitemid, defaultfocusitemtype)
        {
            var sQueryString = null;
            
            try
            {
                // Show the layered page              
                qs = location.search.length > 0 ? '&'+location.search.substr(1) : '';
                sQueryString = 'controlType='+control+qs;
                
                if (width === null) 
                {
                    _oUtility.showLayeredPage(sQueryString, _defWidth, title.toUpperCase(), defaultfocusitemid, defaultfocusitemtype);
                } else {
                    _oUtility.showLayeredPage(sQueryString, width, title.toUpperCase(), defaultfocusitemid, defaultfocusitemtype);
                }
            }
            catch(err)
            {
                _oErrorHandler.Error('NRT.MySite.UI.showLayeredWindow', _oErrorHandler.ERRORTYPE_JS, err);
            }
        },

        /*==================================================================================
            Method		: showRememberMeAlertWindow
            Summary		: Displays the Remember Me as a Layered Alert Window
            Author		: TSA
            Create Date	: 2007.04.04
        ====================================================================================*/
        showRememberMeAlertWindow: function (title)
        {    
            var sHTML  = "";
            
            try
            {
                //contents
                sHTML += "<table style='border:0px; padding:0px; WIDTH:" + (_WinW_RememberMe - 10) + "px;'>";
                sHTML += "<tr>";
                sHTML += "<td class='text'>";
                sHTML += "By selecting the \"Remember Me\" checkbox,";
                sHTML += " <label class='textbold'>" + window.location.host + "</label>";
                sHTML += " will place a cookie on your computer that will";
                sHTML += " automatically log you in when you return to the Web site.";
                sHTML += "</td>";
                sHTML += "</tr>";
                sHTML += "<tr>";
                sHTML += "<td class='text'>";
                sHTML += "If you are using a shared or public computer,";
                sHTML += " we recommend that you do not use this feature."; 
                sHTML += "</td>";
                //sHTML += "</tr>";
                sHTML += "</tr>";
                sHTML += "<tr>";
                sHTML += "<td>";
                sHTML += "<TABLE style='padding:0px; border:0px; width:100%;'>";
                sHTML += "<TR>";
                sHTML += "<td style='height:9px;' class='separatorLineH'>";
                sHTML += "<img src='/NRTProducts/include/images/common_spacer.gif' border='0' width='100%' height='9'>";
                sHTML += "</td>";
                sHTML += "</TR>";
                sHTML += "</TABLE>";
                sHTML += "</td>";
                sHTML += "</tr>";
                sHTML += "<tr>";
                sHTML += "<td style='text-align:center;'>";
                sHTML += "<img id='" + _DefFocusItemID_RememberMe + "' border='0' class='pointer' src='/NRTProducts/include/images/btnOK.gif'";
                sHTML += " onmouseover=\"javascript:NRT.Utility.flipButton(this,1);\"  onmouseout=\"javascript:NRT.Utility.flipButton(this,0);\"";
                sHTML += " onclick=\"javascript:NRT.Utility.closeLayeredPage();this.onblur=null;\" onblur=\"javascript:this.focus();\">";
                sHTML += "</td>";
                sHTML += "</tr>";
                sHTML += "</table>";
                //end of content

                _oUtility.showInfo(sHTML, _WinW_RememberMe, title.toUpperCase(), _DefFocusItemID_RememberMe);
                return;
                
            }
            catch(err)
            {
                _oErrorHandler.Error('NRT.MySite.UI.showRememberMeAlertWindow', _oErrorHandler.ERRORTYPE_JS, err);
            }
        },

        /*==================================================================================
            Method		: showRememberMePopupWindow
            Summary		: Opens the Remember Me page in a new window from a layered window.
            Author		: Dale Lawless
            Create Date	: 01/11/2007
        ====================================================================================*/
        showRememberMePopupWindow: function ()
        {    
            var sQueryString = null; 
            
            try
            {
                sQueryString = 'controlType=RememberMe';
                _oUtility.showNewHostWindow(sQueryString,_WinW_RememberMe,_WinH_RememberMe,'');
            }
            catch(err)
            {
                _oErrorHandler.Error('NRT.MySite.UI.showRememberMePopupWindow', _oErrorHandler.ERRORTYPE_JS, err);
            }
        },
        
        /*==================================================================================
            Method		: showRegistrationPage
            Summary		: Opens Registration page either in a page or in a layered window.
            Author		: Dale Lawless
            Create Date	: 01/19/2007
        ====================================================================================*/
        showRegistrationPage: function ()
        {   
            var sQueryString = null; 
                        
            try
            {
                if (NRT.MySite.UI.pageIsMySiteLogin())
                {
                    // In-Page
                    NRT.MySite.UI.redirectToRegistrationPage();
                } else if (NRT.MySite.UI.pageIsMySiteHome())
                {
                    // New Window
                    sQueryString = 'controlType=Registration';
                    _oUtility.showNewHostWindow(sQueryString,_WinW_Registration,_WinH_Registration,_WinTitle_Registration);
                } else {
                    // Layered Window
                    NRT.MySite.UI.showLayeredWindow("Registration", _WinTitle_Registration, _WinW_Registration, _DefFocusItemID_Registration, _DefFocusItemType_Registration);
                }
            }
            catch(err)
            {
                _oErrorHandler.Error('NRT.MySite.UI.showRememberMePopupWindow', _oErrorHandler.ERRORTYPE_JS, err);
            }
        },
        

        /*==================================================================================
            Method		: tabClick
            Summary		: Tab click event for the My Save Home page.
            Author		: Dale Lawless
            Create Date	: 09/15/2006
        ====================================================================================*/
        tabClick: function (tabId)
        {
            var oLblMSS = null;
            var oLblMSP = null;
            var oLblMA = null; 
            var sBranding = '';
            var sAbrand = '';
            var sTbrand = '';
            var bLoggedIn = false;
            
            try {
                // Check if the user has been authenticated
                bLoggedIn = NRT.MySite.Authentication.isUserLoggedIn();
                if (bLoggedIn === false) {
                    NRT.MySite.UI.redirectToLoginPage(tabId);
                    return;
                }
            
                if (NRT.MySite.Authentication.checkCookieExpiration()) {
                    // Disables links
                    oLblMSS = _oUtility.getElementByTagNameAndID('lblMySavedSearches','LABEL');
                    oLblMSP = _oUtility.getElementByTagNameAndID('lblMySavedProperties','LABEL');
                    oLblMA  = _oUtility.getElementByTagNameAndID('lblMyAccount','LABEL');
                    _oUtility.disableAnchor(oLblMSS,true);
                    _oUtility.disableAnchor(oLblMSP,true);
                    _oUtility.disableAnchor(oLblMA,true);
                    
                    //Show the correct tab
                    _oTab.tabClick(tabId);
                    
                    switch (tabId)
                    {
                        case 0 :
                            //My Saved Searched Tab
                            _oUtility.disableAnchor(oLblMSP,false);	
                            _oUtility.disableAnchor(oLblMA,false);	
                            Progress.fn.show(null,true,'Loading Saved Searches');
                            
                            MySiteUIController.GetMySavedSearchesHTML(this._getMySavedSearchesHTML_Callback);
                            return;
                            
                        case 1 :
                            //My Saved Properties Tab
                            _oUtility.disableAnchor(oLblMSS,false);	
                            _oUtility.disableAnchor(oLblMA,false);
                            
                            //TSA - 2007.04.30 - Added to get branding
                            sAbrand = _oUtility.getQueryStringParam('abrand');
                            sTbrand = _oUtility.getQueryStringParam('tbrand');
                            
                            //TSA - 2007.04.30 - added to handle agent branding
                            if (sAbrand !== null && typeof sAbrand !== 'undefined')
                            {
                                sBranding = 'a' + sAbrand;
                            }
                            
                            //TSA - 2007.04.30 - added to handle team branding
                            if (sTbrand !== null && typeof sTbrand !== 'undefined')
                            {
                                sBranding = 't' + sTbrand;	
                            }
                            //setTimeout("Progress.fn.show('',true,'Loading Saved Properties');",50);
                            Progress.fn.show(null,true,'Loading Saved Properties');
                            MySiteUIController.GetMySavedPropertiesHTML(sBranding,this._getMySavedPropertiesHTML_Callback);
                            return;
                            
                        case 2 :
                            //My Account Tab
                            _oUtility.disableAnchor(oLblMSS,false);
                            _oUtility.disableAnchor(oLblMSP,false);
                            MySiteUIController.GetMyAccountHTML(this._getMyAccountHTML_Callback);
                            return;
                            
                        default :
                            // Should never happen
                            return;            
                    }
                }
            }
            catch(err)
            {
                _oErrorHandler.Error('NRT.MySite.UI.tabClick', _oErrorHandler.ERRORTYPE_JS, err);
                return;
            }
        },

        /******************************************************************************************************************
        *									A J A X   M E T H O D S
        *******************************************************************************************************************/
        /*==================================================================================
            Method		: _getMySavedSearchesHTML_Callback
            Summary		: Ajax callback method to display the My Saved Searches in the 
                          tab contents div control on the MySite home page.
            Author		: Dale Lawless
            Create Date	: 02/15/2007
        ====================================================================================*/
        _getMySavedSearchesHTML_Callback: function (response)
        {    
            var sMySavedSearchesHTML = null;
            var oDivTabContents = null;
            
            try
            {
                if (response.error !== null) 
                {
                    Progress.fn.hide();
                    _oErrorHandler.ResponseError('NRT.MySite.UI._getMySavedSearchesHTML_Callback',response);
                    return; 
                } else {
                    if (response !== null && response.value !== null)
                    {
                        sMySavedSearchesHTML = response.value;
                        if (sMySavedSearchesHTML !== null && typeof sMySavedSearchesHTML !== 'undefined')
                        {
                            // Fill the tab contents div
                            oDivTabContents = document.getElementById('div_MainControl_TabContents');
                            if (oDivTabContents !== null && typeof oDivTabContents !== 'undefined') 
                            {
                                oDivTabContents.innerHTML = sMySavedSearchesHTML;
                            }
                        }
                    }
                }
                Progress.fn.hide();
            }
            catch(err)
            {
                Progress.fn.hide();
                _oErrorHandler.Error('NRT.MySite.UI._getMySavedSearchesHTML_Callback', _oErrorHandler.ERRORTYPE_AJAX, err);
            }
        },
        
        /*==================================================================================
            Method		: _getMySavedPropertiesHTML_Callback
            Summary		: Ajax callback method to display the My Saved Properties in the 
                          tab contents div control on the MySite home page.
            Author		: Dale Lawless
            Create Date	: 02/15/2007
        ====================================================================================*/
        _getMySavedPropertiesHTML_Callback: function (response)
        {  
            var sMySavedPropertiesHTML = null;
            var oDivTabContents = null;
            
            try
            {
                if (response.error !== null) 
                {
                    Progress.fn.hide();
                    _oErrorHandler.ResponseError('NRT.MySite.UI._getMySavedPropertiesHTML_Callback',response);
                    return; 
                } else {
                    if (response !== null && response.value !== null)
                    {
                        sMySavedPropertiesHTML = response.value;
                        if (sMySavedPropertiesHTML !== null && typeof sMySavedPropertiesHTML !== 'undefined')
                        {
                            // Fill the tab contents div
                            oDivTabContents = document.getElementById('div_MainControl_TabContents');
                            if (oDivTabContents !== null && typeof oDivTabContents !== 'undefined') 
                            {
                                oDivTabContents.innerHTML = sMySavedPropertiesHTML;
                            }
                        }
                    }
                }
                Progress.fn.hide();
            }
            catch(err)
            {
                Progress.fn.hide();
                _oErrorHandler.Error('NRT.MySite.UI._getMySavedPropertiesHTML_Callback', _oErrorHandler.ERRORTYPE_AJAX, err);
            }
        },
        
        /*==================================================================================
            Method		: _getMyAccountHTML_Callback
            Summary		: Ajax callback method to display the My Account in the 
                          tab contents div control on the MySite home page.
            Author		: Dale Lawless
            Create Date	: 02/15/2007
        ====================================================================================*/
        _getMyAccountHTML_Callback: function (response)
        {   
            var sMyAccountHTML = null;
            var oDivTabContents = null;
            
            try
            {
                if (response.error !== null) 
                {
                    _oErrorHandler.ResponseError('NRT.MySite.UI._getMyAccountHTML_Callback',response);
                    return; 
                } else {
                    if (response !== null && response.value !== null)
                    {
                        sMyAccountHTML = response.value;
                        if (sMyAccountHTML !== null && typeof sMyAccountHTML !== 'undefined')
                        {
                            // Fill the tab contents div
                            oDivTabContents = document.getElementById('div_MainControl_TabContents');
                            if (oDivTabContents !== null && typeof oDivTabContents !== 'undefined') 
                            {
                                oDivTabContents.innerHTML = sMyAccountHTML;
                            }
                        }
                    }
                }
            }
            catch(err)
            {
                _oErrorHandler.Error('NRT.MySite.UI._getMyAccountHTML_Callback', _oErrorHandler.ERRORTYPE_AJAX, err);
            }
        },
        
        setAlertTextStyle: function (control)
        {    
            var oParent = null;
            
           try
            {
                oParent = control.parentNode;
                
               if (control.checked)
               {
                   oParent.className = 'smallbold';
               } else {
                   oParent.className = 'small';
                }
            }
            catch(err)
            {
                _oErrorHandler.Error('NRT.MySite.UI.setAlertTextStyle', _oErrorHandler.ERRORTYPE_JS, err);
                return;
            }
        }
    };
}();
