﻿function wotpButton()
{
WVAunhide(vfirefox);
showInfoPane();
}

function showInfoPane()
{
showMarkers();
document.getElementById('infopane').style.display = '';
document.getElementById('wotpDown').style.display = 'none';
document.getElementById('wotpUp').style.display = '';
setCookie("wotppane", 1, null,"/");
}

function hideInfoPane()
{
document.getElementById('infopane').style.display = 'none';
document.getElementById('wotpUp').style.display = 'none';
document.getElementById('wotpDown').style.display = '';
setCookie("wotppane", 0, null,"/");
}

function WOTPstart(CurrentS)
{
if (CurrentS == 1 && document.getElementById('wotpDown').style.display != 'none')
{
document.getElementById('infopane').style.display = '';
document.getElementById('wotpDown').style.display = 'none';
document.getElementById('wotpUp').style.display = '';
showMarkers();
}
}

//Markers Stuff

function getObj(textObjID)
{
	return document.getElementById(textObjID);
}
function setMarkerByTitle(strTitleToFind,lyr)
{
	var coors = findPosTD(strTitleToFind);
	setPosition(lyr, coors);
}
function setMarkerByID(strid, lyr)
{
	var coors = findPos(document.getElementById(strid));
	setPosition(lyr, coors);
}
function setMarkerBySpanText(strSpanText,lyr)
{
	var coors = findPosSpan(strSpanText);
	setPosition(lyr, coors);
}
function setMarkerByAText(strAText,lyr)
{
	var coors = findPosA(strAText)
	setPosition(lyr, coors);
}
function setPosition(objx, coors)
{
	var x = document.getElementById(objx);
	idLen=objx.length;
	idSub=objx.substr(idLen-2,2);
	if (idSub=='_B'){
	x.style.top = (coors[1] - 32) + 'px';
	x.style.left = (coors[0] - 28) + 'px';
	x.style.zIndex = 98;
	}
	else if (idSub=='_N'){
	x.style.top = (coors[1] - 33) + 'px';
	x.style.left = (coors[0] - 25) + 'px';
	x.style.zIndex = 99;
	}
	else{
	x.style.top = (coors[1] - 18) + 'px';
	x.style.left = (coors[0] - 15) + 'px';
	x.style.zIndex = 99;
	}
}
function findPos(obj)
{
	var curleft = curtop = 0;
	if (obj.offsetParent) {
		curleft = obj.offsetLeft
		curtop = obj.offsetTop
		while (obj = obj.offsetParent) {
			curleft += obj.offsetLeft
			curtop += obj.offsetTop
		}
	}
	return [curleft,curtop];
}
function findPosTD(strTitle)
{
	var i = 0;
	var tds=document.getElementsByTagName('td');
var length = strTitle.length;
 	for(i in tds)
	{
if (typeof(tds[i].title) == "object") {
if (tds[i].title.length > 0){
alert(Left(tds[i].title, length) + "and strTitle=" + strTitle);
}
}
	  if(Left(tds[i].title, length) == strTitle)
	  //if (tds[i].title.indexOf(strTitle) = 0)
          {
	  	alert("found it");
	    var coors2 = findPos((tds[i]));
	    return coors2;
	  }
  	}
  	alert("not found");
}
function Left(str, n){
	if (n <= 0)
	    return "";
	else if (n > String(str).length)
	    return str;
	else
	    return String(str).substring(0,n);
}
function findPosSpan(strInnerText)
{
	var i = 0;
	var spans=document.getElementsByTagName('span');
 	for(i in spans)
	{
	  if(spans[i].innerText == strInnerText)
	  {
	  //	alert("found it");
	    var coors2 = findPos(spans[i]);
	    return coors2;
	  }
  	}
}
function findPosTD(strInnerText)
{
	var i = 0;
	var spans=document.getElementsByTagName('td');
 	for(i in spans)
	{
	  if(spans[i].innerText == strInnerText)
	  {
	  //	alert("found it");
	    var coors2 = findPos(spans[i]);
	    return coors2;
	  }
  	}
}
function findPosA(strInnerText)
{
	var i = 0;
	var spans=document.getElementsByTagName('a');
 	for(i in spans)
	{
	  if(spans[i].innerText == strInnerText)
	  {
	  //	alert("found it");
	    var coors2 = findPos(spans[i]);
	    return coors2;
	  }
  	}
}