/*
Simple Image Trail script- By JavaScriptKit.com
Visit http://www.javascriptkit.com for this script and more
This notice must stay intact
*/
var asset_host = "www.videocopilot.net";
var offsetfrommouse=[-5,-5] //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" style="position:absolute;visibility:visible;left:0px;top:0px;width:1px;height:1px"><img src="'+trailimage[0]+'" border="0" width="'+trailimage[1]+'px" height="'+trailimage[2]+'px"></div>')
if (document.getElementById || document.all){
	document.write('<div id="trailimageid">');
	document.write('</div>');
}

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

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

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


function showtrail(imagename,type,title,width,height,catid,copyright,description){

	document.onmousemove=followmouse;

	var newHTML = '<table border="0" width="240" cellpadding="3" cellspacing="3">';
	newHTML += '<tr><td width="100%" valign="top">';
	newHTML += '<table class="thin" width="222">';
	newHTML += '<tr><td width="100%"><table border="0" width="100%" cellspacing="0" cellpadding="0">';
	newHTML += '<tr><td width="100%"><p align="center">';

	if(type=='photo'){
		newHTML = newHTML + '<div align="center" style="padding:5px;background:#fff;border:solid 1px #000">';
		newHTML = newHTML + '<img src="' + imagename + '" border="0"">';
		newHTML = newHTML + '</div>';
	}
	if(type=='video') {
	
		var browser=navigator.appName;
		var b_version=navigator.appVersion;
		var version=parseFloat(b_version);
		if ((browser=="Microsoft Internet Explorer") && (version>=4)){
			extra1 = "";
			extra2 = "";
		}else{
			extra1 = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="'+width+'" height="'+height+'">';
			extra2 = '</object>';
		}
		
		temp = '<div style="border:solid 5px #fff;width:'+width+'px;height:'+height+'">'+extra1+'<embed';
		temp += ' type="application/x-shockwave-flash"';
		temp += ' src="http://'+asset_host+'/assets/public/flash/player.swf"';
		
		temp += ' width="'+width+'"';
		temp += ' height="'+height+'"';
		temp += ' allowscriptaccess="sameDomain"';
		temp += ' allowfullscreen="false"';
		temp += ' flashvars=autostart=true&repeat=true&height='+height+'&width='+width+'&file='+imagename+'&searchbar=false&showicons=false&shownavigation=false&showdigits=false&usefullscreen=false"';
		temp += ' />'+extra2+'</div>';

		newHTML += '<div align="center" style="border:solid 1px #000">';
		newHTML += temp;
		newHTML += '</div>';
	
	}	
	
	gettrailobjnostyle().innerHTML = newHTML;

	gettrailobj().visibility="visible";

}

function hidetrail(){
	gettrailobj().visibility="hidden";
	gettrailobjnostyle().innerHTML="";
	document.onmousemove="";
	gettrailobj().left="-500px";
}

function followmouse(e){

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

	if (typeof e != "undefined"){
		xcoord+=e.pageX;
		ycoord+=e.pageY;

	} else if (typeof window.event != "undefined"){
		xcoord+=truebody().scrollLeft+event.clientX;
		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);

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

}
