﻿
function PNGSwap(oImg) {
    var strOver = "-roll";    // image to be used with mouse over
    var strOff = "-off";     // normal image
    var strImg = oImg.src;
    if (strImg.indexOf(strOver) != -1)
        oImg.src = strImg.replace(strOver, strOff);
    else
        oImg.src = strImg.replace(strOff, strOver);
}

function overAllChildElements(parent, srcID) {
    if (parent.childNodes.length > 0)
        overAllChildElements(parent.childNodes[0]);
    if (parent.nextSibling != null)
        overAllChildElements(parent.nextSibling);

    if (parent.onmouseover != null && parent.id != srcID)
        parent.onmouseover();
}

function outAllChildElements(parent, srcID) {
    if (parent.childNodes.length > 0)
        outAllChildElements(parent.childNodes[0]);
    if (parent.nextSibling != null)
        outAllChildElements(parent.nextSibling);

    if (parent.onmouseout != null && parent.id != srcID)
        parent.onmouseout();
}

$(document).ready(function() {
    $("#mainMenu ul li").hover(
        function() {
            $(this).css("border-bottom-color", $(this).attr("hover"));
        },
        function() {
            if (mmiID == "#" + $(this).attr("id")) return;
            $(this).css("border-bottom-color", "#000");
        }
    );

    $("#mainMenu ul li a img").hover(
        function() {
            var tag = $(this).attr("tag");
            $(this).attr("src", menupath + "images/menu/m.menu-" + tag + "-roll.gif");
            $("#logo a img").attr("src", "../images/logos/logo-" + tag + ".gif");
            $("#langDiv a img").attr("src", "../images/icons/lang/" + lang + tag + ".gif");
        },
        function() {
            var tag = $(this).attr("tag");
            if (tag == currentItemName) return;
            $(this).attr("src", menupath + "images/menu/m.menu-" + tag + ".gif");
            $("#logo a img").attr("src", "../images/logos/logo-" + currentItemName + ".gif");
            $("#langDiv a img").attr("src", "../images/icons/lang/" + lang + currentItemName + ".gif");
        }
    );
});

$(document).ready(function() {
    $('#search-text').keyup(function(e) {
        if (e.keyCode == 13) {
            $('#aspnetForm').submit();
        }
    });

    var src = "../images/icons/print/print-" + currentItemName + ".gif"
    $('.printIcon img').attr("src", src);

    $('#moreMenu ul li:last').css("border", "0");

    setPageTop();
    
});

function setPageTop() {
    var contentH = $('#col2').height() + $('#header').height() + 70;
    var windowH = $(window).height();

    $('#page-top').css("display", ((windowH  > contentH) ? "none" : "block"));
}

$(window).resize(setPageTop);

