﻿var __MENUHANDLERFORM = null;
var __MENUHANDLERHIDDEN = null;
var __MENUHANDLER_P_HIDDEN = null;

var __MenuList = {}
__MenuList = function(){
    this.items = new Array();
    this.items.count = this.items.length;
    return this;
}
__MenuList.prototype = {
    Add: function(lnkid,id,pids){
        this.items[this.items.length] = {linkid: lnkid, menuid: id, pIds:pids};        
        this.items.count = this.items.length;
    }
};

function __createMenuForm(){    
    var newform = document.createElement("form");
    newform.id = "frmMenuBreadCrumbHandler";
    newform.method = "POST";
    newform.action = "";
    newform.style.display = "none";
    var newhdn = document.createElement("input");
    newhdn.id = "hdnMenuBreadCrumbId";
    newhdn.name = "BreadCrumbId";
    newhdn.type = "hidden";
    newform.appendChild(newhdn);
    var newhdnp = document.createElement("input");
    newhdnp.id = "hdnMenuBreadCrumbPIds";
    newhdnp.name = "BreadCrumbPIds";
    newhdnp.type = "hidden";
    newform.appendChild(newhdnp);
    if(document.body.childNodes.length > 0){
        document.body.insertBefore(newform, document.body.firstChild);
    }else{
        document.body.appendChild(newform);
    }
    __MENUHANDLERFORM = document.getElementById(newform.id);
    __MENUHANDLERHIDDEN = document.getElementById(newhdn.id);
    __MENUHANDLER_P_HIDDEN = document.getElementById(newhdnp.id);
    __assignMenuDetails();
}

function __assignMenuDetails(){
    var Menu = new __MenuList();
    Menu.Add("navigationTop-moduleLink9",1,"8");
    Menu.Add("navigationTop-moduleLink27693461",2,"9");
    for(mi=0;mi<Menu.items.count;mi++){
        var currmenuitem = Menu.items[mi];
        var currlnk = document.getElementById(currmenuitem.linkid);        
        if(currlnk!=null){
            currlnk.MenuItem = currmenuitem;
            currlnk.onclick = function(){
                __MENUHANDLERFORM.action = this.href;
                __MENUHANDLERHIDDEN.value = this.MenuItem.menuid;
                __MENUHANDLER_P_HIDDEN.value = this.MenuItem.pIds;
                __MENUHANDLERFORM.submit();
                return false;
            }
        }
    }
}

var displayToppers;
function DisplayFrame(fId){
    var CurrFrame = document.getElementById(fId);    
    if (CurrFrame && displayToppers){
        CurrFrame.style.display="block"
        CurrFrame.style.filter = "alpha(opacity=0)";
        CurrFrame.style.MozOpacity = 0;
    }
}

__createMenuForm();
