// /global/javascript/imagefloat.js
// this function provides a way to float a div with an image in it
// 
// In the document source set up the divs with images in it.
// then call the unhide function via "onmouseover="unhide(id_of_div,"L/R")" L = put image left of mouse, R = put image to right of mouse
// and the hide function via "onmouseout="hide(id_of_div)"
var xpos = 0;
var ypos = 0;
var hase = 0

function unhide(thediv,lr) {
	if (document.getElementById) {
		// alert('showing pic');
		document.getElementById(thediv).style.border = '2px solid #000';
		document.getElementById(thediv).style.top = (ypos + 10) + "px";
		if (lr == "L") {
			if (hase == 1) {
				xpos = window.innerWidth - xpos;
			} else {
				xpos = document.body.offsetWidth - xpos;
			}
			document.getElementById(thediv).style.right = (xpos + 10) + "px";
		} else {
			document.getElementById(thediv).style.left = (xpos + 10) + "px";
		}
		document.getElementById(thediv).style.display = 'block';
	}
}

function dohide(thediv) {
	document.getElementById(thediv).style.display = 'none';
}

function getXY(e) {
	if (!e) { e = window.event; hase = 0;}
	if (e.pageX) {
		xpos = e.pageX;
		ypos = e.pageY;
	} else {
		xpos = e.clientX + (document.documentElement.scrollLeft ? document.documentElement.scrollLeft : document.body.scrollLeft);
		ypos = e.clientY + (document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop);
	}
}

document.onmousemove = getXY;