// Detect if the browser is IE or not.
// If it is not IE, we assume that the browser is NS.
var IE = document.all?true:false

// If NS -- that is, !IE -- then set up for mouse capture
if (!IE) document.captureEvents(Event.MOUSEMOVE)

// Set-up to use getMouseXY function onMouseMove
document.onmousemove = getMouseXY;

// Temporary variables to hold mouse x-y pos.s
var MouseX = 0
var MouseY = 0

var div_ID
var visiblebottom
var continueit
var easing
var currentid = 0

// Main function to retrieve mouse x-y pos.s
function getMouseXY(e) {
  if (IE) { // grab the x-y pos.s if browser is IE
    MouseX = event.clientX + document.body.scrollLeft
    MouseY = event.clientY + document.body.scrollTop
  } else {  // grab the x-y pos.s if browser is NS
    MouseX = e.pageX
    MouseY = e.pageY
  }  
  // catch possible negative values in NS4
  if (MouseX < 0){MouseX = 0}
  if (MouseY < 0){MouseY = 0}  
  // show the position values in the form named Show
  // in the text fields named MouseX and MouseY
  return true
}

function MM_findObj(n, d) { //v4.0
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && document.getElementById) x=document.getElementById(n); return x;
}

function DL_GetElementLeft(eElement)
{
    var nLeftPos = eElement.offsetLeft;          // initialize var to store calculations
    var eParElement = eElement.offsetParent;     // identify first offset parent element  
    while (eParElement != null)
    {                                            // move up through element hierarchy
        nLeftPos += eParElement.offsetLeft;      // appending left offset of each parent
        eParElement = eParElement.offsetParent;  // until no more offset parents exist
    }
    return nLeftPos;                             // return the number calculated
}

function DL_GetElementTop(eElement)
{
    var nTopPos = eElement.offsetTop;          // initialize var to store calculations
    var eParElement = eElement.offsetParent;     // identify first offset parent element  
    while (eParElement != null)
    {                                            // move up through element hierarchy
        nTopPos += eParElement.offsetTop;      // appending left offset of each parent
        eParElement = eParElement.offsetParent;  // until no more offset parents exist
    }
    return nTopPos;                             // return the number calculated
}

function MM_showHideHelp(divid, visibility, x, y, divplaceholder, scroll) { //v3.0
  var v,obj
	var divx
	var divy

	if ((obj=MM_findObj(divid))!=null) { 
		v=visibility;
    if (obj.style) { 
			obj=obj.style; 
			v=(v=='show')?'visible':(v='hide')?'hidden':v; 
		}
		
			
		if (x != '') {
			divx = x
		} else if (divplaceholder != '') {
			divx = DL_GetElementLeft(document.getElementById(divplaceholder))-13;
		} else {
			divx = MouseX			
		}
		
		if (y != '') {
			divy = y
		} else if (divplaceholder != '')  {
			divy = DL_GetElementTop(document.getElementById(divplaceholder));		
		} else {
			divy = MouseY			
		}
		
		if (y == '666') {
			divy = MouseY-30
		}
		
		obj.visibility=v; 
		obj.left=divx;
		obj.top=divy;		
		
		if (scroll) {
		if (visibility=='show') {

			continueit = true;
			ScrollDown(divid, 10)
		} else {
			continueit = false;		
		}
		}

		
	}
}

function ScrollDown(divid, vbottom) {
	var ypostion
	var obj = MM_findObj(divid)
	var objheight
	var bottomscrollobjtop
	var scrollpercent = 0.1
	
	objheight = DL_GetElementTop(document.getElementById("btm"+divid)) - DL_GetElementTop(document.getElementById("top"+divid))

	div_ID = divid
	visiblebottom = vbottom + Math.ceil((objheight-vbottom)*scrollpercent)
	
	
  if (obj.style) { 
		obj=obj.style; 
	}
	
	
	obj.clip = "rect(0 165 " + visiblebottom + " 0)"
	
	if (vbottom<objheight && continueit==true) {
		window.setTimeout("ScrollDown(div_ID, visiblebottom)", 10);
	}

}