var RbwTabs = RbwTabs || new (function () {
    var _pages = [
        '/account/customerhome.aspx',
        '/account/customerlogin.aspx',
        '/account/savedlistinglist.aspx',
        '/account/savedsearchlist.aspx',
        '/account/profile.aspx',
        '/agentsearch/agentsearch.aspx'
    ];
    
    this.init = function () {
        var location = window.location.href.toLowerCase();
        $.each(_pages, function () {
            var page = this;
            if (location.indexOf(page) > 0) {
            
                $('body').addClass('customer-dashboard');
                           
                try {
                    window.top.$('h1').html('Real Estate Center');
                } catch (e) {}
                
                // Replace any hyperlinks to listingsearch.aspx to point to Start a new search instead
                $('a').each(function () {
                    if ($(this).attr('href') && $(this).attr('href').toLowerCase() == page) {
                        $("a[href*='ListingSearch.aspx']").attr('href', '/pages/map-search?newsearch=1').attr('target', '_top');
                    }
                });
                return;
            }
        }); 
    }

})();

$(document).ready(function () {
    RbwTabs.init();
});

