
if (!NavXp) { var NavXp = {}; }
if (!NavXp.skin) { NavXp.skin = {}; }
if (!NavXp.skins) { NavXp.skins = {}; }

NavXp.skins["HorizontalDropdowns/Windows Standard"] = {
    init : function() {
    },
    
    show : function(item, panel) {
    
        // let us do some caching
        if (!item.root) { 
            item.root = item.parents(".NavXpRoot:first");
            panel.length && panel.css("top", panel.parents(".navxp_HDD_WindowsStandard:first").position().top + item.outerHeight() + 2 + "px");
        }
        if (!item.parentPanels) { item.parentPanels = item.parents(".child_container"); }
        if (!item.otherPanels) { item.otherPanels = item.root.find(".child_container").not(item.parentPanels).not(panel); }
        if (!item.rootItem) { item.rootItem = item.parentPanels.length > 0 ? item.parentPanels.filter(":last").parent().next("a:first") : item; }
        if (!item.parentItems) { item.parentItems = item.parentPanels.prev("a"); }
        if (!item.otherItems) { item.otherItems = item.root.find(".itemLN:visible").not(item.parentItems); }

        // prevent parents from hiding
        item.parentPanels.each( function() {
            clearTimeout(this["timeout"]);
        });

        // prevent this popup from hiding
        if (panel.get(0)) {
            if (item.parentPanels.length > 0) {
                panel.css("left", item.position().left + item.outerWidth());
                panel.css("top", item.position().top);
            }
            clearTimeout(panel.get(0)["timeout"]);
            panel.css("z-index", "201");
        }
        
        // hide the rest of the popups
        item.otherPanels.filter(":visible").css("z-index", "200").slideUp("fast");
        
        // keep all parent items marked as selected
        item.parentItems.addClass("selChild");

        // and unselect the rest
        item.otherItems.removeClass("selChild");
        item.root.find(".itemL0Lower").not(item.rootItem).removeClass("itemL0Sel");
        panel.length && item.rootItem.addClass("itemL0Sel");
        
        panel.find(".child_container").show().hide(); // solves IE6 bug
        
        panel.slideDown("fast");
    },

    hide : function(item, panel) {

        // let us do some caching
        if (!item.root) { item.root = item.parents(".NavXpRoot:first"); }
        if (!item.parentPanels) { item.parentPanels = item.parents(".child_container"); }
        if (!item.otherPanels) { item.otherPanels = item.root.find(".child_container").not(item.parentPanels).not(panel); }
        if (!item.rootItem) { item.rootItem = item.parentPanels.length > 0 ? item.parentPanels.filter(":last").parent().next("a:first") : item; }
        if (!item.parentItems) { item.parentItems = item.parentPanels.prev("a"); }
        if (!item.otherItems) { item.otherItems = item.root.find(".itemLN:visible").not(item.parentItems); }

        //item.otherItems.removeClass("selChild");
       // item.removeClass("selChild");
        //item.parentItems.removeClass("selChild");
        
        // let's hide all popups
        var timer = 500;
        var iCall = 0;
        if (item.parentPanels.length == 0) {
            if (panel.get(0)) {
                panel.get(0)["timeout"] = setTimeout(function() { 
                        panel.slideUp("fast"); 
                        item.rootItem.removeClass("itemL0Sel");
                    }, timer);
            }
        } else {
            for (var i = item.parentPanels.length - 1; i >= 0 ; i--, timer += 200) {
                item.parentPanels.get(i)["timeout"] = setTimeout(function() { 
                    item.parentPanels.eq(iCall).slideUp("fast"); 
                    iCall++; 
                    if (iCall == item.parentPanels.length) {
                        item.rootItem.removeClass("itemL0Sel");
                    }
                }, timer);
            }
        }
    }
}

if (typeof Sys != "undefined" && typeof Sys.Application != "undefined") {
   Sys.Application.notifyScriptLoaded();
} 