// ################################################# //
///////////////////////////////////////////////////////
//<!-- Original:  Mike McGrath (mike_mcgrath@lineone.net) -->
//<!-- Web Site:  http://website.lineone.net/~mike_mcgrath/index.htm  -->

/**********************************************************************************   
Dynamic myToolTips 
*   Copyright (C) 2001 <a href="/dhtmlcentral/michael_van_ouwerkerk.asp">Michael van Ouwerkerk</a>
*   This script was released at DHTMLCentral.com
*   Visit for more great scripts!
*   This may be used and changed freely as long as this msg is intact!
*   We will also appreciate any links you could give us.
*
*   Made by <a href="/dhtmlcentral/michael_van_ouwerkerk.asp">Michael van Ouwerkerk</a> 
*********************************************************************************/

//////////////////////////////////////////////////
/////         Netmarble Laghaim              /////
/////                      modified by hayun /////
//////////////////////////////////////////////////

//myToolTipMsg= new Array();
// Write your descriptions in here.
//myToolTipMsg[0]="<font color='red'>Toggle</font> fade effect"
//myToolTipMsg[1]="Switch animation on and off"
//myToolTipMsg[2]="Toggle the window detection between 'smooth' and 'flip'"

/*  myToolTip Array, var idCWMsg=new array("",0,0,0,0,0);
        0: msg, str
        1: 0=Tip (float), 1:fixed
        2: orientation : 1=, 2=ѥ; 3=, 4=others, fixed window;
        3: delay time for tool tip (1/1000 seconds)
        4: posx : Ex ġ (pixel)
        5: posy : Ey ġ (pixel) */

// browser check
function lib_bwcheck(){ //Browsercheck (needed)
    this.ver=navigator.appVersion
    this.agent=navigator.userAgent
    this.dom1=document.getElementById?1:0
    this.opera5=this.agent.indexOf("Opera 5")>-1
    this.ie5=(this.ver.indexOf("MSIE 5")>-1 && this.dom1 && !this.opera5)?1:0; 
    this.ie6=(this.ver.indexOf("MSIE 6")>-1 && this.dom1 && !this.opera5)?1:0;
    this.ie4=(document.all && !this.dom1 && !this.opera5)?1:0;
    //this.ie=this.ie4||this.ie5||this.ie6
    this.mac=this.agent.indexOf("Mac")>-1
    this.ns6=(this.dom1 && parseInt(this.ver) >= 5) ?1:0; 
    this.ns4=(document.layers && !this.dom1)?1:0;
    this.bw=(this.ie6 || this.ie5 || this.ie4 || this.ns4 || this.ns6 || this.opera5)
    this.nav=this.ns4 || this.ns6;
    this.ie=this.ie5 || this.ie6;
    return this
}
var browser=new lib_bwcheck();

// cross-browser get object function by Peter-Paul Koch, http://www.xs4all.nl/~ppk
// apply to NS6+ & IE4+, but not apply to NS4 (NS4 is so buggy)
// usage : var x = new getObj('layername');
//         alert(x.elm.id);x.elm.style.top = '20px';
function genGetObj(zid) {
    if (document.getElementById) this.elm=document.getElementById(zid);
    else if (document.all) this.elm=document.all[zid];
}
genGetObj.prototype.writeIt= function(zmsg) {this.elm.innerHTML=zmsg;}
genGetObj.prototype.readIt= function() {return this.elm.innerHTML;}
genGetObj.prototype.popUp= function() {this.elm.style.visibility=browser.nav?"show":"visible";}
genGetObj.prototype.popOut= function() {this.elm.style.visibility=browser.nav?"hide":"hidden";}

// general cross browser general innerText/HTML & Layers function
// use this in other module
function genWriteIt(zid,zmsg) {
    var zelm=new genGetObj(zid);zelm.writeIt(zmsg);
}
function genReadIt(zid) {
    var zelm=new genGetObj(zid);return zelm.readIt();
}
function genPopUp(zid) {
    var zelm=new genGetObj(zid);zelm.popUp();
}
function genPopOut(zid) {
    var zelm=new genGetObj(zid);zelm.popOut();
}
// general cross browser general innerText/HTML & Layers function
// use this in other module

