// JavaScript Document
		
function setActiveStyleSheet(title) {
   var i, a, main;
   for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {
     if(a.getAttribute("rel").indexOf("style") != -1
        && a.getAttribute("title")) {
       a.disabled = true;
       if(a.getAttribute("title") == title) a.disabled = false;
     }
   }
}
function setStyleSheetActive(title) {
   var i, a, main;
   for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {
     if(a.getAttribute("rel").indexOf("style") != -1 && a.getAttribute("title")) {
       if(a.getAttribute("title") == title) a.disabled = false;
     }
   }
}
function setStyleSheetInactive(title) {
   var i, a, main;
   for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {
     if(a.getAttribute("rel").indexOf("style") != -1 && a.getAttribute("title")) {
       if(a.getAttribute("title") == title) a.disabled = true;
     }
   }
}
function debugStyleSheets() {
   var str = "";
   var i, a, main;
   for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {
	   str += "Title: " + a.getAttribute("title") + "   Enabled: " + !a.disabled + "\n\n";
   }
   alert("These are your stylesheets, and their status: \n\n" + str);
}

function hidediv(div) {
	if (!div) {
		alert("JavaScript Page Error, parameter not passed into hidediv().");
		return;
	}
	document.getElementById(div).style.display='none';
}
function showdiv(div) {
	if (!div) {
		alert("JavaScript Page Error, parameter not passed into showdiv().");
		return;
	}
	document.getElementById(div).style.display='block';
}
//---------------------------------------------------------------------------------------------------------------
//This is for the COMMENT POPUP
//---------------------------------------------------------------------------------------------------------------
mousex = mousey = 0;
opacity = 100; timerid = -1; timeropenid = -1; timerfadeid = -1; timeoutid = -1;
var maxheight = 0;
var skn = null;
var timerid = 0;
var popup_mousestatus = "out";
var innerHTML = "";

// Set Netscape up to run the "captureMousePosition" function whenever
// the mouse is moved. For Internet Explorer and Netscape 6, you can capture
// the movement a little easier.
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) {
	//This works for IE 6 and FIrefox
   if (document.all) {
	   mousex = mouseX(event);
		mousey = mouseY(event);
		//window.defaultStatus = "xMousePos=" + mousex + ", yMousePos=" + mousey + "  IE 6";
   
    } else if (document.getElementById) {
        // Netscape 6 behaves the same as Netscape 4 in this regard
        mousex = e.pageX;
        mousey = e.pageY;
        //xMousePosMax = window.innerWidth+window.pageXOffset;
        //yMousePosMax = window.innerHeight+window.pageYOffset;
    }

}
function mouseX(evt) {
	if (evt.pageX) return evt.pageX;
	else if (evt.clientX)
	   return evt.clientX + (document.documentElement.scrollLeft ?
	   document.documentElement.scrollLeft :
	   document.body.scrollLeft);
	else return null;
}
function mouseY(evt) {
	if (evt.pageY) return evt.pageY;
	else if (evt.clientY)
	   return evt.clientY + (document.documentElement.scrollTop ?
	   document.documentElement.scrollTop :
	   document.body.scrollTop);
	else return null;
}
function popup(msg, pos, slidein) {
	slidein = true;
  clearInterval(timerid);
  clearTimeout(timeoutid);
  timerid = 0;
  if (!pos) pos = 'right';
  if (pos == 'right') {
	  skn.style.left = (mousex + 20) + "px";
	  skn.style.top = (mousey + 10) + "px";
  }
  
   skn.style.filter = 'alpha(opacity=1)';
  skn.style.opacity = '0.01';
  
  opacity = 0;
// alert(skn.style.top);
	 if (skn.innerHTML != msg) {
	  skn.style.height = 'auto';
	  skn.innerHTML = msg;
	 }
	
//  if (skn["offsetWidth"] > 400) {
	//  skn.style.width = "400px";
  //}
  if (pos == 'left') {
	  var oldoffset = skn["offsetWidth"];
	  skn.style.left = (mousex - oldoffset) + "px";
	  skn.style.width = oldoffset + "px";
	  skn.style.top = (mousey + 10) + "px";
  }
  

  opened = true;
  if (slidein) {
	  timeropenid = window.setInterval("openInterval()",25);
  }
  //skn.style.visibility = "visible";  
}
function popup_mouseout() {
		if (!opened) return;
		if (popup_mousestatus == 'in') {
			popup_mousestatus = 'out';
			close_popup();
		}

		skn.releaseCapture();
		popup_mousestatus = 'out';
}
function popup_mouseover() {
		if (! opened) return;
		popup_mousestatus = 'in';
		skn.setCapture();

}
function close_popup() {
	timeoutid = window.setTimeout("kill()",400);
}
function kill() 
{
	if (!mousedown && timerid == 0 && popup_mousestatus == 'out' ) {
		opacity = 100;
	 	timerid = window.setInterval("closeinterval()",50);
	}
}
function openInterval() {
	if (timeropenid != -1) {
		opacity += 10;
	
		skn.style.filter = 'alpha(opacity=' + opacity +')';
		skn.style.opacity = '' + opacity / 101 + '';
		//window.defaultStatus="Opacity:" + skn.style.filter + "   Visibility:" + skn.style.visibility + "    Display:" + skn.style.display;
//		alert(maxheight);
		if (opacity >= 91) {
			opacity = 100;
			//alert(skn.style.visibility + "\n" + skn.style.filter + "\n" + skn.style.left + "\n" + skn.style.top);
			skn.style.filter = 'alpha(opacity=99)';
			skn.style.opacity = '0.99';
			clearInterval(timeropenid);
			timeropenid = -1;
		}
	}
	
}
function closeinterval() {
	opacity -= 10;
	skn.style.filter = 'alpha(opacity=' + opacity +')';
	skn.style.opacity = '' + opacity / 101 + '';
	//window.defaultStatus="Filter:" + skn.style.filter + "   Visibility:" + skn.style.visibility + "    Display:" + skn.style.display;
	if (opacity <= 1) {
		clearInterval(timerid);
		timerid = 0;
		
		//skn.style.visibility = "hidden";
		
		skn.style.filter = 'alpha(opacity=0)';
		skn.style.opacity = '0.0';
		
		opacity = 0;
		
		opened = false;
	}
}



