﻿
function fnToggleLinkOn(Link) {
    Link.filters[0].Apply();
    Link.filters[0].Play();
    Link.className = "toplinkhigh";
}
function fnToggleLinkOff(Link) {
    Link.filters[0].Apply();
    Link.filters[0].Play();
    Link.className = "toplink";
}
function fnToggleLinkBottomOn(Link) {
    Link.filters[0].Apply();
    Link.filters[0].Play();
    Link.className = "linkbottom";
}
function fnToggleLinkBottomOff(Link) {
    Link.filters[0].Apply();
    Link.filters[0].Play();
    Link.className = "linkbottomhigh";
}
function stripSpaces(inputString) {
    var spaceFind = /\W/g;
    var strInput = inputString;
    var strOutput = "";
    strOutput = strInput.replace(spaceFind, "");
    return strOutput;
}

function MM_swapImgRestore() {
    var i, x, a = document.MM_sr;
    for (i = 0; a && i < a.length && (x = a[i]) && x.oSrc; i++) x.src = x.oSrc;
}

function MM_preloadImages() {
    var d = document;
    if (d.images) {
        if (!d.MM_p) d.MM_p = new Array();
        var i, j = d.MM_p.length, a = MM_preloadImages.arguments;
        for (i = 0; i < a.length; i++)
            if (a[i].indexOf("#") != 0) { d.MM_p[j] = new Image; d.MM_p[j++].src = a[i]; } 
    }
}

function MM_findObj(n, d) {
    var p, i, x;
    if (!d) d = document;
    if ((p = n.indexOf("?")) > 0 && parent.frames.length) {
        d = parent.frames[n.substring(p + 1)].document; n = n.substring(0, p);
    }
    if (!(x = d[n]) && d.all) x = d.all[n]; for (i = 0; !x && i < d.forms.length; i++) x = d.forms[i][n];
    for (i = 0; !x && d.layers && i < d.layers.length; i++) x = MM_findObj(n, d.layers[i].document);
    if (!x && document.getElementById) x = document.getElementById(n); return x;
}

function MM_swapImage() {
    var i, j = 0, x, a = MM_swapImage.arguments; document.MM_sr = new Array; for (i = 0; i < (a.length - 2); i += 3)
        if ((x = MM_findObj(a[i])) != null) { document.MM_sr[j++] = x; if (!x.oSrc) x.oSrc = x.src; x.src = a[i + 2]; }
}
function NewWindow(url, name) {
    window.open(url, name, 'height=520,width=790,status=no,toolbar=no,menubar=yes,resizable=1,scrollbars=1,titlebar=no,location=no,top=30,left=30');

}
function NewWindowR(url, name) {
    window.open(url, name, 'height=750,width=1032,status=no,toolbar=no,menubar=no,resizable=1,scrollbars=1,titlebar=no,location=no,top=30,left=30');

}
function NewWindowC(url, name) {
    window.open(url, name, 'height=550,width=700,status=no,toolbar=yes,menubar=no,resizable=1,scrollbars=1,titlebar=no,location=no,top=30,left=30');
}

function OpenWindow(url) {
    window.open(url, '_self', 'height=550,width=550,status=no,toolbar=no,menubar=no,resizable=1,scrollbars=1,titlebar=no,location=no,top=30,left=30');
}

function MM_openBrWindow(theURL, winName, features) {
    window.open(theURL, winName, features);
}

function clearSearch(elem, text) {
    if (elem.value == text) {
        elem.value = "";
    }
}

function NewWindowPDF(url, name) {
    window.open(url, name, 'height=650,width=700,status=no,toolbar=yes,menubar=1,resizable=1,scrollbars=1,titlebar=1,location=no,top=30,left=30');
}

function NewWindowHelp_s(url, name) {
    window.open(url, name, 'height=300,width=500,status=no,toolbar=yes,menubar=1,resizable=1,scrollbars=1,titlebar=1,location=no,top=30,left=30');
}
function hoverMenu() {

    // Check out http://www.kriesi.at/archives/create-a-multilevel-dropdown-menu-with-css-and-improve-it-via-jquery
    // For a great tutorial as to how this works.
    // It is very easy.
    $("#lNav ul").css({ display: "none" });
    $("#lNav .item").hover(function() {
        $(this).parent().find('ul:first').css({ visibility: "visible", display: "none" }).show();

    });
    $(" #nav ul ").css({ display: "none" }); // Opera Fix
    $(" #nav li").hover(function() {
        $(this).find('ul:first').css({ visibility: "visible", display: "none" }).show();
    }, function() {
        $(this).find('ul:first').css({ visibility: "hidden" });
    });
    $("#nav li a").click(function() {
    if ($(this).attr("href") == "#") {        
            return false;
        }

    });
}
$(document).ready(function() {
    hoverMenu();
    function headerRepeater(element) {
        var widths = new Array();
        var mWidth = 0;
        $(element).each(function() {
            //var target = jQuery(this).attr("title");
            var w = $(this).css("width");
            mWidth = w == 0 ? mWidth : w + 30;
            $(this).width(mWidth);
            var tar = $(this).next();
            var tr = $(this).find("tr:nth-child(1)");
            //jQuery(this).next().width
            jQuery(tr).find('th').each(function(k, l) {
                widths[k] = jQuery(this).css("width");
            });
            tr = $(tar).find("tr:nth-child(1)");

            $(tr).find('td').each(function(k, l) {

                $(this).width(widths[k]);

            });
            //alert(widths);
            $(tar).wrap("<div style='height:200px;overflow-y:scroll;display:block;width:" + mWidth + "px;'></div>");
            //alert(widths.length);
        });


    }
    try {
        // headerRepeater('.tbResize');
    } catch (e) {


    }
    $(".tab").tabs();

    $("#navmenu-h li,#navmenu-v li").hover(function() { $(this).addClass("iehover"); }, function() { $(this).removeClass("iehover"); }); 
});