﻿function PreloadImage(imgPath) {
    pic = new Image(100, 100);
    pic.src = imgPath;
}

function SwapImage(targetname, imagepath) {
    $(targetname).attr('src', imagepath);
} //end SwapImage

function FlyoutAction(btnImgID, btnImgOn, btnImgOff, flyoutID) {
    $(flyoutID).hide();
    $(btnImgID).hover(function() {
        SwapImage(btnImgID, btnImgOn);
        $(flyoutID).stop(true, true);
        $(flyoutID).fadeIn(125);
        $(flyoutID).show();
    }, function() {
        SwapImage(btnImgID, btnImgOff);
        $(flyoutID).fadeTo(250, 1);
        $(flyoutID).fadeOut(500);
    });

    $(flyoutID).hover(function() {
        $(flyoutID).stop(true, true);
        $(flyoutID).fadeIn(125);
        $(flyoutID).show();
    }, function() {
        $(flyoutID).fadeTo(250, 1);
        $(flyoutID).fadeOut(500);
    });
}

function FlyoutNoHover(btnImgID, flyoutID) {
    $(flyoutID).hide();
    $(btnImgID).hover(function() {
        $(flyoutID).stop(true, true);
        $(flyoutID).fadeIn(125);
        $(flyoutID).show();
    }, function() {
        $(flyoutID).fadeTo(250, 1);
        $(flyoutID).fadeOut(500);
    });

    $(flyoutID).hover(function() {
        $(flyoutID).stop(true, true);
        $(flyoutID).fadeIn(125);
        $(flyoutID).show();
    }, function() {
        $(flyoutID).fadeTo(250, 1);
        $(flyoutID).fadeOut(500);
    });
}

function HoverSwap(btnImgID, btnImgOn, btnImgOff) {
    $(btnImgID).hover(function() {
        SwapImage(btnImgID, btnImgOn);
    }, function() {
        SwapImage(btnImgID, btnImgOff);
    });
}