// JavaScript Document
/**************************** DST LICENSE ****************************/
/*                                                                   */
/* (c) Copyright 2010, Stringer Sites, LLC. All rights reserved      */
/*                                                                   */
/* This file, and all included, required, or linked                  */
/* file, except those covered explicitly under their own licenses,   */
/* is part of the DST Framework which is licensed under the DST      */
/* LICENSE. The DST License is described in the file included in the */
/* Readme folder ("dst_license.txt").                                */
/*                                                                   */
/*********************************************************************/

/*
Simple Image Trail script- By JavaScriptKit.com
Visit http://www.javascriptkit.com for this script and more
This notice must stay intact
*/

var offsetVal = 10;
var offsetfrommouse=[offsetVal,offsetVal]; //image x,y offsets from cursor position in pixels. Enter 0,0 for no offset
var displayduration=0; //duration in seconds image should remain visible. 0 for always.

if (document.getElementById || document.all){
	document.write('<div id="trailimageid">');
	document.write('</div>');
	document.write('<iframe id="DivRolloverShim" src="javascript:false;" scrolling="no" frameborder="0" style="position:absolute; z-index:1000; top:0px; left:0px; display:none; border: none;"></iframe>');
}

function gettrailobj(){
if (document.getElementById)
return $("trailimageid").style
else if (document.all)
return document.all.trailimagid.style
}

function gettrailobjnostyle(){
if (document.getElementById)
return $("trailimageid")
else if (document.all)
return document.all.trailimagid
}

function getshimobj(){
if (document.getElementById)
return $("DivRolloverShim").style
else if (document.all)
return document.all.DivRolloverShim.style
}

function getshimobjnostyle(){
if (document.getElementById)
return $("DivRolloverShim")
else if (document.all)
return document.all.DivRolloverShim
}

// Retrieve the rendered height of an element
function getObjectHeight()  {
	var elem = gettrailobjnostyle();

	var result = 0;
	if (elem.offsetHeight) {
			result = elem.offsetHeight;
	} else if (elem.clip && elem.clip.height) {
			result = elem.clip.height;
	} else if (elem.style && elem.style.pixelHeight) {
			result = elem.style.pixelHeight;
	}
	var retVal = parseInt(result);
	return retVal;
}
// Retrieve the rendered height of an element
function getObjectWidth()  {
	var elem = gettrailobjnostyle();

	var result = 0;
	if (elem.offsetWidth) {
			result = elem.offsetWidth;
	} else if (elem.clip && elem.clip.width) {
			result = elem.clip.width;
	} else if (elem.style && elem.style.pixelWidth) {
			result = elem.style.pixelWidth;
	}
	var retVal = parseInt(result);
	return retVal;
}



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

function showtext(text) {

	document.onmousemove=followmouse;
	
	newHTML = '<div class="rolloverHelp">';

	newHTML += '<div align="left">' + text + '</div>';

	gettrailobjnostyle().innerHTML = newHTML;

	gettrailobj().visibility="visible";
	
	getshimobj().visibility="visible";
	getshimobj().display="inline";
	
	getshimobj().width=getObjectWidth();
	getshimobj().height=getObjectHeight();
}


function hidetrail(){
	gettrailobj().visibility="hidden"
	document.onmousemove=""
	gettrailobj().left="-500px"
	
	getshimobj().visibility="hidden";
	getshimobj().display="none";
	getshimobj().left="-500px";

}

function followmouse(e){

	var xcoord=offsetfrommouse[0]
	var ycoord=offsetfrommouse[1]

	var docwidth=document.all? truebody().scrollLeft+truebody().clientWidth : pageXOffset+window.innerWidth-offsetVal
	var docheight=document.all? Math.min(truebody().scrollHeight, truebody().clientHeight) : Math.min(document.body.offsetHeight, window.innerHeight)

	//if (document.all){
	//	gettrailobjnostyle().innerHTML = 'A = ' + truebody().scrollHeight + '<br />B = ' + truebody().clientHeight;
	//} else {
	//	gettrailobjnostyle().innerHTML = 'C = ' + document.body.offsetHeight + '<br />D = ' + window.innerHeight;
	//}
	var hOff = parseInt(200);
	if (typeof e != "undefined"){
		if (docwidth - e.pageX < 300){
			xcoord = e.pageX - xcoord - 286; // Move to the left side of the cursor
		} else {
			xcoord += e.pageX;
		}
		ycoord += e.pageY;

	} else if (typeof window.event != "undefined"){
		if (docwidth - event.clientX < 300){
			xcoord = event.clientX + truebody().scrollLeft - xcoord - 286; // Move to the left side of the cursor
		} else {
			xcoord += truebody().scrollLeft+event.clientX
		}
		ycoord += truebody().scrollTop + event.clientY;
	}

	var docwidth=document.all? truebody().scrollLeft+truebody().clientWidth : pageXOffset+window.innerWidth-offsetVal
	var docheight=document.all? Math.max(truebody().scrollHeight, truebody().clientHeight) : Math.max(document.body.offsetHeight, window.innerHeight)

	getshimobj().left=xcoord+"px";
	getshimobj().top=ycoord+"px";

	gettrailobj().left=xcoord+"px";
	gettrailobj().top=ycoord+"px";
	

}
