
var loc=window.document.URL;
var thisIsALocalUser=(loc.substring(0,7)=="file://");
var otherRoot=null;
var mapName="";


function setBorder(bd,x,y,w,h)
{
	bd.style.width=w;
	bd.style.height=h;
	bd.style.posLeft=x;
	bd.style.posTop=y;
	bd.innerHTML="<img width="+w+" height="+h+" />";
	bd.style.visibility="visible";
}

function drawBorder(obj,img)
{
	var w,h;
	var x,y;
	coords=eval("["+obj.coords+"]");

    var thePanel=img.parentElement;
    var theTD=thePanel.parentElement;
    var theTR=theTD.parentElement;
    var nottheTable=theTR.parentElement;
    var theTable=nottheTable.parentElement;

    x=img.offsetLeft + 
        thePanel.offsetLeft + 
        theTD.offsetLeft + 
        theTR.offsetLeft +
        -nottheTable.offsetLeft + 
        theTable.offsetLeft + 
        coords[0];
    y=img.offsetTop + 
        thePanel.offsetTop + 
        theTD.offsetTop + 
        //theTR.offsetTop + 
        //nottheTable.offsetTop + 
        theTable.offsetTop+coords[1];
	w=coords[2]-coords[0];
	h=coords[3]-coords[1];

	setBorder(leftbd,x,y,3,h);
	setBorder(topbd,x,y,w,3);
	setBorder(rightbd,x+w-2,y,3,h);
	setBorder(bottombd,x,y+h-3,w,3);

	return false;
}

function eraseBorder(obj) 
{
	leftbd.style.visibility="hidden";
	topbd.style.visibility="hidden";
	rightbd.style.visibility="hidden";
	bottombd.style.visibility="hidden";
	return false;
}


function overImage(element_, imgName_)
{
	window.status=imgName_;
	element_.src=element_.onsrc;
}
function offImage(element_)
{
	element_.src=element_.offsrc;
}

//var mapObjectName="";
function writeMapArea(relPath_, imageStub_, rectCoords_, altText_)
{
    if ((otherRoot!=null) && !thisIsALocalUser)
        relPath_=otherRoot + "/" + relPath_;

	if( navigator.appName=="Netscape")
	{
        document.write("<area shape='rect' alt='" + altText_.replace("'","&#39;") + "' onmouseover=\"javascript:window.status='';\" onmouseout=\"javascript:window.status='';\" onmousemove=\"javascript:window.status='" + altText_.replace("'","&#39;") + "';\" coords=\"" + rectCoords_ + "\" href=\"" + relPath_ + imageStub_ + "\">");
	}
	else
	{
//var alertText="here 0.  mapName="+mapName;
        var toBeWritten="<area shape='rect' " +
	        "onmouseover=\"window.status=''; return drawBorder(this,document.images['" + mapName + "Image']);\" " +
	        "onmousemove=\"window.status='" + altText_.replace("\'", "&acute;") + "'\"; " + 
	        "onmouseout=\"eraseBorder(this);\" " +
            " coords=\"" + rectCoords_ + "\"" +
            " alt=\"" + altText_.replace("\"","&quot;") + "\" " +
            " href=\"javascript:/*alert('here 1.  mapName="+mapName+"='+document.getElementById('"+mapName+"'));*/"+
		"showLists(document.getElementById('" + mapName + "').parentElement, document.getElementById('PopupPic'), this,  '" + relPath_ + imageStub_ + "', '" + altText_.replace("'","\\'") + "');\">";
//        alert("Writing:  \r\n" + toBeWritten);
        document.write(
                toBeWritten);
	}

}

