
document.write("<div id='fake'></div>")
	
	var last = "fake"
	var last2 = "fake"

	var show_it = "visible"
	var hide_it = "hidden"
	var timer
	var timer2
	
	function toggleLayer(id)
	{
		if(document.all) {var obj = document.all(id).style}
		if(document.getElementById){var obj = document.getElementById(id).style}
		if(document.layers) {var obj = document.layers[id]; show_it = "show"; hide_it = "hide"}
		if(navigator.userAgent.indexOf("Opera")==0) {show_it = "VISIBLE"; hide_it = "HIDDEN"}
		if(obj.visibility == hide_it){obj.visibility = show_it}
		else {obj.visibility = hide_it}
	}

	function showLayer(id)
	{
		if(document.all) {var obj = document.all(id).style}
		if(document.getElementById){var obj = document.getElementById(id).style}
		if(document.layers) {var obj = document.layers[id]; show_it = "show"; hide_it = "hide"}
		if(navigator.userAgent.indexOf("Opera")==0) {show_it = "VISIBLE"; hide_it = "HIDDEN"}
		obj.visibility = show_it
		last = id; // so it will know which one to hide
	}

	function hideLayer(id)
	{
		if(document.all){ var obj = document.all(id).style;	}
		if(document.getElementById){var obj = document.getElementById(id).style}
		if(document.layers) {var obj = document.layers[id]; show_it = "show"; hide_it = "hide"}
		if(navigator.userAgent.indexOf("Opera")==0) {show_it = "VISIBLE"; hide_it = "HIDDEN"}
		obj.visibility = hide_it
	}

	var time_count = 300
	
	function closeCounter(id)
	{
		last2 = id; // so it will know which one to hide
		var timerbox = "hideLayer('"+id+"');"
		timer = setTimeout (timerbox, time_count)
	}

	function closeCounter2(id)
	{
		var timerbox = "hideLayer('"+id+"')"
		timer2 = setTimeout (timerbox, time_count)
	}

	function hideLast(id)
	{
		hideLayer (last);
		if (id != last2) {hideLayer (last2);}
		//alert(last + " " + last2)
		showLayer (id);
	}

	//this will ensure that them most recently clicked-on layer will go on top of the other buttons
	var zdex_count = 10
	
	function zdex(id)
	{
		if(document.getElementById)
		{
			zdex_count++
			document.getElementById(id).style.zIndex = zdex_count
		}
	}

/* Begin Code for hover text */

// opacity functions
var pb_opac = 0
var pb_opac_timer_show
var pb_opac_timer_hide
					
function popBoxFadeIn(id)
{
	clearTimeout(pb_opac_timer_hide)
	var obj = document.getElementById(id).style
	obj.display = ""
	if (pb_opac <= 100)
	{
		obj.filter = "alpha(opacity=" + pb_opac + ", style=0)"
		obj.opacity = pb_opac/100
		obj.KhtmlOpacity = (pb_opac/100);
		pb_opac_timer_show = setTimeout("popBoxFadeIn(\""+id+"\")", 50);
		pb_opac += 33
	}
	else
	{
		clearTimeout(pb_opac_timer_show)
	}
}
					
function popBoxFadeOut(id)
{
	clearTimeout(pb_opac_timer_show)
			
	var obj = document.getElementById(id).style
	if (pb_opac >= 0)
	{
		obj.filter = "alpha(opacity=" + pb_opac + ", style=0)"
		obj.opacity = pb_opac/100
		obj.KhtmlOpacity = (pb_opac/100);
		pb_opac_timer_hide = setTimeout("popBoxFadeOut(\""+id+"\")", 50);
		pb_opac -= 33
	}
	else
	{
		clearTimeout(pb_opac_timer_hide)
		obj.display = "none"
	}
}
						
					
//figure out window size
var page_width = 0
var page_height = 0
					
if (!document.all && document.getElementById)
{
	page_width = window.innerWidth;
	page_height = window.innerHeight;
}
else
{
	page_width = document.body.clientWidth;
						
	//if strict
	if(document.documentElement && (document.documentElement.clientWidth || document.documentElement.clientHeight))
	{
		page_height = document.documentElement.clientHeight;
	} 
	//if not strict
	else if(document.body && ( document.body.clientWidth || document.body.clientHeight ) )
	{
		page_height = document.body.clientHeight;
	}
}

function getMousePosition(e)
{
	if (document.all && document.getElementById)
	{
		if(event.clientX + document.body.scrollLeft < 40)
		{
			document.getElementById("pop_box_div").style.left = 20 + "px"
		}
		else if(event.clientX + document.body.scrollLeft > (page_width - 280))
		{
			document.getElementById("pop_box_div").style.left = page_width - 360 + "px"
		}
		else
		{
			document.getElementById("pop_box_div").style.left = event.clientX + document.body.scrollLeft - 20
		}
		
		if(event.clientY + document.body.scrollTop < 20)
		{ 	
			document.getElementById("pop_box_div").style.top = 10 + "px"
		}
		else if(event.clientY + document.body.scrollTop > (page_height - (10 + document.getElementById("pop_box_div").clientHeight)))
		{
			document.getElementById("pop_box_div").style.top = event.clientY + document.body.scrollTop - (10 + document.getElementById("pop_box_div").clientHeight) + "px"
		}
		else
		{
			document.getElementById("pop_box_div").style.top = event.clientY + document.body.scrollTop + 20 + "px"
		}
	}
	else
	{
		if((e.pageX) < 40)
		{
			document.getElementById("pop_box_div").style.left = 20 + "px"
		}
		else if((e.pageX) > (page_width - 280))
		{
			document.getElementById("pop_box_div").style.left = page_width - 390 + "px"
		}
		else
		{
			document.getElementById("pop_box_div").style.left = (e.pageX - 20) + "px";
		}
		
		if((e.pageY) < 20)
		{
			document.getElementById("pop_box_div").style.top = 10 + "px"
		}
		else if((e.pageY) > (page_height - (10 + document.getElementById("pop_box_div").clientHeight)))
		{
			document.getElementById("pop_box_div").style.top = (e.pageY - (10 + document.getElementById("pop_box_div").clientHeight) + "px")
		}
		else
		{
			document.getElementById("pop_box_div").style.top = (e.pageY + 20) + "px";
		}
	}
}
						
document.onmousemove = getMousePosition;

//change content in box
function popBoxContent(text)
{
	document.getElementById("pop_box_div").innerHTML = text
}

document.write("<div style=\"position: absolute; width: 350px; display: none;\" id=\"pop_box_div\">floating div</div>")

/* End code for hover text */