var leftNavOverrides = {

    init: function() {

        /* -- Top Nav BABY BUTTON OVERRIDE -- */
        var babyButton = $('division50733');
        if (babyButton != null) {
            babyButton.parentNode.href = "/browse/info.do?cid=51350&mlink=5151,1472852&clink=1472852";
        }

        /*-- Top Nav STORES AND EVENTS BUTTON OVERRIDE -- */
        var storesButton = $('division51209');
        if (storesButton != null) {
            storesButton.parentNode.href = "/browse/info.do?cid=50784&mlink=5151,1472852&clink=1472852";
        }

        //fix long petite sorts
        var wPetiteSort = $("categoryNav49708");
        if (wPetiteSort != null) {
            wPetiteSort.firstChild.href += "&pageID=0";
        }

        //fix long tall sorts
        var wTallSort = $("categoryNav49709");
        if (wTallSort != null) {
            wTallSort.firstChild.href += "&pageID=0";
        }

        //Newborn Division - BB Redirect
        var bbLinkInNB = $('categoryNav51469');
        if (bbLinkInNB != null) {
            bbLinkInNB.firstChild.href = "/browse/division.do?cid=6149";
        }

        //Newborn Division - BG Redirect
        var bgLinkInNB = $('categoryNav51468');
        if (bgLinkInNB != null) {
            bgLinkInNB.firstChild.href = "/browse/division.do?cid=6241";
        }

        //BG Division - Newborn Redirects
        var newBornLinkInBG = $('categoryNav51474');
        if (newBornLinkInBG != null) {
            newBornLinkInBG.firstChild.href = "/browse/division.do?cid=51375";
        }


        //BB Division - Newborn Redirects
        var newBornLinkInBB = $('categoryNav51477');
        if (newBornLinkInBB != null) {
            newBornLinkInBB.firstChild.href = "/browse/division.do?cid=51375";
        }

        //fix long bargain sorts
        $$("li[class=sale category]").each(function(categoryNode) {
            if (categoryNode && categoryNode.firstChild.href.indexOf('&pageID=0') < 0) {
                categoryNode.firstChild.href += "&pageID=0";
            }
        });

        //fix long selected bargain sorts
        $$("li[class=sale categorySelected categoryActive]").each(function(categoryNode) {
            if (categoryNode) {
                categoryNode.firstChild.href += "&pageID=0";
            }
        });

        //fix long selected bargain sorts again
        $$("li[class=sale category previewHighlighter3A]").each(function(categoryNode) {
            if (categoryNode) {
                categoryNode.firstChild.href += "&pageID=0";
            }
        });

        //bold these NB left nav items
        if ($('categoryNav51646') != null) {
            //not sale links
            if ($('categoryNav51646').down().innerHTML.indexOf('Sale') < 0) {
                $('categoryNav51646').style.fontWeight = 'bold';
            }
        }
        if ($('categoryNav51666') != null) {
            //not sale links
            if ($('categoryNav51666').down().innerHTML.indexOf('Sale') < 0) {
                $('categoryNav51666').style.fontWeight = 'bold';
            }
        }

        //Bold left nav - "Shop Baby Girl..."
        if ($('categoryNav51468') != null) {
            if ($('categoryNav51468').down().innerHTML.indexOf('Sale') < 0) {
                $('categoryNav51468').style.fontWeight = 'bold';
            }
        }
        //Bold left nav - "Shop Baby Boy..."
        if ($('categoryNav51469') != null) {
            if ($('categoryNav51469').down().innerHTML.indexOf('Sale') < 0) {
                $('categoryNav51469').style.fontWeight = 'bold';
            }
        }
        
        if ($('categoryNav51477') != null) {
            $('categoryNav51477').style.fontWeight = 'bold';
        }

        if ($('categoryNav51474') != null) {
            if ($('categoryNav51474').down().innerHTML.indexOf('Sale') < 0) {
                $('categoryNav51474').style.fontWeight = 'bold';
            }
        }

    }

};

Event.observe(window, "load", leftNavOverrides.init);