function writeRollover(imageBaseName_, altText_, forceLink_, relPath_, relPathSmall_, relPathSmallOff_)
{
	var newAltText=altText_;
	if( relPath_==null)
	{
		relPath_=''
	}
	if( relPathSmall_==null)
	{
		relPathSmall_=relPath_;
	}
	if( relPathSmallOff_==null)
	{
		relPathSmallOff_=relPath_;
	}

	if( altText_!='')
		newAltText=" alt='" + altText_ + "'";

	if( forceLink_ || (navigator.appName=="Netscape"))
	{
alert("forced link");
//    alert("<a href='" + relPath_ + imageBaseName_ + ".jpg' onmouseover=\"" + imageBaseName_ + ".src='" + relPathSmall_ + imageBaseName_ + "Small.jpg'\" onmouseout=\"" + imageBaseName_ + ".src='" + relPathSmallOff_ + imageBaseName_ + "SmallOff.jpg'\"><img name='" + imageBaseName_ + "'  " + newAltText + " src='" + relPathSmallOff_ + imageBaseName_ + "SmallOff.jpg'/></a>");
		document.write("<a href='" + relPath_ + imageBaseName_ + ".jpg' onmouseover=\"" + imageBaseName_ + ".src='" + relPathSmall_ + imageBaseName_ + "Small.jpg'\" onmouseout=\"" + imageBaseName_ + ".src='" + relPathSmallOff_ + imageBaseName_ + "SmallOff.jpg'\"><img name='" + imageBaseName_ + "'  " + newAltText + " src='" + relPathSmallOff_ + imageBaseName_ + "SmallOff.jpg'/></a>");
	}
	else
	{
		document.write("<img style='CURSOR=hand' onClick=\"showLists(null, document.getElementById('PopupPic'), this, '" + relPath_ + imageBaseName_ + ".jpg', '" + altText_ + "');\" offsrc='" + relPathSmallOff_ + imageBaseName_ + "SmallOff.jpg' onsrc='" + relPathSmall_ + imageBaseName_ + "Small.jpg' onmouseout=offImage(this) onmouseover=\"overImage(this, '" + relPath_ + imageBaseName_ + ".jpg')\" " + newAltText + " src='" + relPathSmallOff_ + imageBaseName_ + "SmallOff.jpg'/>");
	}
}
var currDispTable = null;
var currDispPicsDiv=null;
var currDispPicsTD=null;

function HideTable() 
{
	if(currDispTable != null)
	{
		if( navigator.appName=="Netscape")
			document.currDispTable.style.display = 'none';
		else
			currDispTable.style.display = 'none';
		currDispTable = null;
	}
}

function showLists(panel_, listDiv, imgObject_, imgName_, altText_)
{
	//	Need to set this to a 'wait' image (GIF)
//	alert('Setting the image to clocks1');
//alert("showList(listDiv, " + imgObject_ + ", ...");
	PopupImg.src="clocks1.gif";
	HideTable();
//    alert("Navigating to:  \"" + imgName_ + "\"");
	PopupImg.src=imgName_;
	PopupImg.alt=altText_;
//	HideTable();
	listDiv.style.display = '';
    if (null!=panel_)
listDiv.style.posLeft=//Panel1.parentElement.offsetLeft+
                     //Panel1.parentElement.parentElement.offsetLeft+
                     panel_.parentElement.parentElement.parentElement.offsetLeft+
                     panel_.parentElement.parentElement.parentElement.parentElement.offsetLeft;
listDiv.style.posTop=//Panel1.parentElement.offsetTop+
                     //Panel1.parentElement.parentElement.offsetTop+
                     panel_.parentElement.parentElement.parentElement.offsetTop+
                     panel_.parentElement.parentElement.parentElement.parentElement.offsetTop;
	currDispTable = listDiv;
    listDiv.scrollIntoView();
if( window.event!=null)
	window.event.cancelBubble = true;
}

function HidePicsDiv() 
{
	if(currDispPicsDiv != null)
	{
		currDispPicsDiv.style.display = 'none';
		currDispPicsDiv = null;
	}
	if(null!=currDispPicsTD){
		currDispPicsTD.style.backgroundColor="";
		currDispPicsTD.style.borderColor="";
//		currDispPicsTD.style.border="";
                currDispPicsTD.style.cursor="hand";
	}
}
function showPicsDiv(picsDiv_, picsTD_)
{
	HidePicsDiv();

	picsDiv_.style.display="";
	currDispPicsDiv=picsDiv_;
	currDispPicsTD=picsTD_;
	if(null!=picsTD_){
		picsTD_.style.backgroundColor="#ffffaf";
//		picsTD_.style.borderStyle="solid";
		picsTD_.style.borderColor="#ff0000";
//		picsTD_.style.border="2px solid #ff0000";
                picsTD_.style.cursor="none";
	}
//	window.event.cancelBubble=true;
}

function DumpPopupPic()
{
	if( navigator.appName!="Netscape")
	{
document.write("<div id=\"leftbd\"   style=\"position:absolute;visibility:hidden;background-color:white;\"></div>");
document.write("<div id=\"topbd\"    style=\"position:absolute;visibility:hidden;background-color:white;\"></div>");
document.write("<div id=\"rightbd\"  style=\"position:absolute;visibility:hidden;background-color:white;\"></div>");
document.write("<div id=\"bottombd\" style=\"position:absolute;visibility:hidden;background-color:white;\"></div>");

		document.write("<DIV ID='PopupPic' class='PopupPicShown' onClick='HideTable()'><TABLE border='2'><TR><TD><img name='PopupImg' src='clocks1.gif'/></TD></TR></TABLE></DIV>");
		document.write("<SCRIPT LANGUAGE=javascript FOR=window EVENT=onload>currDispTable = document.getElementById('PopupPic');HideTable();</SCRIPT>");


	}
}




