

var curPopupWindow  = null;
var helpWindow      = null;
var width           = 10;
var border          = 3;
var TableWidth      = 0;
var offsetY         = 0;
var offsetX         = 0;
var BGCOLOR         = "#ffffff";
var BORDERCOLOR     = "#000066";
var TEXTCOLOR       = "#000066";
var BORDERWIDTH     = 1;

var x,y,snow,sw,cnt;
var dir = 1;
var tr = 1;

if (document.all)
{
    var over = overDiv.style;
}   
else
{
    var over = document.getElementById("overDiv");
}

function ListIconInfo(text, title) {dtc(text,title);}

function roinlinehelp(title, pos, width, bgcolor) // case sensitive bug fix
{
    ROInlineHelp(title, pos, width, bgcolor);
}
function ROInlineHelp(title, pos, width, bgcolor) 
{
    
    if (document.readyState == "complete")
    {  
	    TableWidth = width;
	    offsetY = 0;
	    offsetX = 0; 
	    switch (pos)
	    {
	        case "BR":
	            offsetY = 16;
	            offsetX = -8;
	            break;
	        case "L":
	            offsetY = 8;
	            offsetX = (width+35) * -1 ;
	            break;
	       case "R":
	       default:
	            offsetY = 8;
	            offsetX = -8;
	            break;
	    }
	 
	    BGCOLOR = bgcolor;
	    BORDERCOLOR = "#000000";
	    TEXTCOLOR = "#ffffff";
	    BORDERWIDTH = 2;
	    ih(title,TableWidth);
    }
}
function ROInfoGMap(text) 
{
    if (document.readyState == "complete")
    {
        
	    TableWidth = 240;
	    BGCOLOR = "#ffffff";
	    BORDERCOLOR = "#000000";
	    TEXTCOLOR = "#000000";
	    BORDERWIDTH = 1;
	    DisplayGMap(text,TableWidth);
    }
}
function ROTooltip(title, TableWidth) {
    if (document.readyState == "complete")
    {
	    offsetY = 8;
	    offsetX = -8;
	    BGCOLOR = "#eaeaea";
	    BORDERCOLOR = "#777";
	    TEXTCOLOR = "#000";
	    BORDERWIDTH = 1;
	    dtc('',title,TableWidth);
    }
}
function ROInfo(title, pos, width, bgcolor) {
    if (document.readyState == "complete")
    {
	    TableWidth = width;
	    offsetY = 0;
	    offsetX = 0; 
	    if (pos=='R') 
	    {
	        offsetY = 8;
	        offsetX = -8;
	    }
	    if (pos=='L') 
	    {
	        offsetY = 8;
	        offsetX = (width+35) * -1 ;
	    }
	    BGCOLOR = bgcolor;
	    BORDERCOLOR = "#000000";
	    TEXTCOLOR = "#ffffff";
	    BORDERWIDTH = 2;
	    dtc('',title,TableWidth);
    }
}
function ROut() {
	toggleSelects('visible');
	hideObject(over);
}

function rout() // case sensitive bug fix
{
    ROut();
}
function ih(text, TableWidth) {
	toggleSelects('hidden');

		txt = "<TABLE WIDTH=" + TableWidth + " BORDER=0 CELLPADDING=0 CELLSPACING=0 STYLE='border:1px solid #000000;border-right:3px solid #000000;border-bottom:3px solid #000000;'>";
		txt += "<TR>";
		txt += "<TD background='/images/inlinehelpbg.gif' style='font: 11px arial,helvetica,sans-serif;padding:6px 6px 6px 8px;'>";
		txt += text;
		txt += "</TD>";
		txt += "</TR>";
		txt += "</TABLE>";

	layerWrite(txt);
	disp();
}
function DisplayGMap(text, TableWidth) {
	toggleSelects('hidden');


		txt = "<TABLE BORDER=0 CELLPADDING=4 CELLSPACING=0 BGCOLOR='#ffffff' style='border:1px solid #777;'>\
		        <TR><TD align='left' style='font:9px tahoma,verdana,arial,helvetica,sans-serif;color:#444;'>\
		        " + text + "\
		        </TD></TR></TABLE>";


	layerWrite(txt);
	dispGMap();
}
function dtc(text, title, TableWidth) {
	toggleSelects('hidden');
	if (text.length > 0) {
		txt = "<TABLE WIDTH=" + TableWidth + " BORDER=0 CELLPADDING=1 CELLSPACING=0 BGCOLOR=#000066><TR><TD>";
		txt += "<TABLE WIDTH=100% BORDER=0 CELLPADDING=5 CELLSPACING=0 BGCOLOR=#ffffff><TR><TD align=left BGCOLOR=aqua>";
		txt += "<SPAN STYLE=\"FONT: bold 10px Verdana,tahoma,arial,sans-serif; COLOR:#333366;\">"+title+"</span>";
		txt += "</TD></TR>";
		txt += "</TABLE>";
		txt += "<TABLE WIDTH=100% BORDER=0 CELLPADDING=0 CELLSPACING=0 BGCOLOR=#000066><TR><TD><IMG SRC=../images/spacer.gif WIDTH=1 HEIGHT=1 BORDER=0></TD></TR></TABLE>";
		txt += "<TABLE WIDTH=100% BORDER=0 CELLPADDING=4 CELLSPACING=0 BGCOLOR=#F7F7F7>";
		txt += "<TR><TD>";
		txt += "<FONT face=arial COLOR=#000000 size=1>"+text+"</FONT>";
		txt += "</TD></TR></TABLE>";
		txt += "</TD></TR></TABLE>";

	} else {
	
		if (TableWidth>0) {
			txt = "<TABLE WIDTH=" + TableWidth + " BORDER=0 CELLPADDING=" + BORDERWIDTH + " CELLSPACING=0 BGCOLOR=" + BORDERCOLOR + "><TR><TD>";
		} else {
			txt = "<TABLE BORDER=0 CELLPADDING=" + BORDERWIDTH + " CELLSPACING=0 BGCOLOR=" + BORDERCOLOR + "><TR><TD>";
		}
		txt += "<TABLE WIDTH=100% BORDER=0 CELLPADDING=4 CELLSPACING=0 BGCOLOR=" + BGCOLOR + "><TR><TD align=center>";
		txt += "<SPAN STYLE=\"FONT: bold 10px Verdana,tahoma,arial,sans-serif; COLOR:" + TEXTCOLOR + ";\">"+title+"</SPAN></B>";
		txt += "</TD></TR>";
		txt += "</TABLE>";
		txt += "</TD></TR></TABLE>";
	}


	layerWrite(txt);
	disp();
}

