﻿
function flyMenu() {    
    var i, shift, idshift, obj, props, flydown = $("a.flydown"); 
    for (i = 0; i < flydown.length; i++) {

        props = flydown[i].id.split("_");

        if (props && props.length > 1 && props[1] == "fly") 
        {

            $(flydown[i].parentNode).hover(
            function () {

                if (document.all && !window.XMLHttpRequest) {
                    $("select").css({ visibility: "hidden" }); $("#site_header select").css({ visibility: "visible" });
                }
                props = $(this).find("a:first-child").attr("id").split("_");
                obj = $("#" + props[0]);

                var pos = $(this).position();
                //alert(pos.top);

                if ($("#" + props[0] + " div").hasClass("flyload")) {
                    obj.load(this.href, null, function () { $("#" + props[0]).css({ width: props[1] + "px", whiteSpace: "normal" }); });
                }

                obj.css({ 'display': "block", 'top': '40px' });
                $(this).addClass("goFocus").removeClass("goBlur");
            }, function () {
                if (document.all && !window.XMLHttpRequest) { $("select").css({ visibility: "visible" }); }
                props = $($(this).children("a")[0]).attr("id").split("_"); if (props) { $("#" + props[0]).css({ display: "none" }); }
                $(this).addClass("goBlur").removeClass("goFocus");
            });
        } 
    }
    
}

$(document).ready(function () {
    flyMenu();
});

