
/* First thing is to declare global variables
   to contain the X and Y coordinates of the
   mouse cursor. */
var currentX = 0;
var currentY = 0;
	
/* Use "object sniffing" technique to determine
   if the browser has the captureEvent method.
   This tells us if the client is a Mozilla-type browser.
   If so, we tell the document object to 
   capture the MOUSEMOVE event. */
if (document.captureEvent){
  document.captureEvent(Event.MOUSEMOVE);
}

/* The getMousePosition() function will be the
   event-handling function that sets
   currentX and currentY. */
function getMousePosition(evt){

/* Internet Explorer and Mozilla have differences
   both in the way they implement events and the
   way they determine x/y coordinates. */
  if (window.event){
    
    /* This is the Internet Explorer way.
       Adds the x and y coordinates relative to the screen
       to the number of pixels the user has scrolled 
       horizontally and vertically. */
    currentX = window.event.clientX + document.body.scrollLeft;
    currentY = window.event.clientY + document.body.scrollTop;
  }
  else if (evt){
    
    /* In Mozilla/Netscape browsers, you just need to access
       the pageX and pageY properties to determine coordinates. */
    currentX = evt.pageX;
    currentY = evt.pageY;
  }
}

// register getMousePosition() as an event handler for the onmousemove event.
document.onmousemove = getMousePosition;

/* The positionElement function will place an object
   at the coordinates (currentX+10, currentY+10).
   Parameter: any valid ID attribute of an element. */
function positionElement(id){
  // set elem to the element with specified id.
  elem = document.getElementById(id);
  if (elem){
    /* If the element exists, set the CSS style "left"
       to currentX + 10, and the CSS style "top" to
       currentY + 10. */
    elem.style.left = (currentX+20) + "px";
    elem.style.top = (currentY) + "px";
  }
}

/* hideToolTip will set the CSS "visibility" property to
   "hidden" for an element whose ID attribute is passed
   to the function. */
function hideToolTip(id){
  elem = document.getElementById(id);
  if (elem){
    elem.style.display="none";
  }
}

/* showToolTip will set the CSS "visibility" property to
   "visible" for an element whose ID attribute is passed
   to the function. */
function showToolTip(id){
  elem = document.getElementById(id);
  if (elem){
    elem.style.display="block";
  }
}


function reload() {location = location;}
function setTop() {
	if (document.getElementById) {
		// the divs array contains references to each column's div element
		var divs = new Array(document.getElementById('content'), document.getElementById('menu'));
		//var tops = new Array(document.getElementById('f'),document.getElementById('fe'),document.getElementById('e'));
		
		// determine the maximum height out of all columns specified
		var maxHeight = 0;
		for (var i = 0; i < divs.length; i++) {
			if (divs[i].offsetHeight+divs[i].offsetTop > maxHeight) maxHeight = divs[i].offsetHeight+divs[i].offsetTop;
		}
		
		// set all columns to maximum height
		//for (var i = 0; i < tops.length; i++) {
		//	tops[i].style.top = maxHeight + 'px';
		//	tops[i].style.display = 'block';
		//}
		for (var i = 0; i < divs.length; i++) {
		    
		    thisTop=divs[i].offsetTop;
		    thisHeight=maxHeight-thisTop;
			
			divs[i].style.height = thisHeight + 'px';

			// if the browser's working in standards-compliant mode, the height property
			// sets the height excluding padding, so we figure the padding out by subtracting the
			// old maxHeight from the new offsetHeight, and compensate!
			if (divs[i].offsetHeight > thisHeight) {
				divs[i].style.height = (thisHeight - (divs[i].offsetHeight - thisHeight)) + 'px';
			}
		}
	
    	//if (document.getElementById('ex')) {
    	//    var ex = document.getElementById('ex');
        //	var ft = document.getElementById('e').offsetTop;
        //	var fh = document.getElementById('e').offsetHeight;
        //	var fb = (ft + fh) + 'px';
        //	ex.style.top = fb;
        //	ex.style.display = 'block';
    	//}
	}
}
window.onload=function() {setTop();}
//window.onresize = reload;
