﻿/***********************************************
* Cool DHTML tooltip script II- © Dynamic Drive DHTML code library (www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit Dynamic Drive at http://www.dynamicdrive.com/ for full source code
***********************************************/

var offsetfromcursorX=12; //Customize x offset of tooltip
var offsetfromcursorY=10; //Customize y offset of tooltip

var offsetdivfrompointerX=194; //Customize x offset of tooltip DIV relative to pointer image
var offsetdivfrompointerY=13; //Customize y offset of tooltip DIV relative to pointer image. Tip: Set it to (height_of_pointer_image-1).
var arrowUpperRight = '/Images/global/arrowUR.png';
var arrowLowerRight = '/Images/global/arrowLR.png';
var arrowUpperLeft = '/Images/global/arrowUL.png';
var arrowLowerLeft = '/Images/global/arrowLL.png';
var arrowWidth = 15;


document.write('<div id="dhtmltooltip">'); //write out bginning of tooltip DIV
document.write(' <div class="tooltip_top"></div>');
document.write('  <div class="tooltip">');
document.write('   <div id="dhtmltooltipHeader"></div>'); //div for header
document.write('   <div id="dhtmltooltipContent"></div>'); //div for content
document.write('  </div>');
document.write(' <div class="tooltip_bottom"></div>');
document.write('</div>'); //write out end of tooltip DIV


document.write('<img id="dhtmlpointer">'); //write out pointer image

var ie=document.all;
var ns6=document.getElementById && !document.all;
var enabletip=false;
var enablemovingtip=false;
if (ie||ns6)
{
    var tipobj=document.all? document.all["dhtmltooltip"] : document.getElementById? document.getElementById("dhtmltooltip") : "";
    var tipcontent=document.all? document.all["dhtmltooltipContent"] : document.getElementById? document.getElementById("dhtmltooltipContent") : "";
    var tipheader=document.all? document.all["dhtmltooltipHeader"] : document.getElementById? document.getElementById("dhtmltooltipHeader") : "";
}

var pointerobj=document.all? document.all["dhtmlpointer"] : document.getElementById? document.getElementById("dhtmlpointer") : "";

function ietruebody()
{
    return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body;
}

function ddrivetip(thetext,theHeader, movingtip, thewidth, thecolor)
{
    if (ns6||ie)
    {
        if (typeof movingtip!="undefined")
            enablemovingtip=false
        else
            enablemovingtip=movingtip;
            
        if (typeof thewidth!="undefined") tipobj.style.width=thewidth+"px";
        if (typeof thecolor!="undefined" && thecolor!="") tipobj.style.backgroundColor=thecolor;
        tipcontent.innerHTML=thetext;
        if (typeof theHeader!="undefined")
        {
            tipheader.innerHTML=theHeader;
            tipheader.style.visibility='visible';
            tipheader.style.display='block';
        }
        else
        {
            tipheader.innerHTML='';
            tipheader.style.visibility='hidden';
            tipheader.style.display='none';
        }
        enabletip=true;
        return false;
    }
}

function positiontip(e)
{
    if (enabletip)
    {
        var arrowPosition='';
        var curX=(ns6)?e.pageX : event.clientX+ietruebody().scrollLeft;
        var curY=(ns6)?e.pageY : event.clientY+ietruebody().scrollTop;
        //Find out how close the mouse is to the corner of the window
        var winwidth=ie&&!window.opera? ietruebody().clientWidth : window.innerWidth-20;
        var winheight=ie&&!window.opera? ietruebody().clientHeight : window.innerHeight-20;

        var rightedge=ie&&!window.opera? winwidth-event.clientX-offsetfromcursorX : winwidth-e.clientX-offsetfromcursorX;
        var bottomedge=ie&&!window.opera? winheight-event.clientY-offsetfromcursorY : winheight-e.clientY-offsetfromcursorY;
        var leftedge=(offsetfromcursorX<0)? offsetfromcursorX*(-1) : -1000;

        //if the horizontal distance isn't enough to accomodate the width of the context menu
        if (rightedge<tipobj.offsetWidth)
        {
            //move the horizontal position of the menu to the left by it's width
            tipobj.style.left=curX-tipobj.offsetWidth+"px";
            pointerobj.style.left=curX-arrowWidth+"px";
            arrowPosition = 'R';
            
        }
        else if (curX<leftedge)
        {
            tipobj.style.left = "5px";
           
        }
        else
        {
            //position the horizontal position of the menu where the mouse is positioned
            tipobj.style.left=curX+offsetfromcursorX-offsetdivfrompointerX+"px";
            pointerobj.style.left =curX+offsetfromcursorX-170+"px";
            arrowPosition = 'L';
            
        }

        //same concept with the vertical position
        if (bottomedge<tipobj.offsetHeight)
        {
            tipobj.style.top=curY-tipobj.offsetHeight-offsetdivfrompointerY+2+"px";
            pointerobj.style.top=curY-offsetdivfrompointerY+"px";
            arrowPosition=arrowPosition+'L';
        }
        else
        {
            tipobj.style.top=curY+offsetfromcursorY+offsetdivfrompointerY+"px";
            pointerobj.style.top=curY+offsetfromcursorY+"px";
            arrowPosition=arrowPosition+'U';
        }
        
        switch(arrowPosition)
        {
            case 'RU':
                pointerobj.src=arrowUpperRight;
                break;
            case 'RL':
                pointerobj.src=arrowLowerRight;
                break;
            case 'LU':
                pointerobj.src=arrowUpperLeft;
                break;
            case 'LL':
                pointerobj.src=arrowLowerLeft;
                break;
        }

        tipobj.style.visibility="visible";
        pointerobj.style.visibility="visible";
            
        if(!enablemovingtip)
            enabletip=false;
    }
}

  
function hideddrivetip()
{
    if (ns6||ie)
    {
        enabletip=false;
        enablemovingtip=false;
        tipobj.style.visibility="hidden";
        pointerobj.style.visibility="hidden";
        tipobj.style.left="-1000px";
        tipobj.style.backgroundColor='';
        tipobj.style.width='';
    }
}

function gettip(idx)
{
    switch(idx)
    {
        case 1:
            return 'An administrator is the leader of a school’s overall fundraising program and will be the person who manages the School Fundraising Central website. Administrators may be a PTA / PTO president, school principal or other person with access to program budgets.';
            break;
        default:
            return '';
            break;
    }
}


document.onmousemove=positiontip;
