
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 = 270;	// maximum image size.		
	//if (document.getElementById || document.all)
	//{
	//	document.write('<div id="trailimageid">');
	//	document.write('</div>');
	//	var i=document.getElementById("trailimageid");
	//	  i.className="MyDiv";
//	} 

function showBigImage(imageName)
	{
		window.open('ImageViewer.aspx?i='+imageName,'','scrollbars=yes,width=750,height=650');
	}
	function showDivImage(imageName)
	{	
		var i=document.getElementById("trailimageid");
	    i.className="MyDiv";	
	    	
		document.onmousemove=followmouse;				
		
		cameraHTML = '';
		
		newHTML = '<div style="padding: 5px; background-color: #FFF; border: 1px solid #888; font: normal 11px verdana,arial">';
		newHTML = newHTML + '<div  align="center" style="padding: 2px 2px 2px 2px;">';
		newHTML = newHTML + '<img src="' + imageName + '" border="0" >' //</div>';
	
		newHTML = newHTML + '</div>';
		gettrailobjnostyle().innerHTML = newHTML;
		gettrailobj().display= "inline";


}
function showDivImageWSize(imageName) {
    var i = document.getElementById("trailimageid");
    i.className = "MyDiv";

    document.onmousemove = followmouse;

    cameraHTML = '';

    newHTML = '<div style="padding: 5px; background-color: #FFF; border: 1px solid #888; font: normal 11px verdana,arial">';
    newHTML = newHTML + '<div  align="center" style="padding: 2px 2px 2px 2px;">';
    newHTML = newHTML + '<img height="250" width="250" src="' + imageName + '" border="0" >' //</div>';

    newHTML = newHTML + '</div>';
    gettrailobjnostyle().innerHTML = newHTML;
    gettrailobj().display = "inline";


}	
	function hidetrail()
	{
	gettrailobj().innerHTML = " ";
	gettrailobj().display="none"
	document.onmousemove=positiontip;
	document.onmousemove=""
	gettrailobj().left="-500px"
	}
	function truebody()
	{
	return (!window.opera && document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
	}
	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(window.innerHeight)
	
		//alert(xcoord);
		//alert(ycoord);
		//alert(docwidth);
		//alert(docheight);
		
	if (typeof e != "undefined"){
		if (docwidth - e.pageX < 380){
		//alert('if1');
			xcoord = e.pageX - xcoord - 190; // Move to the left side of the cursor
		} else {
		//alert('else1');
			xcoord += e.pageX;
		}
		if (docheight - e.pageY < (currentimageheight + 110)){
		//alert('if2');
			ycoord += e.pageY - Math.max(0,(110 + currentimageheight + e.pageY - docheight - truebody().scrollTop));
		} else {
		//alert('else2');
			ycoord += e.pageY;
		}
		//alert(xcoord);
		//alert( ycoord);

	} 
	else if (typeof window.event != "undefined")
	{
		//alert(event.clientX);
		//alert(event.clientY);
		
		if (docwidth - event.clientX < 380){
		//alert('if3');
			xcoord = event.clientX + truebody().scrollLeft - xcoord - 190; // Move to the left side of the cursor
		} else {
		//alert('else3');
			xcoord += truebody().scrollLeft+event.clientX
		}
		if (docheight - event.clientY < (currentimageheight + 110))
		{
			//alert('if4');
			ycoord += event.clientY + truebody().scrollTop - Math.max(0,(110 + currentimageheight + event.clientY - docheight));
		} 
		else 
		{
			//alert('else4');
			ycoord += truebody().scrollTop + event.clientY;
			
		}
	}
			
	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"		

}
	

	function gettrailobj()
	{		
		if (document.getElementById)
		return document.getElementById("trailimageid").style
		else if (document.all)
		return document.all.trailimagid.style
	}
	function gettrailobjnostyle()
	{	
		if (document.getElementById)
		return document.getElementById("trailimageid")
		else if (document.all)
		return document.all.trailimagid
	}
