function getElementPosition(elemID) {

    var offsetTrail = document.getElementById(elemID);
    var offsetLeft = 0;
    var offsetTop = 0;
    while (offsetTrail) {
        offsetLeft += offsetTrail.offsetLeft;
        offsetTop += offsetTrail.offsetTop;
        offsetTrail = offsetTrail.offsetParent;
    }
    if (navigator.userAgent.indexOf("Mac") != -1 && 
        typeof document.body.leftMargin != "undefined") {
        offsetLeft += document.body.leftMargin;
        offsetTop += document.body.topMargin;
    }
    return {x:offsetLeft, y:offsetTop};
}

function getbrowserid() {
browserName=navigator.appName; 
  if ((browserName=="Netscape") ||  (browserName=="Microsoft Internet Explorer"))
  {     
    if (browserName=="Netscape")
        version="NS";
     else
         version="IE";
     }
  else
      version="OTHER"; 
  return version
}


// Browser compatible element getter	
function getElement(id){
if (document.all)
return document.all[id];		
if (document.getElementById(id))			
return document.getElementById(id);				
return null;	}	


function setpos(tspan,ttd,tspacer,tx,ty) {

zspan = getElement(tspan); //get span id
position = getElementPosition(ttd); //get position of td tag
zspacer = getElementPosition(tspacer);

//alert ("cell " + position.x + "and black box " + zspacer.x);
//alert(position.x + "   " + position.y);

tx1 = position.x - zspacer.x+tx
ty1 = position.y - zspacer.y+ty

//alert(tx + "   " + ty);
var ns4 = (document.layers)? true:false
var ie4 = (document.all)? true:false
var ns6 = (!document.all && document.getElementById)? true:false
             

if (ns4) {
document.zspan.left = position.x+tx;
document.zspan.top = position.y+ty;
//alert ("ns4");
}
else if (ie4) {
zspan.style.left = tx1 + "px";
zspan.style.top = ty1 + "px";
//alert ("ie4");

}
else if (ns6) {
document.getElementById(tspan).style.left = position.x+tx-2 + "px";
document.getElementById(tspan).style.top = position.y+ty-14 + "px";

//alert ("ns6");

}



}