//=========================================================================================
// Here we handle events
//=========================================================================================
var mouseup = true;
var mousedown = false;

function on_MouseUp() {
	mousedown = false;
	mouseup = true;
}
function on_MouseDown() {
	mousedown = true;
	mouseup = false;
}

//Handle initialization chores
function loadHandle() {
	if (!document.all) {
		if (document.getElementById("popupdiv")) {
			<!-- Close the popup -->
			document.getElementById("popupdiv").addEventListener("mouseout", popup_mouseout, false);
			document.getElementById("popupdiv").addEventListener("mouseover", popup_mouseover, false);
		}
	}
	else {
		if (document.getElementById("popupdiv")) {
			<!-- Close the popup -->
			document.getElementById("popupdiv").attachEvent("onmouseout", popup_mouseout);
			document.getElementById("popupdiv").attachEvent("onmouseover", popup_mouseover);
		}
	}
}

function correctPNG() // correctly handle PNG transparency in Win IE 5.5 or higher.
   {
	for(var i=0; i<document.images.length; i++)
      {
	  var img = document.images[i]
	  var imgName = img.src.toUpperCase()
	  if (imgName.substring(imgName.length-3, imgName.length) == "PNG")
	     {
		 var imgID = (img.id) ? "id='" + img.id + "' " : ""
		 var imgClass = (img.className) ? "class='" + img.className + "' " : ""
		 var imgTitle = (img.title) ? "title='" + img.title + "' " : "title='" + img.alt + "' "
		 var imgStyle = "display:inline-block;" + img.style.cssText 
		 if (img.align == "left") imgStyle = "float:left;" + imgStyle
		 if (img.align == "right") imgStyle = "float:right;" + imgStyle
		 if (img.parentElement.href) imgStyle = "cursor:hand;" + imgStyle		
		 var strNewHTML = "<span " + imgID + imgClass + imgTitle
		 + " style=\"" + "width:" + img.width + "px; height:" + img.height + "px;" + imgStyle + ";"
	     + "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader"
		 + "(src=\'" + img.src + "\', sizingMethod='scale');\"></span>" 
		 img.outerHTML = strNewHTML
		 i = i-1
	     }
      }
}
   
if (!document.all) {
	//FIREFOX IS BEING USED
	window.addEventListener("load",loadHandle,false);
	document.addEventListener("mouseup",on_MouseUp,false);
	document.addEventListener("mousedown",on_MouseDown,false);
}
else {
	//INTERNET EXPLORER IS BEING USED
	window.attachEvent("onload",loadHandle);
	window.attachEvent("onload",correctPNG);
	document.attachEvent("onmouseup", on_MouseUp);
	document.attachEvent("onmousedown", on_MouseDown);
}
