// stclib.js

//Pop up information box II (Mike McGrath (mike_mcgrath@lineone.net,  http://website.lineone.net/~mike_mcgrath))
//Permission granted to Dynamicdrive.com to include script in archive
//For this and 100's more DHTML scripts, visit http://dynamicdrive.com

Xoffset=-60;    // modify these values to ...
Yoffset= 20;    // change the LinkPop position.

var old,boxPop,iex=(document.all),yyy=-1000;

var ns4=document.layers
var ns6=document.getElementById&&!document.all
var ie4=document.all
var ie=document.all

if (ns4)
{
    boxPop=document.divPop
}
else if (ns6)
{
    boxPop=document.getElementById("divPop").style
}
else if (ie4)
{
    boxPop=document.all.divPop.style
}

if (ns4)
{
    document.captureEvents(Event.MOUSEMOVE);
}
else
{
    boxPop.visibility="visible"
    boxPop.display="none"
}

document.onmousemove = get_mouse;

function LinkPopIn(msg,bak)
{
    if (bak == "")
    {
	//bak = "lightyellow";
	bak = " BgColor=#FFFFCC";
    }
    //var content=" <TABLE Border=1 BorderColor=black CellPadding=2 CellSpacing=0 "+ "BgColor="+bak+" Class=PopUp><TD Align=Center Class=PopUp> "+msg+"</TD></TABLE>";
    var content=" <TABLE Border=1 BorderColor=black CellPadding=2 CellSpacing=0 Class=PopUp"+ bak+"><TD Align=Center Class=PopUp"+bak+"> "+msg+"</TD></TABLE>";
    yyy=Yoffset;
     if(ns4){boxPop.document.write(content);boxPop.document.close();boxPop.visibility="visible"}
    if(ns6){document.getElementById("divPop").innerHTML=content;boxPop.display=''}
    if(ie4){document.all("divPop").innerHTML=content;boxPop.display=''}
	return;
}

function LinkPopOut(msg)
{
    var content=" <TABLE Border=1 BorderColor=black CellPadding=2 CellSpacing=0 "+ "BgColor=#FFFFCC><TD Align=Center Class=PopUp><B>OPEN NEW WINDOW</B><BR>to<BR>"+msg+"</TD></TABLE>";
    yyy=Yoffset;

     if(ns4){boxPop.document.write(content);boxPop.document.close();boxPop.visibility="visible"}
    if(ns6){document.getElementById("divPop").innerHTML=content;boxPop.display=''}
    if(ie4){document.all("divPop").innerHTML=content;boxPop.display=''}
	return;
}

function LinkPopLeft(msg)
{
    var content=" <TABLE Border=1 BorderColor=black CellPadding=2 CellSpacing=0 "+ "BgColor=#FFFFCC><TD Align=Left Class=PopUp>"+msg+"</TD></TABLE>";
    yyy=Yoffset;

     if(ns4){boxPop.document.write(content);boxPop.document.close();boxPop.visibility="visible"}
    if(ns6){document.getElementById("divPop").innerHTML=content;boxPop.display=''}
    if(ie4){document.all("divPop").innerHTML=content;boxPop.display=''}
}

function LinkPopRight(msg)
{
    var content=" <TABLE Border=1 BorderColor=black CellPadding=2 CellSpacing=0 "+ "BgColor=#FFFFCC><TD Align=Right Class=PopUp>"+msg+"</TD></TABLE>";
    yyy=Yoffset;

     if(ns4){boxPop.document.write(content);boxPop.document.close();boxPop.visibility="visible"}
    if(ns6){document.getElementById("divPop").innerHTML=content;boxPop.display=''}
    if(ie4){document.all("divPop").innerHTML=content;boxPop.display=''}
}

function LinkPopOff()
{
    yyy=-1000;
    if(ns4){boxPop.visibility="hidden";}
    else if (ns6||ie4)
    boxPop.display="none"
}

function LinkPopDoc(msg)
{
    // <FONT Color=black Face=Arial Size=-2> 
    var content = '';
    var tsMsgType = msg.toLowerCase();
    var tsDocType = 'document';

    if (tsMsgType == "pdf")
    {
	tsDocType = 'Adobe&reg; Acrobat&copy; Document'
    }
    if (tsMsgType == "doc")
    {
	tsDocType = 'Microsoft&reg; Word&copy; Document'
    }
    if (tsMsgType == "txt")
    {
	tsDocType = 'DOS Text Document'
    }
    if (tsMsgType == "xls")
    {
	tsDocType = 'Microsoft&reg; Excel&copy; Spreadsheet'
    }

    content=" <TABLE Border=1 BorderColor=black CellPadding=2 CellSpacing=0 "+ "BgColor=#FFFFCC><TD Align=Center Class=PopUp>OPEN or DOWNLOAD<BR>" + tsDocType + "<BR>(" + tsMsgType + ")</FONT></TD></TABLE>";

    yyy=Yoffset;

     if(ns4){boxPop.document.write(content);boxPop.document.close();boxPop.visibility="visible"}
    if(ns6){document.getElementById("divPop").innerHTML=content;boxPop.display=''}
    if(ie4){document.all("divPop").innerHTML=content;boxPop.display=''}
}