function popUpMsg (zarr) {myToolTip.popUpMsg(zarr);return true;}
function popOutMsg() {myToolTip.popOutMsg();return true;}
function popOutFixed() {myToolTip.popOutFixed();return true;}

// object constructor...
function makeToolTip(id){
    this.elm=browser.dom1?document.getElementById(id):browser.ie4?document.all[id]:0;
    this.orientation=0; // orientation : 1=, 2=ѥ; 3=, 4=others, fixed window;
    this.isHover=false; // Ŀ شEġ ִEȮ
    this.isTipOn=false; // tooptip  ̴EȮ
    this.isFixed=false; // fixed window EȮ
    this.delay=0;       // delay time for tool tip
};
makeToolTip.prototype.writeIt= function(text) {this.elm.innerHTML=text;}
// E ϶ Eġ E
makeToolTip.prototype.sustain=function(e) {
    var x = (browser.nav) ? e.pageX : event.x;
    var y = (browser.nav) ? e.pageY : event.y;
    // orientation : 1=, 2=ѥ; 3=, 4=others, fixed window;, 5=
    switch(myToolTip.orientation) {
        case 0 : myToolTip.elm.style.visibility=(browser.nav)?"hide":"hidden";break;
        case 1 : myToolTip.elm.style.left=x+10;  myToolTip.elm.style.top = y+10; break;
        case 2 : myToolTip.elm.style.left=x-60;  myToolTip.elm.style.top = y+20; break;
        case 3 : myToolTip.elm.style.left=x-135; myToolTip.elm.style.top = y+15; break;
        case 4 : break;
        case 5 : myToolTip.elm.style.left=x-60;  myToolTip.elm.style.top = y-40; break;
        default: break;
    }
}
// pop up msg
/*      0: msg, str
        1: 0=Tip (float), 1:fixed
        2: orientation : 1=, 2=ѥ; 3=, 4=others, fixed window;
        3: delay time for tool tip (1/1000 seconds)
        4: posx : Ex ġ (pixel)
        5: posy : Ey ġ (pixel) */
makeToolTip.prototype.popUpMsg=function(zarr) {
    this.isHover=true;
    if (this.isTipOn) return false;
    this.isTipOn=true;
    this.writeIt(zarr[0]);
    this.orientation=zarr[2];
    this.delay=zarr[3];
    if (zarr[1]==1) {   // if fixed window
        var xx = (browser.nav) ? e.pageX : event.x;
        var yy = (browser.nav) ? e.pageY : event.y;
        this.elm.style.left=xx-zarr[4];this.elm.style.top=yy-zarr[5];
        this.isFixed=true;
    }
    setTimeout("myToolTip.popUpAfter()",this.delay);
    return true;
}
// kill the pup up msg
makeToolTip.prototype.popOutMsg=function () {
    if (this.isFixed) return false;
    this.isHover=false;
    if (this.isTipOn) {
        this.elm.style.visibility = (browser.nav) ? "hide" : "hidden";
        this.isTipOn=false;
    }
}
// kill the pup up fixedmsg
makeToolTip.prototype.popOutFixed=function () {
    this.isFixed=false;
    this.popOutMsg();
}
makeToolTip.prototype.popUpAfter=function () {
    if (this.isHover) {
        this.elm.style.visibility=browser.nav?"show":"visible";
        this.isTipOn=true;
    }
}

// Init function...
var isLoaded=false;
function popUpInit(){
    myToolTip=new makeToolTip('theToolTip');
    document.onmousemove=myToolTip.sustain;
    if (browser.nav) document.captureEvents(Event.MOUSEMOVE);
    isLoaded= true;
}

// Initiates page on pageload if the browser is ok.
// Ʒ ǹ , function popupinit   loading Ŀ
// E div id   Ŀ, ȴ.
// Ʒ ǹ 濁E object not defined msg  .
// Ȥ, <body onload="popupinit()">  ص  ȿ ´
// popUpInit  getStat.js  setInit()  call 
//if(!isLoaded) onload= popUpInit;
