

$(document).ready(function() {
    $(".menuoverstate").each(function(i) {

        preload_image = new Image();
        preload_image.src = this.src.replace(".jpg", "_o.jpg");

        $(this).hover(
            function() {
                if (this.src.indexOf("_o.jpg") == -1) {
                    this.src = this.src.replace(".jpg", "_o.jpg");
                }

            },

            function() {
                this.src = this.src.replace("_o.jpg", ".jpg");

            });

    }
        );
});


$(document).ready(function() {


    $(".answer").hide();

    $("div.question").toggle(function() {
        $(this).addClass("active");
    }, function() {
        $(this).removeClass("active");
    });

    $("div.question").click(function() {
        $(this).next(".answer").slideToggle("400");
    });

});

/*slideshow*/

/*left*/

function slideSwitchLeft() {
    var $active = $('#flash-left IMG.active');

    if ($active.length == 0) $active = $('#flash-left IMG:last');

    var $next = $active.next().length ? $active.next()
        : $('#flash-left IMG:first');

    $active.addClass('last-active');

    $next.css({ opacity: 0.0 })
        .addClass('active')
        .animate({ opacity: 1.0 }, 1000, function() {
            $active.removeClass('active last-active');
        });
}

$(function() {
    setTimeout(function() { setInterval("slideSwitchLeft()", 9000); }, 0);
});

/*middle*/

function slideSwitchMiddle() {
    var $active = $('#flash-middle IMG.active');

    if ($active.length == 0) $active = $('#flash-middle IMG:last');

    var $next = $active.next().length ? $active.next()
        : $('#flash-middle IMG:first');

    $active.addClass('last-active');

    $next.css({ opacity: 0.0 })
        .addClass('active')
        .animate({ opacity: 1.0 }, 1000, function() {
            $active.removeClass('active last-active');
        });
}

$(function() {
    setTimeout(function() { setInterval("slideSwitchMiddle()", 9000); }, 3000);
});

/*right*/

function slideSwitchRight() {
    var $active = $('#flash-right IMG.active');

    if ($active.length == 0) $active = $('#flash-right IMG:last');

    var $next = $active.next().length ? $active.next()
        : $('#flash-right IMG:first');

    $active.addClass('last-active');

    $next.css({ opacity: 0.0 })
        .addClass('active')
        .animate({ opacity: 1.0 }, 1000, function() {
            $active.removeClass('active last-active');
        });
}

$(function() {
    setTimeout(function() { setInterval("slideSwitchRight()", 9000); }, 6000);
});


