var offsetfrommouse = [20, 20];
var displayduration = 0;
var currentimageheight = 500;
var currentimagewidth = 500;
if (document.getElementById || document.all) {
	document.write('<div id="floaterid">');
	document.write('</div>')
}
function gettrailobj() {
	if (document.getElementById) return document.getElementById("floaterid").style;
	else if (document.all) return document.all.floaterid.style
}
function gettrailobjnostyle() {
	if (document.getElementById) return document.getElementById("floaterid");
	else if (document.all) return document.all.floaterid
}
function truebody() {
	return (!window.opera && document.compatMode && document.compatMode != "BackCompat") ? document.documentElement: document.body
}
function showtrail(imagename, title, description, showthumb, height, e) {
	if (height > 0) {
		currentimageheight = height
	}
	if (e.width > 0) {
		currentimagewidth = e.width
	}
	document.onmousemove = followmouse;
	cameraHTML = '';
	newHTML = '<div style="padding: 5px; background-color: #FFF; border: 1px solid #888;">';
	newHTML = newHTML + '<span class="largetitle">' + title + '</span><hr/>';
	newHTML = newHTML + '<div class="fdesc">' + description.replace(/\[[^\]]*\]/g, '') + '</div>';
	if (showthumb > 0) {
		newHTML = newHTML + '<div align="center" style="padding: 8px 2px 2px 2px;"><img src="' + imagename + '" border="0"></div>'
	}
	newHTML = newHTML + '</div>';
	gettrailobjnostyle().innerHTML = newHTML;
	gettrailobj().visibility = "visible"
}
function followmouse(e) {
	var xcoord = offsetfrommouse[0];
	var ycoord = offsetfrommouse[1];
	var docwidth = document.all ? truebody().scrollLeft + truebody().clientWidth: pageXOffset + window.innerWidth - 15;
	var docheight = document.all ? Math.min(truebody().scrollHeight, truebody().clientHeight) : Math.min(document.body.offsetHeight, window.innerHeight);
	if (typeof e != "undefined") {
		if (docwidth - e.pageX < 500) {
			xcoord = e.pageX - xcoord - Math.round(currentimagewidth*5.5);
		} else {
			xcoord += e.pageX
		}
		if (docwidth - e.pageY < 800) {
			ycoord = e.pageY - ycoord - 250
		}
		else if (docheight - e.pageY < (currentimageheight + 110)) {
			ycoord += e.pageY - Math.max(0, (110  + e.pageY - docheight - truebody().scrollTop))
		} else {
			ycoord += e.pageY
		}
	} else if (typeof window.event != "undefined") {
		if (docwidth - event.clientX < 516) {
			xcoord = event.clientX + truebody().scrollLeft - xcoord - Math.round(currentimagewidth*5.5); //document.getElementById("floaterid").offsetWidth
		} else {
			xcoord += truebody().scrollLeft + event.clientX
		}
                if (docwidth - event.clientY < 800) {
                	ycoord = event.clientY - ycoord - 550  
                }
		if (docheight - event.clientY < (currentimageheight + 110)) {
			ycoord += event.clientY + truebody().scrollTop - Math.max(0, (110 + currentimageheight + event.clientY - docheight))
		} else {
			ycoord += truebody().scrollTop + event.clientY
		}
	}
	gettrailobj().left = xcoord + "px";
	gettrailobj().top = ycoord + "px"
}
function hidetrail() {
	gettrailobj().visibility = "hidden";
	document.onmousemove = "";
	gettrailobj().left = "-500px"
}
