﻿$(document).ready(function () {
    /* main menu ---------------------------------- */
    $("#lim1").hover(function () {
        $("#lim2").removeClass("hover");
        $(this).stopTime().addClass("hover");
    }, function () {
        $(this).oneTime(500, "mainmenuOut", function () {
            $(this).removeClass("hover");
        });
    });
    $("#lim1 > a, #lim2 > a").click(function (e) {
        e.preventDefault();
        e.stopImmediatePropagation();
    });
    $("#lim2").hover(function () {
        $("#lim1").removeClass("hover");
        $(this).stopTime().addClass("hover");
    }, function () {
        $(this).oneTime(500, "mainmenuOut", function () {
            $(this).removeClass("hover");
        });
    });

    if ($("#hpSlide img").length > 1) {
        $("#hpSlide img:first").oneTime(2000, "test", HPNextImage);
    }
});

function HPNextImage() {
    var obj = $(this).next();
    if (obj.length == 0) {
        obj = $("#hpSlide img:first");
    }
    $(this).fadeOut("normal", function () {
        obj.fadeIn("normal").oneTime(4000, "test", HPNextImage);
    });
};
