    var vis;
    var posX;
    var posY;
    
    document.onmouseover = eventHandler;
    document.onmouseout = eventHandler;
    document.onmousemove = eventHandler;

    function toggle(elem) {
        var code = document.getElementById('code');
        code.value = "[IMG]" + address + elem + "[/IMG]";
    }
    
    function eventHandler(E) {
        try {
           target = E.target;
        } catch(error) {
           E = window.event;
           target = E.srcElement
        }
        if (E.pageX) {
           posX = E.pageX;
           posY = E.pageY;
        } else {
            if (document.body.scrollTop || document.body.scrollLeft) {
                posX = E.clientX + document.body.scrollLeft;
                posY = E.clientY + document.body.scrollTop;
            } else {
                posX = E.clientX + document.documentElement.scrollLeft;
                posY = E.clientY + document.documentElement.scrollTop;
            }
        }
        if (target.className == "smilie" && E.type == "mouseover") {
            vis = 1;
            showTip(target.id); /* window.setTimeout("showTip('" + target.id + "');", 350); */
        } else if (target.className == "smilie" && E.type == "mouseout") {
            showTip(target.id);
//        } else if (target.className == "smilie" && E.type == "mousemove") {
//            vis = 1
//            showTip(target.id);
        }

        
    }


    
    function jsCheck() {
        document.getElementById('jstest').innerHTML = "";
    }
    
    
    function showTip(id) {
        if (vis) {
            new_id = id.replace(/smilie(\d)/, "box$1");
            var Elem = document.getElementById(new_id);
            var display = Elem.style.display;
            if (!display || display == "none") {
                Elem.style.display = "inline";
                Elem.style.left = (posX + 20) + "px";
                Elem.style.top = (posY + 20) + "px";
            } else {
                Elem.style.display = "none";
                vis = 0;
            }
        }
    }
