var ie=document.all
var ns6=document.getElementById && !document.all

function ietruebody(){
	return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
}

function getmousepos(e) {
	if (document.documentElement && document.documentElement.scrollTop && window.event) {
		curX = window.event.x + document.documentElement.scrollLeft;
		curY = window.event.y + document.documentElement.scrollTop;
	}
	else if(ie) {
		curX = window.event.x + window.document.body.scrollLeft;
		curY = window.event.y + window.document.body.scrollTop;
	}
	else if(ns6) {
		curX = e.pageX;
		curY = e.pageY;
	}
}

function togglewin(DivID,xoff,yoff) {
	var tpop = document.getElementById(DivID);
	if ( tpop == null ) return;
	if ( tpop.style.display == "none" || tpop.style.display == "" ) { 
		tpop.style.display = "block"; 
		final_xoff = curX + xoff;
		final_yoff = curY + yoff;
		if (final_xoff < 1) { final_xoff = 10; }
		if (final_yoff < 1) { final_yoff = 10; }
		tpop.style.top = final_yoff +"px";
		tpop.style.left = final_xoff +"px";

		testwidth = Math.round(tpop.style.width.replace(/\D/g, ""));
		if (testwidth + final_xoff > document.body.offsetWidth) {
			final_xoff = document.body.offsetWidth - testwidth -5;
			tpop.style.left = final_xoff +"px";
		}
		 
	}
	else { tpop.style.display = "none"; }
}

function PreviewWin(ID) {
	window.open('/details_'+ID+'.php?&nocache='+Math.random(),'preview','height=550,width=770,resizable=no,scrollbars=yes');
}

document.onmousemove = getmousepos;
