function Toggle(ob) {
	if (document.getElementById) {
		currentVisibility = document.getElementById(ob).className;
	} else if (document.all) {
		currentVisibility = document.all.ob.className;
	} else {
		currentVisibility = document.ob.className;
	}
	if (currentVisibility == "visible") { Hide(ob); }
	else { Show(ob); }
}

function TogglePlusMinus(id,plus,minus) {
	if (document.getElementById) {
		img = document.getElementById(id);
		if (img.alt == '+') { img.alt = '-'; img.src = minus; }
		else if (img.alt == '-') { img.alt = '+'; img.src = plus; }		
	}
}

function Show(ob) {
	if (document.getElementById) {
		document.getElementById(ob).className = "visible";
	} else if (document.all) {
		document.all.ob.className = "visible";
	} else {
		document.ob.className = "visible";
	}
}

function Hide(ob) {
	if (document.getElementById) {
		document.getElementById(ob).className = "invisible";
	} else if (document.all) {
		document.all.ob.className = "invisible";
	} else {
		document.ob.className = "invisible";
	}
}

function changeImage(id,url) {
	if (document.getElementById) {
		document.getElementById(id).src = url;
	}
}



// FLOATING "TOOLTIPS" WITH ARBITRARY HTML CODE
// From http://www.freejavascriptkit.com/free_javascripts/tooltip_hint/dhtml_mouseover_tooltip.html


var html_tooltip_x_offset = 0; // Customize x offset of tooltip
var html_tooltip_y_offset = 20; // Customize y offset of tooltip
var html_tooltip_ie = document.all;
var html_tooltip_ns6 = document.getElementById && !document.all;
var html_tooltip_enabled = false;
var html_tooltip_object = null;
function HTML_Tooltip_IETrueBody() { return (document.compatMode && document.compatMode!="BackCompat") ? document.documentElement : document.body; }

function HTML_Tooltip_Initialize() {
	if (!document.getElementById('html_tooltip') && document.body) {
		var tooltip_div = document.createElement('div'); tooltip_div.id = 'html_tooltip'; tooltip_div.innerHTML = '';
		document.body.appendChild(tooltip_div);
	}
	if (html_tooltip_ie||html_tooltip_ns6) {
		html_tooltip_object = (document.all) ? document.all['html_tooltip'] : document.getElementById ? document.getElementById('html_tooltip') : "";
	}
	document.onmousemove = HTML_Tooltip_Position;
}

function HTML_Tooltip_Create(thetext, thecolor, thewidth){
	if ((html_tooltip_ns6||html_tooltip_ie) && self.html_tooltip_object){
		if (typeof thewidth!="undefined") { html_tooltip_object.style.width=thewidth+"px"; }
		if (typeof thecolor!="undefined" && thecolor!="") { html_tooltip_object.style.backgroundColor = thecolor; }
		html_tooltip_object.innerHTML = thetext;
		html_tooltip_enabled = true;
		return false;
	}
}

function HTML_Tooltip_Position(e){
	if (html_tooltip_enabled && self.html_tooltip_object) {
		var curX = (html_tooltip_ns6) ? e.pageX : event.clientX+HTML_Tooltip_IETrueBody().scrollLeft;
		var curY = (html_tooltip_ns6) ? e.pageY : event.clientY+HTML_Tooltip_IETrueBody().scrollTop;
		// Find out how close the mouse is to the corner of the window
		var rightedge = (html_tooltip_ie && !window.opera) ? HTML_Tooltip_IETrueBody().clientWidth-event.clientX-html_tooltip_x_offset : window.innerWidth - e.clientX - html_tooltip_x_offset - 20;
		var bottomedge = (html_tooltip_ie && !window.opera) ? HTML_Tooltip_IETrueBody().clientHeight-event.clientY-html_tooltip_y_offset : window.innerHeight - e.clientY - html_tooltip_y_offset - 20;
		var leftedge = (html_tooltip_x_offset < 0) ? html_tooltip_x_offset*(-1) : -1000;
		
		// If the horizontal distance isn't enough to accomodate the width of the tooltip
		if (rightedge<html_tooltip_object.offsetWidth) {
			//move the horizontal position of the tooltip to the left by it's width
			html_tooltip_object.style.left = (html_tooltip_ie) ? HTML_Tooltip_IETrueBody().scrollLeft+event.clientX-html_tooltip_object.offsetWidth+"px" : window.pageXOffset+e.clientX-html_tooltip_object.offsetWidth+"px";
		} else if (curX<leftedge) {
			html_tooltip_object.style.left = '5px';
		} else {
			html_tooltip_object.style.left = curX+html_tooltip_x_offset+'px'; // position the horizontal position of the tooltip where the mouse is positioned
		}
		//same concept with the vertical position
		if (bottomedge < html_tooltip_object.offsetHeight) {
			html_tooltip_object.style.top = (html_tooltip_ie) ? HTML_Tooltip_IETrueBody().scrollTop+event.clientY-html_tooltip_object.offsetHeight-html_tooltip_y_offset+"px" : (window.pageYOffset+e.clientY-html_tooltip_object.offsetHeight*0.75-html_tooltip_y_offset)+"px";
		} else {
			html_tooltip_object.style.top = curY+html_tooltip_y_offset+"px";
		}
		
		html_tooltip_object.style.visibility = 'visible';
	}
}

function HTML_Tooltip_Hide(){
	if ((html_tooltip_ns6||html_tooltip_ie) && self.html_tooltip_object) {
		html_tooltip_object.style.visibility = 'hidden';
		html_tooltip_object.style.left = '-1000px';
		html_tooltip_object.style.backgroundColor = '';
		html_tooltip_object.style.width = '';
		html_tooltip_enabled = false;
	}
}



