﻿$(document).ready(function() {
    IniciarHelp();
});

function IniciarHelp() {
    $('body').mouseover(function(e) {
        if (e.target) {
            var ObjItemAct = e.target;
            if (ObjItemAct.getAttribute("Help")) {
                MostrarHelp(ObjItemAct.getAttribute("Help"));
            } else {
                AmagarHelp();
            }
        }
    });
}

function MostrarHelp(Msg) {
    var DivHelp = document.getElementById("DivHelp");
    var TdMsg = document.getElementById("TdHelpMsg");
    if (DivHelp && TdMsg) {
        //Estableix text missatge
        TdMsg.innerHTML = Msg;

        //Posiciona div
        var WinW = $(window).width();
        var WinH = $(window).height();
        var DivW = $(DivHelp).width();
        var DivH = $(DivHelp).height();
        DivHelp.style.top = "0px";
        DivHelp.style.left = WinW - DivW - 10 + "px";
        DivHelp.style.display = "none";
        DivHelp.style.zIndex = "999999";
        $(DivHelp).fadeIn(100);
    }
}

function AmagarHelp() {
    var DivHelp = document.getElementById("DivHelp");
    if (DivHelp) {
        DivHelp.style.display = "none";
    }
}