function disp() 
{
    var thisX = parseFloat(MousePosition.X) + offsetX;
    var thisY = parseFloat(MousePosition.Y) + offsetY;
    //alert(thisX);
    //alert(thisY);
    ODmoveTo(over,thisX,thisY);
    hideObject(over);
    showObject(over);
}

function dispGMap() 
{
    var thisY = 100;
    var thisX = 100;
    
	    if (document.all)
	    {
            thisY = ( parseInt(MousePosition.Y,10) + RecurseOffset(gE("map")).offsetTop) + 2;
            thisX = ( parseInt(MousePosition.X,10) + RecurseOffset(gE("map")).offsetLeft) - 12;
	    }
	    else
	    {
            thisY = parseInt(MousePosition.Y,10) + 2;
            thisX = parseInt(MousePosition.X,10) - 12;
	    }
        
        var MapLeft = RecurseOffset(gE("map")).offsetLeft;
        var MapRight = MapLeft + gE("map").offsetWidth;
        var MapTop = RecurseOffset(gE("map")).offsetTop;
        var MapBottom = MapTop + gE("map").offsetHeight;
        
        var MapXMiddle = parseInt(MapRight - (gE("map").offsetWidth / 2), 10);
        var MapYMiddle = parseInt(MapBottom - (gE("map").offsetHeight / 2), 10);

        
        if (thisX > MapXMiddle)
        {
            thisX = thisX - gE("overDiv").offsetWidth - 28;
        }
        
        //alert(String.format("MapLeft:{0}\nMapRight:{1}\nMapTop:{2}\nMapBottom:{3}\nthisX:{4}\nthisY:{5}\nMapXMiddle:{6}\nMapYMiddle:{7}",
        //    MapLeft, MapRight, MapTop, MapBottom, thisX, thisY, MapXMiddle, MapYMiddle));
            
    ODmoveTo(over,thisX,thisY);
    hideObject(over);
    showObject(over);
}

function layerWrite(txt) 
{
    if (document.all) 
    {
        document.all["overDiv"].innerHTML = txt;
    }
    else if (document.getElementById)
    {
        document.getElementById("overDiv").innerHTML = txt;
    } 
    else
    {
        var lyr = document.overDiv.document; lyr.write(txt); lyr.close();
    }
}



function showObject(obj) 
{
    if (document.all) 
    {
        obj.visibility = "visible";
    }
    else if (document.getElementById)
    {
        obj.style.visibility = "visible";
    }
    else
    {
        obj.visibility = "show";
    }
}


function hideObject(obj) 
{
    if (document.all) 
    {
        obj.visibility = "hidden";
    }
    else if (document.getElementById)
    {
        obj.style.visibility = "hidden";
    }
    else
    {
        obj.visibility = "hide";
    }
}


function ODmoveTo(obj,xL,yL) 
{
    if (document.all)
    {
        obj.left = xL+'px';
        obj.top = yL+'px';
    }
    else
    {
        obj.style.left = parseFloat(xL)+'px';
        obj.style.top = parseFloat(yL)+'px';
    }
}


function toggleSelects(disposition) 
{
	var mySelects = document.getElementsByTagName("select");
	for (s=0;s < mySelects.length; s++) 
	{
		if (mySelects[s].id == "hideme") 
		{
			mySelects[s].style.visibility = disposition;
		}
	}
}
