//Positie tooltip vanuit cursor
var offsetfrommouse=[-228,-135];

//duration in seconds image should remain visible. 0 for always.
var displayduration=0;

// maximum image size.
var currentimageheight = 1100;

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(object,popupimage,popupvestiging,popuptitel,popupinleiding){

	var id = $(object).attr('id');
	var active = $(object).parents('.mainitem').hasClass('active');

	if(active)
	{
		return;
	}

	document.onmousemove=followmouse;



	//hoogte,breedte van de animatie.
	var width = 244;
	var height = 132;

	//Hier wordt de html voor de tooltip opgebouwd.
	var newHTML = '';
	var browser=navigator.appName;
	var b_version=navigator.appVersion;
	var version=parseFloat(b_version);

	temp = 	'<div style="width:'+width+'px;height:'+height+';" id="popup" class="'+popupvestiging+'">'
	+'			<img src="'+popupimage+'" width="114" height="114" />'
	+'			<span class="text">'
	+'				<span class="vestiging">'+popupvestiging+'</span>'
	+'				<span class="titel">'+popuptitel+'</span>'
	+'				<span class="inleiding">'+popupinleiding+'</span>'
	+'			</span>'
	+'		</div>';

	newHTML = newHTML += temp;

	gettrailobjnostyle().innerHTML = newHTML;
}


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+"px"
	gettrailobj().top=ycoord+"px"
	gettrailobj().visibility="visible";
}
