 // Tip Box Display, version 1.0
// Bontrager Connection, LLC
// http://www.willmaster.com/
// -> Functions findPosX and findPosY by 
//    Peter-Paul Koch & Alex Tingle at 
//    http://www.quirksmode.org/js/findpos.html and 
//    http://blog.firetree.net/2005/07/04/javascript-find-position/
//
// One customization:
//
// Specify the ID of the DIV or other container that is the tip box.

 var TipBoxID = "TipBox";

// No other customizations required
// // // // // // // // // // // //

var tip_box_id;
var globalx;
var globaly;
var globalsinit=0;

function findPosX(obj)
{
   var curleft = 0;
   if(obj.offsetParent)
   while(1) 
   {
      curleft += obj.offsetLeft; //curleft = curleft + obj.offsetLeft
      if(!obj.offsetParent)
         break;
      obj = obj.offsetParent;
   }
   else if(obj.x)
      curleft += obj.x; //curleft = curleft + obj.x
   return curleft;
}

function findPosY(obj)
{
   var curtop = 0;
   if(obj.offsetParent)
   while(1)
   {
      curtop += obj.offsetTop;
      if(!obj.offsetParent)
         break;
      obj = obj.offsetParent;
   }
   else if(obj.y)
      curtop += obj.y;
   return curtop;
}

function DisplayTip(id,offX,offY,content) {
   var tipO = id;
   tip_box_id = document.getElementById(TipBoxID);
   if(!globalsinit) {
	   var window = document.getElementById("position_marker");
	   globalx=findPosX(window);
	   globaly = findPosY(window);
	   globalsinit=1;
   }
   tip_box_id.style.left = String(parseInt(globalx + offX) + 'px');
   tip_box_id.style.top = String(parseInt(globaly + offY) + 'px');
   tip_box_id.innerHTML = content;
   tip_box_id.style.display = "block";
   tipO.onclick = ToggleTip;
}

function ToggleTip() {
if(tip_box_id.style.display = "none")
    {
        tip_box_id.style.display = "block";
    }
    else if(tip_box_id.style.display = "block")
    {
        tip_box_id.style.display = "none";
    }
}

function ClearMainImage(me) { 
	var tip1 = me;
 	tip_box_id = document.getElementById(TipBoxID);
	tip1.onclick = HideTip;
}
function HideTip() {
	tip_box_id = document.getElementById(TipBoxID);
if (tip_box_id.style.display != "none") {
tip_box_id.style.display = "none"; 
	}
}