﻿function de(id) {
    return document.getElementById(id);
}

function showHints(f, field) {
    var helpmsg = de('help'); //No I18N
    helpmsg.innerHTML = hints[field];

    de('helpdiv').style.left = findPosX(f) + f.offsetWidth - 10 + 'px';
    de('helpdiv').style.top = findPosY(f) - (f.offsetHeight + 3) + 'px';
    de('helpdiv').style.display = '';
}

function hideHints() {
    de('helpdiv').className = "hide";
}

function findPosX(obj) {
    var curleft = 0;
    if (obj.offsetParent) {
        while (obj.offsetParent) {
            curleft += obj.offsetLeft;
            obj = obj.offsetParent;
        }
    }
    else if (obj.x) {
        curleft += obj.x;
    }
    return curleft;
}

function findPosY(obj) {
    var curtop = 0;
    if (obj.offsetParent) {
        while (obj.offsetParent) {
            curtop += obj.offsetTop;
            obj = obj.offsetParent;
        }
    }
    else if (obj.y) {
        curtop += obj.y;
    }
    return curtop;
}