function LinkPopSort(frt,bak)
{
    // <FONT Color=black Face=Arial Size=-2> 
    var msg = "click on header to<BR>sort by column";
    var content="<TABLE Border=1 CellPadding=2 CellSpacing=0 " + "FgColor="+frt + " BgColor="+bak+"><TD Align=Center Class=PopUp> "+msg+"</FONT></TD></TABLE>";
    yyy=Yoffset;
     if(ns4){boxPop.document.write(content);boxPop.document.close();boxPop.visibility="visible"}
    if(ns6){document.getElementById("divPop").innerHTML=content;boxPop.display=''}
    if(ie4){document.all("divPop").innerHTML=content;boxPop.display=''}
}

function get_mouse(e)
{
    var x=(ns4||ns6)?e.pageX:event.x+document.body.scrollLeft;
    boxPop.left=x+Xoffset;
    var y=(ns4||ns6)?e.pageY:event.y+document.body.scrollTop;
    boxPop.top=y+yyy;
}

function LinkPopOff()
{
    yyy=-1000;
    if(ns4){boxPop.visibility="hidden";}
    else if (ns6||ie4)
    boxPop.display="none"
}


/***********************************************
* Highlight Table Cells Script- © Dynamic Drive DHTML code library (www.dynamicdrive.com)
* Visit http://www.dynamicDrive.com for hundreds of DHTML scripts
* This notice must stay intact for legal use
***********************************************/

//SPECIFY HIGHLIGHT BEHAVIOR. "TD" TO HIGHLIGHT TABLE CELLS, "TR" TO HIGHLIGHT THE ENTIRE ROW:

var highlightbehavior="TD"

function contains_ns6(master,slave) 
{ 
    // CHECK IF SLAVE IS CONTAINED BY MASTEr
    while (slave.parentNode)
    if ((slave = slave.parentNode) == master)
	return true;
	return false;
}

function ChangeTo(e,fsFgColor,fsBgColor)
{
    source=ie? event.srcElement : e.target
    if (source.tagName=="TABLE")
    return

    // while(source.tagName!=highlightbehavior && source.tagName!="HTML")
    while (source.tagName!=highlightbehavior && source.tagName!="HTML" && source.tagName!="TH" && source.tagName!="A")
    {
	source=ns6 ? source.parentNode : source.parentElement
	if (source.style.backgroundColor!=fsBgColor&&source.id!="ignore")
	{
	    source.style.backgroundColor=fsBgColor;
	}
	if (source.style.color!=fsFgColor&&source.id!="ignore")
	{
	    source.style.color=fsFgColor;
	}
    }
}

function ChangeFr(e,fsFgColor,fsBgColor)
{
    if (ie&&(event.fromElement.contains(event.toElement)||source.contains(event.toElement)||source.id=="ignore")||source.tagName=="TABLE")
    {
	return
    }
    else if (ns6&&(contains_ns6(source, e.relatedTarget)||source.id=="ignore"))
    {
	return
    }
    if (ie&&event.toElement!=source||ns6&&e.relatedTarget!=source)
    {
	source.style.color=fsFgColor;
	source.style.backgroundColor=fsBgColor;
    }
}

function changebg(e,highlightcolor)
{
    source=ie? event.srcElement : e.target
    if (source.tagName=="TABLE")
    return
    // while(source.tagName!=highlightbehavior && source.tagName!="HTML")
    while ((source.tagName!=highlightbehavior && source.tagName!="HTML") && (source.tagName!="TH" && source.tagName!="HTML"))
    source=ns6? source.parentNode : source.parentElement
    if (source.style.backgroundColor!=highlightcolor&&source.id!="ignore")
    source.style.backgroundColor=highlightcolor
}

function changeback(e,originalcolor)
{
    if (ie&&(event.fromElement.contains(event.toElement)||source.contains(event.toElement)||source.id=="ignore")||source.tagName=="TABLE")
    return
    else if (ns6&&(contains_ns6(source, e.relatedTarget)||source.id=="ignore"))
    return
    if (ie&&event.toElement!=source||ns6&&e.relatedTarget!=source)
    source.style.backgroundColor=originalcolor
}
