﻿var enabledtooltip = true;
var GTOOL = {
    ie6: (!!document.all && !(typeof window.XMLHttpRequest == 'object')),
    init: function() { for (var n in GTOOL) if (GTOOL[n].init) GTOOL[n].init() },
    set: function(a, b) { for (var o in b) a[o] = b[o]; return a },
    create: function(a, b, c, d) { var o = (d || document).createElement(a); GTOOL.set(o, b); GTOOL.set(o.style, c); return o },
    append: function(a, b, c, d) { var o = b.tagName ? b : GTOOL.create(b, c, d); a.appendChild(o); return o }
}
function $(a) { return document.getElementById(a) }
function $$(a, b) { return (b || document).getElementsByTagName(a) }
//window.onload = GTOOL.init
function SetToolTip(a) {
    $('SelectL').style.visibility = 'visible';
    $('SelectL').disabled = false;
    var m = GTOOL.pop, p = m.pos(a)
    GTOOL.set(m.win.style, { left: p.x + 'px', top: p.y + 10 + 'px', visibility: 'visible' })
}
function HideToolTip() {
    GTOOL.pop.win.style.visibility = 'hidden';
    $('SelectL').blur(); 
    $('SelectL').style.visibility = 'hidden';
 }

function tooltipinit() {
    GTOOL.init(); 
 }
 GTOOL.pop = {
     init: function() {
         var m = this, o = $$('a'), i
         for (i = 0; i < o.length; i++) { if (o[i].className == 'popup') GTOOL.set(o[i], { onmouseover: m.over, onmouseout: m.out }) }
         m.win = $('pop-win')
         GTOOL.set(m.win, { onmouseover: m.over2, onmouseout: m.out2 })
     },
     over: function() {
         if (enabledtooltip) {
             SetToolTip(this);
             /*
             $('SelectL').style.visibility = 'visible';
             var m = GTOOL.pop, p = m.pos(this)
             GTOOL.set(m.win.style, { left: p.x + 'px', top: p.y + 10 + 'px', visibility: 'visible' })*/
         }
     },
     out: function() { if (enabledtooltip) { var m = GTOOL.pop; m.timer = setTimeout(m.close, 200) } },
     over2: function() { if (enabledtooltip) { clearTimeout(GTOOL.pop.timer) } },
     out2: function(e) { if (enabledtooltip) { var m = GTOOL.pop; if (m.outside(e, m.win)) m.close() } },
     close: function() { if (enabledtooltip) { HideToolTip(); } },
     pos: function(a) {
         var x = a.offsetLeft, y = a.offsetTop
         while (a.offsetParent) { a = a.offsetParent; x += a.offsetLeft, y += a.offsetTop }
         return { x: x, y: y }
     },
     outside: function(e, a) {

         try {
             var ee = e || window.event, o = (ee.toElement) ? ee.toElement : ee.relatedTarget
             while (o != a && o.nodeName != 'BODY') o = o.parentNode
             return o != a
         } catch (err) { }
         return false;

     }
 }