// Tiplayer function for full course information			  
timer = 0;
timeMeOut = 0;

if (document.layers) { // Netscape
    document.captureEvents(Event.MOUSEMOVE);
    document.onmousemove = captureMousePosition;
} else if (document.all) { // Internet Explorer
    document.onmousemove = captureMousePosition;
} else if (document.getElementById) { // Netcsape 6
    document.onmousemove = captureMousePosition;
}
function captureMousePosition(e) {
    if (document.layers) {
        // When the page scrolls in Netscape, the event's mouse position
        // reflects the absolute position on the screen. innerHight/Width
        // is the position from the top/left of the screen that the user is
        // looking at. pageX/YOffset is the amount that the user has 
        // scrolled into the page. So the values will be in relation to
        // each other as the total offsets into the page, no matter if
        // the user has scrolled or not.
        xMousePos = e.pageX;
        yMousePos = e.pageY;
        xMousePosMax = window.innerWidth+window.pageXOffset;
        yMousePosMax = window.innerHeight+window.pageYOffset;
    } else if (document.all) {
        // When the page scrolls in IE, the event's mouse position 
        // reflects the position from the top/left of the screen the 
        // user is looking at. scrollLeft/Top is the amount the user
        // has scrolled into the page. clientWidth/Height is the height/
        // width of the current page the user is looking at. So, to be
        // consistent with Netscape (above), add the scroll offsets to
        // both so we end up with an absolute value on the page, no 
        // matter if the user has scrolled or not.
        xMousePos = window.event.x+document.body.scrollLeft;
        yMousePos = window.event.y+document.body.scrollTop;
        xMousePosMax = document.body.clientWidth+document.body.scrollLeft;
        yMousePosMax = document.body.clientHeight+document.body.scrollTop;
    } else if (document.getElementById) {
        // Netscape 6 behaves the same as Netscape 4 in this regard 
        xMousePos = e.pageX;
        yMousePos = e.pageY;
        xMousePosMax = window.innerWidth+window.pageXOffset;
        yMousePosMax = window.innerHeight+window.pageYOffset;
    }
}


function roundit(Num, Places) {
   if (Places > 0) {
      if ((Num.toString().length - Num.toString().lastIndexOf('.')) > (Places + 1)) {
         var Rounder = Math.pow(10, Places);
         return Math.round(Num * Rounder) / Rounder;
      }
      else return Num;
   }
   else return Math.round(Num);
}
			 
function getRefToDiv(divID) {
    if( document.layers ) { //Netscape layers
        return document.layers[divID]; }
    if( document.getElementById ) { //DOM; IE5, NS6, Mozilla, Opera
        return document.getElementById(divID); }
    if( document.all ) { //Proprietary DOM; IE4
        return document.all[divID]; }
    if( document[divID] ) { //Netscape alternative
        return document[divID]; }
    return false;
}

function givedescription(name,desc,qual){

clearTimer();	   
// set browser variable
 var ns = (navigator.appName.indexOf("Netscape") != -1);
myreference = getRefToDiv('TipLayer' );
 if( !myreference ) {
window.alert('Nothing works in this browser');
return false; 
}

			  //Initialize our location for the DIV
			  //get window size

if((navigator.appName == "Netscape") && (parseInt(navigator.appVersion) >=4)){ 
windowwidth = window.innerWidth;
windowheight = window.innerHeight;
}
else if((navigator.appName == "Microsoft Internet Explorer") && (parseInt(navigator.appVersion) >=4)){ 
windowwidth = document.body.clientWidth;
windowheight = document.body.clientHeight;
}else{ 
windowwidth = 800;
windowheight = 600;

}
// Detect a collision and prevent it
if (xMousePos + 210 > xMousePosMax){
   xMousePos = xMousePos - 210;
   }
   
if (yMousePos + 200 > yMousePosMax){
   yMousePos = yMousePos - 200;
   }
   
	     
			   yval = yMousePos+10;
			   xval = xMousePos+10;
			   
			  //Set our particular table values for this document
			  if(qual == 4){ mycol = "#990099" }
			  if(qual == 3){ mycol = "#0000FF" }
			  if(qual == 2){ mycol = "#00FF00" }
			  if(qual == 1){ mycol = "#FFFFFF" }
			  if(qual == 0){ mycol = "#999999" }
			   	 getRefToDiv('itemname').innerHTML = "<strong><font color=" + mycol + ">" + name + "</font></strong>";
				 getRefToDiv('itemdesc').innerHTML = desc;
				// getRefToDiv('myhours').innerHTML = hours;
				// getRefToDiv('mylocation').innerHTML = location;
				// getRefToDiv('mynew').innerHTML = test;
				// display the layer across browsers
			     myreference.style.left = xval;
			  	 myreference.style.top = yval;
			   	 myreference.style.visibility = 'visible';
				}//end function
				 

function removedescription(){
	myreference = getRefToDiv('TipLayer' );
	if( !myreference ) {
		window.alert('Nothing works in this browser');
		return false; 
	}
	
	timer = 1500;
	timeMeOut = 1;
	setTimeout("clearDescription();",timer);
}

function clearDescription(){
	if (timeMeOut == 1){
	myreference.style.visibility = 'hidden';
	}
}

function clearTimer(){
 timeMeOut = 0;
 timer = 0;
}



