// CREATOR : Testimonials

/*
Includes modified showtrail
*/



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

if (document.getElementById || document.all){
	document.write('<div id="testDetail">');
	document.write('</div>');
}

var offsetfrommouse=[15,15]; //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.
var currentimageheight = 500;	// maximum image size.
var heightAdjust = 0;

function gettrailobj(){
if (document.getElementById)
return document.getElementById("testDetail").style
else if (document.all)
return document.all.testDetail.style
}

function gettrailobjnostyle(){
if (document.getElementById)
return document.getElementById("testDetail")
else if (document.all)
return document.all.testDetail
}


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

function showtrail(width,height,hAdjust,testAuthor,authorTitle,clientName,style,testBody,extURL){

	if (height > 0){
		currentimageheight = height;
	}
    heightAdjust = hAdjust;
	document.onmousemove=followmouse;

	newHTML = '<div class="testDetailInner" style="width: "' + width + 'px; height: "' + height + 'px"><div class="testAuthor"><strong>' + testAuthor + '</strong><br />' + authorTitle + '<br /><em>' + clientName + '</em></div>';
	newHTML = newHTML + '<div id="testRightContent">';
	newHTML = newHTML + '<span class="style' + style + '">';
	newHTML = newHTML + testBody;
	newHTML = newHTML + '</span>';
    newHTML = newHTML + '</div>';
	newHTML = newHTML + '<div id="portLink" style="text-align: right"><img src="/images/i/arrow1.gif" alt="link" width="25" height="28" style="vertical-align: middle" title="" />&nbsp;' + extURL + '</div></div>';

//alert (newHTML);

	gettrailobjnostyle().innerHTML = newHTML;
	gettrailobj().display="inline";
}

function hidetrail(){
	gettrailobj().innerHTML = " ";
	gettrailobj().display="none"
	document.onmousemove=""
	gettrailobj().left="-500px"
}

function followmouse(e){

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

	var ScrollTop = 0;

	var docwidth=document.all? truebody().scrollLeft+truebody().clientWidth : pageXOffset+window.innerWidth-15
	var docheight=document.all? Math.min(truebody().scrollHeight, truebody().clientHeight) : Math.min(window.innerHeight)
	
	//alert ("docheight:"+docheight);
	
	if (typeof e != "undefined"){
		if (docwidth - e.pageX < 285){
			xcoord = e.pageX - xcoord - 285; // Move to the left side of the cursor
		} else {
			xcoord += e.pageX;
		}
		
		//alert("doch:"+docheight+"  e.pg:"+e.pageY+"  db.scrollTop:"+document.body.scrollTop+"  de.scrollTop:"+document.documentElement.scrollTop);
		
		if (docheight - e.pageY < (currentimageheight + heightAdjust)){
			
			//recoded here to fix safari 3 truebody().scrollTop bug
			
			ScrollTop = (document.documentElement.scrollTop > ScrollTop) ? document.documentElement.scrollTop : ScrollTop;
			ScrollTop = (document.body.scrollTop > ScrollTop) ? document.body.scrollTop : ScrollTop;
			
			ycoord += e.pageY - Math.max(0,(heightAdjust + currentimageheight + e.pageY - docheight - ScrollTop));
		} else {
			ycoord += e.pageY;
			
			//alert ("e Y:"+ycoord);
		}

	} else if (typeof window.event != "undefined"){
		if (docwidth - event.clientX < 285){
			xcoord = event.clientX + truebody().scrollLeft - xcoord - 285; // Move to the left side of the cursor
		} else {
			xcoord += truebody().scrollLeft+event.clientX
		}
		if (docheight - event.clientY < (currentimageheight + heightAdjust)){
			ycoord += event.clientY + truebody().scrollTop - Math.max(0,(heightAdjust + currentimageheight + event.clientY - docheight));
		} else {
			ycoord += truebody().scrollTop + event.clientY;
		}
		//alert ("w.e Y:"+ycoord);
	}

	var docwidth=document.all? truebody().scrollLeft+truebody().clientWidth : pageXOffset+window.innerWidth-15
	var docheight=document.all? Math.max(truebody().scrollHeight, truebody().clientHeight) : Math.max(document.body.offsetHeight, window.innerHeight)
		if(ycoord < 0) { ycoord = ycoord*-1; }
	gettrailobj().left=xcoord+"px"
	gettrailobj().top=ycoord+"px"
	
	//alert("gettrailobjY:"+gettrailobj().top);

}

