//////////////////////////////////////////////
// Kasseler CMS: Content Management System  //
// ===========================              //
// Copyright (c)2007-2008 by Igor Ognichenko//
// http://www.kasseler-cms.net/             //
//////////////////////////////////////////////

var DivObjCreate = false;
var DivObj;

function ShowHint(HintText, Obj, SizeHint){
    if (DivObjCreate==false){
        DivObj= document.createElement("DIV");
        DivObj.setAttribute('id','hint');
        document.getElementsByTagName('body')[0].appendChild(DivObj);
        DivObj.className = 'showhint';
        DivObjCreate = true;
    }
    DivObj.style.display = 'block';
    DivObj.style.width = SizeHint;
    DivObj.innerHTML = HintText;
    Obj.onmouseout = function(){DivObj.style.display = 'none'; document.onmousemove = function(){};};
    document.onmousemove = function(e){
        var vc = document.getElementsByTagName((document.compatMode && document.compatMode=="CSS1Compat") ? "HTML":"BODY")[0];
        var x = window.event ? event.clientX + vc.scrollLeft : e.pageX;
        var y = window.event ? event.clientY + vc.scrollTop : e.pageY;
        var vcwidth = vc.clientWidth ? vc.clientWidth + vc.scrollLeft : window.innerWidth + window.pageXOffset;
        var vcheight = vc.innerHeight ? window.innerHeight + window.pageYOffset : vc.clientHeight + vc.scrollTop;
        if((x + DivObj.offsetWidth) > vcwidth) DivObj.style.left = (x - DivObj.offsetWidth - 4)+'px'; else DivObj.style.left = (x + 15)+'px';
        if((y + DivObj.offsetHeight + 19) > vcheight) DivObj.style.top = (y - DivObj.offsetHeight)+'px'; else DivObj.style.top = y+'px';
    }
}
