﻿var HI = HI || {};

HI = (function () {
    // Private
    if (!Array.indexOf) {
        Array.prototype.indexOf = function (obj) {
            for (var i = 0; i < this.length; i++) {
                if (this[i].indexOf(obj) != -1) {
                    return i;
                }
            }
            return -1;
        }
    }

    var sections = [
            "",
            "search",
            "schedule.asp",
            "contact.asp",
            "forum account",
            "qanda",
            "books",
            "womansword.asp",
            "newsletter",
            "products",
            "",
            "",
            "videos.asp",
            ""
        ];
    return {
        SetActiveNavColumnLink: function () {
            var currentSection = window.location.pathname.split('/')[1];
            var currentSectionIndex = sections.indexOf(currentSection);

            $("nav_column_links a").each(function () {
                $(this).removeClass("current");
            });
            $("#nav_column_links a").eq(currentSectionIndex).addClass("current");
        },

        GetUrlVars: function () {
            var vars = [], hash;
            var hashes = window.location.href.slice(window.location.href.indexOf('?') + 1).split('&');
            for (var i = 0; i < hashes.length; i++) {
                hash = hashes[i].split('=');
                vars.push(hash[0]);
                vars[hash[0]] = hash[1];
            }
            return vars;
        }
    };
} ());
