﻿$(document).ready(function () {
    var SelfLocation = window.location.href.split('?');
    switch (SelfLocation[1]) {
        case "defined_width":
            $(".MegaMenuLink").megamenu(".MegaMenuContent", {
                width: "850px"
            });
            break;
        case "auto_width_right":
            $(".MegaMenuLink").megamenu(".MegaMenuContent", {
                justify: "right"
            });
            $('.MegaMenu').css("text-align", "right");
            break;
        case "defined_width_right":
            $(".MegaMenuLink").megamenu(".MegaMenuContent", {
                justify: "right",
                width: "850px"
            });
            $('.MegaMenu').css("text-align", "right");
            break;
        default:
            $(".MegaMenuLink").megamenu(".MegaMenuContent", '.hi');
            break;
    }
    SetActiveMenuItem();

    //side navigation link active
    var pathname = window.location.pathname;
    var pathnameSplit1 = pathname.split(".");
    var pathnameSplit2 = pathnameSplit1[0].split("/");
    var pathnameFinal = pathnameSplit2[pathnameSplit2.length - 1] + '.aspx';
    var Element = $("div.pane").children();
    for (i = 0; i < Element.length; i++) {
        if ($(Element[i]).attr('href') == pathnameFinal) {
            $(Element[i]).addClass('sideactive');
        }
    }

});



function SetActiveMenuItem() {
    var control = document.getElementById('tabid');

    if (control != null) {

        var menuID = control.innerHTML;
        //                alert(menuID);
        var menuHeader = $("#" + menuID);
        //                alert(menuHeader);
        menuHeader.addClass("current");
        menuHeader.addClass("active");
        $("#" + menuID).next().css("display", "block");
    }
}

function UseLink(ctr) {

    switch (ctr) {
        case 1:
            window.location = 'Aboutus.aspx';
            break;
        case 2:

            window.location = 'Services_Overview.aspx';
            break;
        case 3:
            window.location = 'Use_Cases.aspx';
            break;
        case 4:
            window.location = 'Recent_Press_Releases.aspx';
            break;
        case 5:
            window.location = 'Current_Openings.aspx';
            break;
        case 6:
            window.location = 'Email_and_Contact_Info.aspx';
            break;
        default:
            //window.location = '#';
    }
}
