/*  
 This function is used to obtain an DOM element from a HTML document. The function
 is cross browser compatible but does not handle nested layers in Netscape 4.
*/
function getObj(name)
{ if (document.getElementById)
 { this.obj = document.getElementById(name);
  this.style = document.getElementById(name).style; }
 else if (document.all)
 { this.obj = document.all[name];
  this.style = document.all[name].style; }
 else if (document.layers)
 { this.obj = document.layers[name];
  this.style = document.layers[name]; }
}
/* 
 Determines the x coordinate of a DOM element top left corner.
*/
function findPosX(obj)
{ var curleft = 0;
 if (obj.offsetParent)
 { while (obj.offsetParent)
  { curleft += obj.offsetLeft
   obj = obj.offsetParent; }
 }
 else if (obj.x)
  curleft += obj.x;
 return curleft;
}
/* 
 Determines the y coordinate of a DOM element top left corner.
*/
function findPosY(obj)
{ var curtop = 0;
 if (obj.offsetParent)
 { while (obj.offsetParent)
  { curtop += obj.offsetTop
   obj = obj.offsetParent; }
 }
 else if (obj.y)
  curtop += obj.y;
 return curtop;
}

/* This function is used to display a hover layer associated with a given <div>. The
 function will determine the positioning of the hover layer based on the <div>'s position,
 height, and width and set it to visible.  If the hover layer is already visible then the
 layer's visibility is set to 'hidden'.  
 The function takes three optional parameters
  *bAboveEdge :  Boolean value, determines whether the hover layer is displayed above or below
    the calling <div>. Defaults to true.
  *offset : Integer value that determines the vertical offset between the edge of the calling
    <div> and the hover layer. Defaults to zero.
  *hoverId : ID of the layer to hover.  Defaults to id + '_hover'
 
 The hovered layer is centred against the mid-axis of the calling <div>.
*/
function showFloat(id)
{ var bAboveEdge = (showFloat.arguments.length > 1) ? showFloat.arguments[1] : true;
 var offset = (showFloat.arguments.length > 2) ? showFloat.arguments[2] : 0
 var hoverId = (showFloat.arguments.lengt > 3) ? showFloat.arguments[3] : id + "_hover";
 var caller = new getObj(id);
 var midX = parseInt(findPosX(caller.obj) + (caller.obj.offsetWidth/2));
 var midY = bAboveEdge ? parseInt(findPosY(caller.obj)) : parseInt(findPosY(caller.obj) + caller.obj.offsetHeight);
 var floatObj = new getObj(hoverId);
 if(floatObj.style.visibility == 'visible')
 { floatObj.style.visibility = 'hidden';
  return; }
 //alert(floatObj.style.top);
 //floatObj.style.top = bAboveEdge ? parseInt(midY - floatObj.obj.offsetHeight - offset) + 'px' : parseInt(midY + offset) + 'px';
 floatObj.style.top = bAboveEdge ? parseInt(midY - offset) + 'px' : parseInt(midY + offset) + 'px';
 floatObj.style.left = parseInt(midX - (floatObj.obj.offsetWidth/2)) + 'px';
 floatObj.style.visibility = 'visible';
}
 


/**
 OTHER FUNCTIONS
**/
// pop up code for webstandard popup
//USE :  <a href="<file>" onclick="popUp(this.href,'elastic',590,500);return false;" target="newWin">
function popUp(strURL,strType,strWidth,strHeight) 
{
 var strOptions="";
 if (strType=="console") strOptions="resizable,height="+strHeight+",width="+strWidth;
 if (strType=="fixed") strOptions="status,height="+strHeight+",width="+strWidth;
 if (strType=="elastic") strOptions="toolbar,menubar,scrollbars,resizable,location,height="+strHeight+",width="+strWidth;
 window.open(strURL, 'newWin', strOptions);
}