var ua = navigator.userAgent.toLowerCase();
var divw=0;
var divh=0;

if (document.getElementById || document.all)
	document.write('<div id="imgtrailer" style="position:absolute;visibility:hidden;"></div>')

function gettrailobject()
	{
	if (document.getElementById)
		return document.getElementById("imgtrailer")
	else if (document.all)
		return document.all.trailimagid
	}

function gettrailobj()
	{
	if (document.getElementById)
		return document.getElementById("imgtrailer").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 hidetrail(divid)
	{
        var domid=divid;
      
	document.onmousemove='';
        
	gettrailobj().visibility="hidden";
	}

function trailOnflv(flvplayer,flvfile,thw,thh)
	{
	if(ua.indexOf('opera') == -1 && ua.indexOf('safari') == -1)
		{
		gettrailobj().left="-200px";
		
		divthw="180";		
		gettrailobject().innerHTML = '<table><tr><td><div style="background-color: #FFFFFF; layer-background-color: #FFFFFF; border: 0pt none #FFFFFF; padding: 0pt;height: 225px ; width:300px;" ><div id="player1" style="background-color: #FFFFFF; layer-background-color: #FFFFFF; background-image: url(../../images/img_load.gif); background-repeat: no-repeat;"><center><embed src="'+flvplayer+ '" width="300" height="225" allowscriptaccess="always" allowfullscreen="true" flashvars="file='+flvfile+'&autostart=true&repeat=always&controlbar=none&backcolor=FFFFFF&screencolor=FFFFFF"></embed></center></div></div><div height="10px;"></div></td></tr></table>';
thw="205";
thh="155";

		gettrailobj().visibility="visible";
		divw = parseInt(thw)+2;
		divh = parseInt(thh)+1;
		document.onmousemove=followmouse;
		}
	}
function trailOnImg(thumbimg,imgtitle,imgscription,imgsize,filesize,credit,level,thw,thh)
        {
        if(ua.indexOf('opera') == -1 && ua.indexOf('safari') == -1)
                {
                gettrailobj().left="-500px";
                divthw = parseInt(thw) + 2;
                gettrailobject().innerHTML = '<table><tr><td><div style="background-color: #D8D8D8; layer-background-color: #D8D8D8;  border: 1px solid #000000; padding: 0pt; width:320px; height:165px;"><div style="background-color: #FFFFFF; layer-background-color: #FFFFFF; border-botom: 1px solid #000000;" ><div style="padding:3px">'+imgtitle+'</div><div style="float:left;margin:5px;background-image: url(../../images/ajax-loader.gif); background-repeat: no-repeat;width:125px;border:solid 1px #000;"><img src="'+thumbimg+'" border="0"></div><div style="float:left;padding:3px;word-wrap: break-word;width:175px;">'+imgscription+'</div></div></div></td></tr></table>';
                gettrailobj().visibility="visible";
                divw = parseInt(thw)+25;
                divh = parseInt(thh)+130;
                document.onmousemove=followmouse;
                }
        }


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+divw)
		xcoord = e.pageX-divw-5;
	else
		xcoord = 15+e.pageX;
	if(docheight < 15+e.pageY+divh)
		ycoord = 15+e.pageY-Math.max(0,(divh + e.pageY - docheight - truebody().scrollTop - 30));
	else
		ycoord = 15+e.pageY;
	}
else if (typeof window.event != "undefined")
	{
	if(docwidth < 15+truebody().scrollLeft+event.clientX+divw)
		xcoord = truebody().scrollLeft-5+event.clientX-divw;
	else
		xcoord = truebody().scrollLeft+15+event.clientX;

	if(docheight < 15+truebody().scrollTop+event.clientY+divh)
		ycoord = 15+truebody().scrollTop+event.clientY-Math.max(0,(divh + event.clientY - docheight - 30));
	else
		ycoord = truebody().scrollTop+15+event.clientY;
	}
	gettrailobj().left=xcoord+"px"
	gettrailobj().top=ycoord+"px"
	}
