var leftNavOverrides = {

    init: function() {

        /* ADD TRACKING TO TOP NAV BUTTONS - (NOT including Super Search Button)*/
		/*
        var thisContentItemId = "1670248";
        var trackingQueryString = null;
        var topNavButtons = [
                { "divID": "division5360", "label": "women" },
                { "divID": "division5585", "label": "wPlus" },
                { "divID": "division5758", "label": "maternity" },
                { "divID": "division5155", "label": "men" },
                { "divID": "division6027", "label": "girls" },
                { "divID": "division5910", "label": "boys" },
                { "divID": "division50733", "label": "baby" },
                { "divID": "division51209", "label": "super" }
        ];

        for (i = 0; i < topNavButtons.length; i++) {
            trackingQueryString = "&mlink=topnav,topnav,tn_" + topNavButtons[i].label + "&clink=topnav";
            objTarget = $(topNavButtons[i].divID);
            if (objTarget) {
                objTarget.parentNode.href += trackingQueryString;
            }
        };
		*/
        /* END - ADD TRACKING TO TOP NAV */

        /* OPEN WINDOW FOR SUPER AND SHOW DISRUPTOR */
        var superSearchButton = $("division54501");
        if (superSearchButton) {
            superSearchButton.parentNode.setAttribute("target", "_blank");
            superSearchButton.parentNode.href = "http://www.iwannabesuper.com/?id=tn";
			
			//set rollover for HP only
			if(omni.strCurrentPageName == 'on:browse:Oldnavy.com') {
				superSearchButton.onmouseover = function(){
					superSearchRollover.showDisruptor(); //this object is with the disruptor code
				}
			}
		}
        /* END OPEN WINDOW FOR SUPER */

        /* START WOMENS PETITE DIVISION */
        /* -- Left Nav "Special Sizes" Womens (on Petite) BUTTON OVERRIDE -- */
        var specialSizesWomenButton = $('categoryNav54214');
        if (specialSizesWomenButton != null) {
            specialSizesWomenButton.firstChild.href = "/browse/division.do?cid=5360&mlink=5151,1672631,SS_LN&clink=1672631";
        }

        /* -- Left Nav "Special Sizes" Womens Tall (on Petite) BUTTON OVERRIDE -- */
        var specialSizesTallButton = $('categoryNav54215');
        if (specialSizesTallButton != null) {
            specialSizesTallButton.firstChild.href = "/browse/division.do?cid=49709&mlink=5151,1672631,SS_LN&clink=1672631";
        }
        /* END WOMENS PETITE DIVISION */


        /* START WOMENS TALL DIVISION */
        /* -- Left Nav "Special Sizes" Womens BUTTON OVERRIDE -- */
        var specialSizesWomenButton = $('categoryNav54219');
        if (specialSizesWomenButton != null) {
            specialSizesWomenButton.firstChild.href = "/browse/division.do?cid=5360&mlink=5151,1672631,SS_LN&clink=1672631";
        }
        /* -- Left Nav "Special Sizes" Womens Petite BUTTON OVERRIDE -- */
        var specialSizesWomenPetiteButton = $('categoryNav54220');
        if (specialSizesWomenPetiteButton != null) {
            specialSizesWomenPetiteButton.firstChild.href = "/browse/division.do?cid=49708&mlink=5151,1672631,SS_LN&clink=1672631";
        }
        /* END WOMENS TALL DIVISION */


        /* START WOMENS DIVISION */
        /* -- Left Nav "Special Sizes" Womens Petite BUTTON OVERRIDE -- */
        var specialSizesWomenPetiteButton = $('categoryNav54222');
        if (specialSizesWomenPetiteButton != null) {
            specialSizesWomenPetiteButton.firstChild.href = "/browse/division.do?cid=49708&mlink=5151,1672631,SS_LN&clink=1672631";
        }

        /* -- Left Nav "Special Sizes" Womens Tall BUTTON OVERRIDE -- */
        var specialSizesWomenTallButton = $('categoryNav54223');
        if (specialSizesWomenTallButton != null) {
            specialSizesWomenTallButton.firstChild.href = "/browse/division.do?cid=49709&mlink=5151,1672631,SS_LN&clink=1672631";
        }
        /* END WOMENS DIVISION */


        /* -- Top Nav STORES AND EVENTS BUTTON OVERRIDE -- */
        /*
        var storesButton = $('division54501');
        if (storesButton != null) {
            storesButton.parentNode.href = "/browse/info.do?cid=16156&mlink=5151,1672631,TN&clink=1672631";
        }
        */
        
        //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);
