/*
Simple Image Trail script- By JavaScriptKit.com
Visit http://www.javascriptkit.com for this script and more
This notice must stay intact
*/

var ua = navigator.userAgent.toLowerCase();   //mio commento
var divheight=0;
var divwidth=0;
var imagetimeout;

if (document.getElementById || document.all)
	document.write('<div id="imtra" style="position:absolute;visibility:hidden;"></div>')

function gettrailobject()
	{
		if (document.getElementById)
		{
			return document.getElementById("imtra")
		}
		else if (document.all)
		{
			return document.all.trailimagid
		}
	}

function gettrailobj()
	{
		if (document.getElementById)
		{
			return document.getElementById("imtra").style
		}
		else if (document.all)
		{
			return document.all.trailimagid.style
		}
	}

function truebody()
	{
	return (!window.opera && document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
	}

function trailOff()
	{
		if (imagetimeout && imagetimeout > 0)
		{
			clearTimeout(imagetimeout);
		}

		document.onmousemove='';
		gettrailobj().visibility="hidden";
	}

function trailOn(imagethumbnail,imagetitle,username,imageid,imagesize,credit,level,thw,thh,smallmedium){     //riga originale

		gettrailobj().left="-700px";
		divthw = parseInt(thw) + 2;
		smthw = parseInt(thw) + 2;
		halfthh = 50;
		halfthh = Math.ceil(parseInt(thh)/2);
		topx = halfthh - 9;
		smthh = parseInt(thh) + 2;
		if (navigator.userAgent.indexOf("Opera")!=-1)
		{
			//gettrailobject().innerHTML = '<div style="background-color: #000000; layer-background-color: #575757; border: 0px none #808080; padding:10px; width:'+divthw+'px;height:100%;z-index:51"><div style="background-color: #FFFFFF; layer-background-color: #FFFFFF;width:'+thw+'px;z-index:51">'+'<div style="border-width:0px;margin:0px;padding:0px;background-color: #ffffff; layer-background-color: #ffffff;z-index:51;position:relative;width:'+thw+'px;height:'+smthh+'px;text-align:center"><img  src="'+imagethumbnail+'"  width="'+smthw+'" height="'+smthh+'" border="0"></div><div style="border-width:0px;margin:0px;padding:0px;z-index:52;position:absolute;width:'+thw+'px;top:'+topx+'px;text-align: center;"><img src=""></div><div style="border-width:0px;margin:0px;padding:0px;z-index:53;position:absolute;width:'+thw+'px;"><div style="border: 1px solid #000000;width:'+thw+'px;"><img name="btcontainer" id="btcontainer" src="" border="0" width="'+thw+'" height="'+thh+'" ><div id="div_2" style="border-width:0px;margin:0px;z-index:53;layer-background-color: #FFFFFF;background-color:#ffffff; padding:3px; font-family: Tahoma, Verdana; font-weight: bold; font-size: 12px;">'+imagetitle+'<br>'+(thw>=233?'<nobr>':'')+(thw>=233?'</nobr>':'')+'<br></div></div></div></div><div style="visibility:hidden"><div style="height:'+thh+'px">&nbsp;</div><div id="div_2" style="padding:3px; font-family: Tahoma, Verdana;">'+imagetitle+'<br>'+(thw>=233?'<nobr>':'')+(thw>=233?'</nobr>':'')+'<br></div></div></div>';
			gettrailobject().innerHTML = '<div style="background-color: #000000; layer-background-color: #575757; border: 0px none #808080; padding:10px; width:'+divthw+'px;z-index:51; float: left;"><div style="background-color: #FFFFFF; layer-background-color: #FFFFFF;width:'+thw+'px;z-index:51; float: left;">'+'<div style="border-width:0px;margin:0px;padding:0px;background-color: #FFFFFF; layer-background-color: #FFFFFF;z-index:51;position:relative;width:'+thw+'px;height:'+smthh+'px;text-align:center;  float: left;"><img  src="'+imagethumbnail+'"  width="'+smthw+'" height="'+smthh+'" border="0"></div><div style="padding: 3px; font-family: Tahoma, Verdana; font-weight: bold; font-size: 12px; background-color: #FFFFFF;">'+imagetitle+'</div></div></div>';
		}
		if (navigator.userAgent.indexOf("Firefox")!=-1 || navigator.userAgent.indexOf("Safari")!=-1)
			gettrailobject().innerHTML = '<div style="background-color: #000000; position: relative; margin-top: 800px; layer-background-color: #575757; border: 0px none #808080; padding:10px; width:'+divthw+'px; z-index:51; float: left; display: block;"><div style="background-color: #FFFFFF; layer-background-color: #FFFFFF;width:'+thw+'px;z-index:51; float: left;">'+'<div style="border-width:0px;margin:0px;padding:0px;background-color: #ffffff; layer-background-color: #ffffff;z-index:51;position:relative;width:'+thw+'px;height:'+smthh+'px;text-align:center; float: left;"><img  src="'+imagethumbnail+'"  width="'+smthw+'" height="'+smthh+'" border="0"></div>          <div id="div_2" style="border-width:0px;margin:0px;z-index:53;layer-background-color: #FFFFFF; background-color:#ffffff; padding:3px; font-family: Tahoma, Verdana; font-weight: bold; font-size: 12px;">'+imagetitle+'</div>            </div></div>';
		if (navigator.userAgent.indexOf("MSIE")!=-1)
			gettrailobject().innerHTML = '<div style="background-color: #000000; layer-background-color: #575757; border: 0px none #808080; padding:10px; width:'+divthw+'px;z-index:51; float: left;"><div style="background-color: #FFFFFF; layer-background-color: #FFFFFF;width:'+thw+'px;z-index:51; float: left;">'+'<div style="border-width:0px;margin:0px;padding:0px;background-color: #FFFFFF; layer-background-color: #FFFFFF;z-index:51;position:relative;width:'+thw+'px;height:'+smthh+'px;text-align:center;  float: left;"><img  src="'+imagethumbnail+'"  width="'+smthw+'" height="'+smthh+'" border="0"></div><div style="padding: 3px; font-family: Tahoma, Verdana; font-weight: bold; font-size: 12px; background-color: #FFFFFF;">'+imagetitle+'</div></div></div>';

		//setTimeOut
		//imagetimeout = setTimeout("iltimeOut('"+imagethumbnail+"')",100);
		gettrailobj().visibility="visible";
		divwidth = parseInt(thw)+25;
		divheight = parseInt(thh)+130;
		document.onmousemove=followmouse;

}

function iltimeOut(imagethumbnailg){
	if (document.getElementById)
		document.getElementById('btcontainer').src = imagethumbnailg;
	else if (document.all)
		document.all.btcontainer.src = imagethumbnailg;

}
function followmouse(e)
	{
	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 < 15+e.pageX+divwidth)
		xcoord = e.pageX-divwidth-5;
	else
		xcoord = 15+e.pageX;
	if(docheight < 15+e.pageY+divheight)
		ycoord = 15+e.pageY-Math.max(0,(divheight + e.pageY - docheight - truebody().scrollTop - 30));
	else
		ycoord = 15+e.pageY;
	}
else if (typeof window.event != "undefined")
	{
	if(docwidth < 15+truebody().scrollLeft+event.clientX+divwidth)
		xcoord = truebody().scrollLeft-5+event.clientX-divwidth;
	else
		xcoord = truebody().scrollLeft+15+event.clientX;

	if(docheight < 15+truebody().scrollTop+event.clientY+divheight)
		ycoord = 15+truebody().scrollTop+event.clientY-Math.max(0,(divheight + event.clientY - docheight - 30));
	else
		ycoord = truebody().scrollTop+15+event.clientY;
	}
	gettrailobj().left=xcoord+"px"
	gettrailobj().top=ycoord+"px"
	}
