﻿/***********************************************************







************************************************************/


$(document).ready(function () {

    var interval;//Sono un commento
    $(document).ajaxStart(function () {
        $("#Status").text("Loading");
        window.clearInterval(interval);
    }).ajaxComplete(function () {
        $("#Status").text("");
        window.clearInterval(interval);
        $(".command").click(function () {
            $("#bodyContent").load($(this).attr("href") + " #bodyContent");
            return false;
        }).hover(showTooltip, hideTooltip).mousemove(positionTooltip);
    }).ajaxSend(function () {
        $("#Status").text("Loading");
        interval = window.setInterval(function () {
            var text = $("#Status").text();
            if (text.length < 13) {
                $("#Status").text(text + '.');
            } else {
                $("#Status").text('Loading');
            }
        }, 200);
    });
    if ($("#Body").height() < 400) { $(".Center").height(400); }
    $(".command").click(function () {
        $('div.tooltip').remove();
        $("#bodyContent").load($(this).attr("href") + " #bodyContent");
        return false;
    }).hover(showTooltip, hideTooltip).mousemove(positionTooltip);
});

var positionTooltip = function (event) {
    var tPosX = event.pageX - 5;
    var tPosY = event.pageY + 20;
    $('div.tooltip').css({ top: tPosY, left: tPosX });
};

var hideTooltip = function () {
    $('div.tooltip').remove();
};

var showTooltip = function (event) {
    $('div.tooltip').remove();
    var $thisText = $(this).attr("tip");
    $('<div class="tooltip">' + $thisText + '</div>').appendTo('body');
    positionTooltip(event);
};


var intervalSfondo;
var imgCount = 1;
intervalSfondo = window.setInterval(function () {
    imgCount = imgCount + 1;
    $("#bg").html("<img src='/images/sfondi/" + imgCount + ".jpg' />");
    $("#Status").text(imgCount);
    if (imgCount == 7) { imgCount = 0 };
}, 20000);
