/*
* jixedbar - a jQuery fixed bar plugin.
* http://code.google.com/p/jixedbar/
* 
* Version 0.0.5 (Development) - Minified
* 
* Copyright (c) 2009-2010 Ryan Yonzon, http://ryan.rawswift.com/
* Dual licensed under the MIT and GPL licenses:
* http://www.opensource.org/licenses/mit-license.php
* http://www.gnu.org/licenses/gpl.html
* 
* Last update - September 21, 2010
*/
(function ($) {
    $.extend({ jixedbar: new function (options) {
        var constants = { constOverflow: "hidden", constBottom: "0px" }; var defaults = { showOnTop: false, transparent: false, opacity: 0.9, opaqueSpeed: "fast", slideSpeed: "fast", roundedCorners: true, roundedButtons: true, menuFadeSpeed: 250, tooltipFadeSpeed: "slow", tooltipFadeOpacity: 0.8 }; var options = $.extend(defaults, options); var ie6 = (navigator.appName == "Microsoft Internet Explorer" && parseInt(navigator.appVersion) == 4 && navigator.appVersion.indexOf("MSIE 6.0") != -1); var ie7 = (document.all && !window.opera && window.XMLHttpRequest); var button_active = false; var active_button_name = ""; var element_obj; this.construct = function () {
            return this.each(function () {
                var obj = $(this); var screen = jQuery(this); var fullScreen = screen.width(); var centerScreen = (fullScreen / 2) * (1); var hideBar = false; element_obj = obj; if ($(this).checkCookie("JXID")) { if ($(this).readCookie("JXHID") == "true") { this.hideBar = true; } } else { $(this).createCookie("JXID", $(this).genRandID()); $(this).createCookie("JXHID", false); }
                if (($.browser.msie && ie6) || ($.browser.msie && ie7)) { $("html").css({ "overflow": "hidden", "height": "100%" }); $("body").css({ "margin": "0px", "overflow": "auto", "height": "100%" }); } else { $("html").css({ "height": "100%" }); $("body").css({ "margin": "0px", "height": "100%" }); }
                if (($.browser.msie && ie6) || ($.browser.msie && ie7)) { pos = "absolute"; } else { pos = "fixed"; }
                if ($(".jx-bar-button-right", this).exists()) { $("<ul />").attr("id", "jx-hid-con-id").insertBefore($(this).find(".jx-bar-button-right:first")); } else { $("<ul />").attr("id", "jx-hid-con-id").appendTo(this); }
                if ($.browser.msie && ie6) { $("#jx-hid-con-id").css({ "width": "1px", "float": "right" }); } else if ($.browser.msie && ie7) { $("#jx-hid-con-id").css({ "width": "40px", "float": "right" }); }
                if (defaults.showOnTop) { hideIndicator = "jx-hide-top"; } else { hideIndicator = "jx-hide"; }
                $("#jx-hid-con-id").html('<li alt="Hide toolbar"><a id="jx-hid-btn-id" class="' + hideIndicator + '"></a></li>'); $("#jx-hid-con-id").addClass("jx-bar-button-right"); $("<span />").attr("id", "jx-hid-sep-id").insertAfter("#jx-hid-con-id"); $("#jx-hid-sep-id").addClass("jx-hide-separator"); $("#jx-hid-btn-id").parent().click(function () {
                    $("#jx-menu-con-id").fadeOut(); $(obj).slideToggle(defaults.slideSpeed, function () {
                        $(this).createCookie("JXHID", true); if (!$(this).checkCookie("JXID")) { $(this).createCookie("JXID", $(this).genRandID()); }
                        $("#jx-uhid-con-id").slideToggle(defaults.slideSpeed);
                    }); return false;
                }); $(this).css({ "overflow": constants["constOverflow"], "position": pos }); if (defaults.showOnTop) { $(this).css({ "top": constants["constBottom"] }); } else { $(this).css({ "bottom": constants["constBottom"] }); }
                $(this).addClass("jx-bar"); if (defaults.roundedCorners) { if (defaults.showOnTop) { $(this).addClass("jx-bar-rounded-bl jx-bar-rounded-br"); } else { $(this).addClass("jx-bar-rounded-tl jx-bar-rounded-tr"); } }
                $(this).addClass("jx-bar-button"); if (defaults.roundedButtons) { $(this).addClass("jx-bar-button-rounded"); }
                marginLeft = centerScreen - ($(this).width() / 2); $(this).css({ "margin-left": marginLeft }); $("img", obj).css({ "vertical-align": "bottom", "border": "#fff solid 0px" }); $(this).find("img").each(function () { if ($(this).attr("alt") != "") { altName = " " + $(this).attr("alt"); $(this).parent().append(altName); } }); if (defaults.transparent) { $(this).fadeTo(defaults.opaqueSpeed, defaults.opacity); }
                $("<div />").attr("id", "jx-menu-con-id").appendTo("body"); if (defaults.transparent) { $("#jx-menu-con-id").fadeTo(defaults.opaqueSpeed, defaults.opacity); }
                $("<div />").attr("id", "jx-uhid-con-id").appendTo("body"); $("#jx-uhid-con-id").addClass("jx-show"); $("#jx-uhid-con-id").css({ "overflow": constants["constOverflow"], "position": pos, "margin-left": ($(this).offset().left + $(this).width()) - $("#jx-uhid-con-id").width() }); if (defaults.showOnTop) { $("#jx-uhid-con-id").css({ "top": constants["constBottom"] }); } else { $("#jx-uhid-con-id").css({ "bottom": constants["constBottom"] }); }
                if (defaults.transparent) { $("#jx-uhid-con-id").fadeTo(defaults.opaqueSpeed, defaults.opacity); }
                if (this.hideBar) { $(this).css({ "display": "none" }); }
                if (!this.hideBar) { $("#jx-uhid-con-id").css({ "display": "none" }); }
                $("<ul />").attr("id", "jx-uhid-itm-id").appendTo($("#jx-uhid-con-id")); if (defaults.showOnTop) { unhideIndicator = "jx-show-button-top"; } else { unhideIndicator = "jx-show-button"; }
                $("#jx-uhid-itm-id").html('<li alt="Show toolbar"><a id="jx-uhid-btn-id" class="' + unhideIndicator + '"></a></li>'); if (defaults.roundedCorners) { if (defaults.showOnTop) { $("#jx-uhid-con-id").addClass("jx-bar-rounded-bl jx-bar-rounded-br"); } else { $("#jx-uhid-con-id").addClass("jx-bar-rounded-tl jx-bar-rounded-tr"); } }
                $("#jx-uhid-con-id").addClass("jx-bar-button"); if (defaults.roundedButtons) { $("#jx-uhid-con-id").addClass("jx-bar-button-rounded"); }
                $("#jx-uhid-con-id").click(function () {
                    $(this).slideToggle(defaults.slideSpeed, function () {
                        $(this).createCookie("JXHID", false); if (!$(this).checkCookie("JXID")) { $(this).createCookie("JXID", $(this).genRandID()); }
                        $(obj).slideToggle(defaults.slideSpeed); if (active_button_name != "") { $("#jx-menu-con-id").fadeIn(); }
                        $("#jx-uhid-con-id").css({ "margin-left": ($(obj).offset().left + $(obj).width()) - $("#jx-uhid-con-id").width() }); if (button_active) { $("#jx-menu-con-id").css({ "margin-left": $("#" + active_button_name).parent().offset().left }); } 
                    }); return false;
                }); $("<div />").attr("id", "jx-ttip-con-id").appendTo("body"); $("#jx-ttip-con-id").css({ "height": "auto", "margin-left": "0px", "width": "100%", "overflow": constants["constOverflow"], "position": pos }); if (defaults.showOnTop) { $("#jx-ttip-con-id").css({ "margin-top": $(this).height() + 6, "top": constants["constBottom"] }); } else { $("#jx-ttip-con-id").css({ "margin-bottom": $(this).height() + 6, "bottom": constants["constBottom"] }); }
                $("li", obj).each(function () { var _title = $(this).attr("title"); if (_title != "") { $(this).removeAttr("title"); $(this).attr("alt", _title); } }); 
                $("li", obj).hover(function () {
                    var elemID = $(this).attr("id"); var barTooltipID = elemID + "jx-ttip-id"; var tooltipTitle = $(this).attr("title"); if (tooltipTitle != undefined && tooltipTitle != "") { tooltipTitle = $(this).attr("alt"); }
                    if (tooltipTitle != undefined && tooltipTitle != "") {
                        barTooltipWrapperID = barTooltipID + "_wrapper"; $("<div />").attr("id", barTooltipWrapperID).appendTo("#jx-ttip-con-id"); $("<div />").attr("id", barTooltipID).appendTo("#" + barTooltipWrapperID); $("#" + barTooltipID).css({ "float": "left" }); if ((defaults.showOnTop) && !($.browser.msie && ie6)) { $("<div />").addClass("jx-tool-point-dir-up").appendTo("#" + barTooltipID); }
                        $("<div />").html(tooltipTitle).addClass("jx-bar-button-tooltip").appendTo("#" + barTooltipID); if ((!defaults.showOnTop) && !($.browser.msie && ie6)) { $("<div />").addClass("jx-tool-point-dir-down").appendTo("#" + barTooltipID); }
                        lft_pad = parseInt($(this).css("padding-left")); $("#" + barTooltipWrapperID).css({ "margin-left": ($(this).offset().left - ($("#" + barTooltipID).width() / 2)) + ($(this).width() / 2) + lft_pad }); if ((($(this).find("a:first").attr("name") == "") || (button_active == false))) { $("#" + barTooltipID).fadeTo(defaults.tooltipFadeSpeed, defaults.tooltipFadeOpacity); } else if (active_button_name != $(this).find("a:first").attr("name")) { $("#" + barTooltipID).fadeTo(defaults.tooltipFadeSpeed, defaults.tooltipFadeOpacity); } else { $("#" + barTooltipID).css({ "display": "none" }); } 
                    } 
                }, function () { var elemID = $(this).attr("id"); var barTooltipID = elemID + "jx-ttip-id"; var barTooltipWrapperID = barTooltipID + "_wrapper"; $("#" + barTooltipID).remove(); $("#" + barTooltipWrapperID).remove(); }); $("li", $("#jx-uhid-con-id")).hover(function () {
                    var elemID = $(this).attr("id"); var barTooltipID = elemID + "jx-ttip-id"; var tooltipTitle = $(this).attr("title"); if (tooltipTitle == "") { tooltipTitle = $(this).attr("alt"); }
                    if (tooltipTitle != "") {
                        barTooltipWrapperID = barTooltipID + "_wrapper"; $("<div />").attr("id", barTooltipWrapperID).appendTo("#jx-ttip-con-id"); $("<div />").attr("id", barTooltipID).appendTo("#" + barTooltipWrapperID); $("#" + barTooltipID).css({ "float": "left" }); if ((defaults.showOnTop) && !($.browser.msie && ie6)) { $("<div />").addClass("jx-tool-point-dir-up").appendTo("#" + barTooltipID); }
                        $("<div />").html(tooltipTitle).addClass("jx-bar-button-tooltip").appendTo("#" + barTooltipID); if ((!defaults.showOnTop) && !($.browser.msie && ie6)) { $("<div />").addClass("jx-tool-point-dir-down").appendTo("#" + barTooltipID); }
                        ulft_pad = parseInt($(this).css("padding-left")); $("#" + barTooltipWrapperID).css({ "margin-left": ($(this).offset().left - ($("#" + barTooltipID).width() / 2)) + ($(this).width() / 2) + ulft_pad }); if ((($(this).find("a:first").attr("name") == "") || (button_active == false))) { $("#" + barTooltipID).fadeTo(defaults.tooltipFadeSpeed, defaults.tooltipFadeOpacity); } else if (active_button_name != $(this).find("a:first").attr("name")) { $("#" + barTooltipID).fadeTo(defaults.tooltipFadeSpeed, defaults.tooltipFadeOpacity); } else { $("#" + barTooltipID).css({ "display": "none" }); } 
                    } 
                }, function () { var elemID = $(this).attr("id"); var barTooltipID = elemID + "jx-ttip-id"; var barTooltipWrapperID = barTooltipID + "_wrapper"; $("#" + barTooltipID).remove(); $("#" + barTooltipWrapperID).remove(); }); if ($.browser.msie && ie6) {
                    $(this).find("li").each(function () {
                        $(this).find("img").each(function () {
                            imgPath = $(this).attr("src"); altName = $(this).attr("alt"); if (altName == "") { altName = "  " + $(this).attr("title"); }
                            srcText = $(this).parent().html(); $(this).parent().html('<span style="cursor:pointer;display:inline-block;filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src=\'' + imgPath + '\');">' + srcText + '</span> ' + altName);
                        }); $(this).find("img").each(function () { $(this).attr("style", "filter:progid:DXImageTransform.Microsoft.Alpha(opacity=0);"); });
                    });
                }
                $(window).resize(function () { var screen = jQuery(this); var screenWidth = screen.width(); var centerScreen = (screenWidth / 2) * (1); var marginLeft = centerScreen - ($(obj).width() / 2); $(obj).css({ "margin-left": marginLeft }); $("#jx-uhid-con-id").css({ "margin-left": ($(obj).offset().left + $(obj).width()) - $("#jx-uhid-con-id").width() }); if (button_active) { $("#jx-menu-con-id").css({ "margin-left": $("#" + active_button_name).parent().offset().left }); } }); $("li", obj).find("ul").each(function () { $(this).css({ "display": "none" }); }); i = 1; $("li", obj).find("ul").each(function () {
                    $(this).attr("id", "nav" + i); $(this).parent().find("a:first").attr("href", "#"); $(this).parent().find("a:first").attr("name", "nav" + i); if (defaults.showOnTop) { buttonIndicator = "jx-arrow-down"; } else { buttonIndicator = "jx-arrow-up"; }
                    if (($.browser.msie && ie6) || ($.browser.msie && ie7)) { $("<div />").attr("class", buttonIndicator).insertBefore($(this).parent().find("a")).css({ "background-position": "top" }); } else { $("<div />").attr("class", buttonIndicator).insertAfter($(this).parent().find("a")); }
                    $(this).parent().find("a:first").click(function () {
                        var elemID = $(this).attr("id"); var barTooltipID = elemID + "jx-ttip-id"; var barTooltipWrapperID = barTooltipID + "_wrapper"; $("#" + barTooltipID).remove(); $("#" + barTooltipWrapperID).remove(); if ((button_active) && (active_button_name == $(this).attr("name"))) {
                            if (defaults.showOnTop) { buttonIndicator = "jx-arrow-down"; } else { buttonIndicator = "jx-arrow-up"; }
                            $(this).parent().find("div").attr("class", buttonIndicator); $("#jx-menu-con-id").fadeOut(defaults.menuFadeSpeed); $(this).parent().removeClass("jx-nav-menu-active"); if (defaults.roundedButtons) { $(this).parent().removeClass("jx-nav-menu-active-rounded"); }
                            button_active = false; active_button_name = ""; $(this).blur();
                        } else {
                            if (defaults.showOnTop) { buttonIndicator = "jx-arrow-up"; } else { buttonIndicator = "jx-arrow-down"; }
                            $(this).parent().find("div").attr("class", buttonIndicator); $("#jx-menu-con-id").css({ "display": "none" }); $("#jx-menu-con-id").html("<ul>" + $(this).parent().find("ul").html() + "</ul>"); $("#jx-menu-con-id").css({ "overflow": constants["constOverflow"], "position": pos, "margin-left": $(this).parent().offset().left }); if (defaults.showOnTop) { $("#jx-menu-con-id").css({ "top": constants["constBottom"], "margin-top": $(obj).height() + 6 }); } else { $("#jx-menu-con-id").css({ "bottom": constants["constBottom"], "margin-bottom": $(obj).height() + 6 }); }
                            $("#jx-menu-con-id").addClass("jx-nav-menu"); if ($.browser.msie && ie6) { $("#jx-menu-con-id ul li a").css({ "width": "100%" }); }
                            if (defaults.roundedButtons) { $("#jx-menu-con-id").addClass("jx-nav-menu-rounded"); }
                            $(this).parent().addClass("jx-nav-menu-active"); if (defaults.roundedButtons) { $(this).parent().addClass("jx-nav-menu-active-rounded"); }
                            if (active_button_name != "") {
                                $("a[name='" + active_button_name + "']").parent().removeClass("jx-nav-menu-active"); $("a[name='" + active_button_name + "']").parent().removeClass("jx-nav-menu-active-rounded"); if (defaults.showOnTop) { buttonIndicator = "jx-arrow-down"; } else { buttonIndicator = "jx-arrow-up"; }
                                $("a[name='" + active_button_name + "']").parent().find("div").attr("class", buttonIndicator);
                            }
                            button_active = true; active_button_name = $(this).attr("name"); $(this).blur(); $("#jx-menu-con-id").fadeIn(defaults.menuFadeSpeed);
                        }
                        return false;
                    }); i = i + 1;
                }); $("li", obj).click(function () {
                    if ($("ul", this).exists()) { $(this).find("a:first").click(); return false; } else if ($(this).parent().attr("id") == "jx-hid-con-id") { return false; }
                    if ($("a", this).exists()) { window.location = $(this).find("a:first").attr("href"); }
                    return false;
                });
            });
        }; this.getOptions = function () { return options; }; this.isIE6 = function () { return ie6; }; this.isIE7 = function () { return ie7; }; this.hasActiveButton = function () { return button_active; }; this.getActiveButtonName = function () { return active_button_name; }; this.getTooltipObject = function () { return $("#jx-ttip-con-id"); }; this.createObjectContainer = function (name) {
            name = typeof (name) != 'undefined' ? name : "jx-obj-con-id"; $("<div />").attr("id", name).appendTo("body"); $("#" + name).css({ "height": "auto", "margin-left": "0px", "width": "100%", "overflow": constants["constOverflow"], "position": pos }); if (defaults.showOnTop) { $("#" + name).css({ "margin-top": $(element_obj).height() + 6, "top": constants["constBottom"] }); } else { $("#" + name).css({ "margin-bottom": $(element_obj).height() + 6, "bottom": constants["constBottom"] }); }
            return $("#" + name);
        };
    } 
    }); $.fn.extend({ jixedbar: $.jixedbar.construct });
})(jQuery); jQuery.fn.exists = function () { return jQuery(this).length > 0; }; jQuery.fn.createCookie = function (cookie_name, value) { var expiry_date = new Date(2037, 01, 01); document.cookie = cookie_name + "=" + escape(value) + ";expires=" + expiry_date.toUTCString(); }; jQuery.fn.checkCookie = function (cookie_name) {
    if (document.cookie.length > 0) { cookie_start = document.cookie.indexOf(cookie_name + "="); if (cookie_start != -1) { cookie_start = cookie_start + cookie_name.length + 1; cookie_end = document.cookie.indexOf(";", cookie_start); if (cookie_end == -1) { cookie_end = document.cookie.length; return true; } } }
    return false;
}; jQuery.fn.extractCookieValue = function (value) {
    if ((endOfCookie = document.cookie.indexOf(";", value)) == -1) { endOfCookie = document.cookie.length; }
    return unescape(document.cookie.substring(value, endOfCookie));
}; jQuery.fn.readCookie = function (cookie_name) {
    var numOfCookies = document.cookie.length; var nameOfCookie = cookie_name + "="; var cookieLen = nameOfCookie.length; var x = 0; while (x <= numOfCookies) {
        var y = (x + cookieLen); if (document.cookie.substring(x, y) == nameOfCookie)
            return (this.extractCookieValue(y)); x = document.cookie.indexOf(" ", x) + 1; if (x == 0) { break; } 
    }
    return (null);
}; jQuery.fn.genRandID = function () {
    var id = ""; var str = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"; for (var i = 0; i < 24; i++) { id += str.charAt(Math.floor(Math.random() * str.length)); }
    return id;
};
