function element_bloc(id)
{
    if (!document.getElementById)
        return;

    if (document.all)
        return eval("document.all." + id);
    else
        return document.getElementById(id);
}
function controle(id) {
    element_bloc("bloc" + id).style.display = (element_bloc("bloc" + id).style.display == "none" ? "block" : "none");
}
function menu_show(s){
        document.getElementById("zam"+s).style.visibility="visible";
}
function menu_hide(s){
        document.getElementById("zam"+s).style.visibility="hidden";
}
function menu_item(id){
        document.getElementById(id).style.border='1px solid #86daf9';
        document.getElementById(id).style.background='#c9e7f3';
}
function menu_itemout(id){
        document.getElementById(id).style.border='';
        document.getElementById(id).style.background='';
}

var offsetfrommouse=[25,125];
var displayduration=0;
var currentimageheight = 350;
var timer;

if (document.getElementById || document.all){
	document.write('<div id="trailimageid">');
	document.write('</div>');
}

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
}


function truebody(){
return (!window.opera && document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
}

function showtrail(imagename,title,description){
    i = imagename
    t = title
    d = description
    timer = setTimeout("show('"+i+"',t,d);",200);
}

function show(imagename,title,description){

	document.onmousemove=followmouse;

	newHTML = '<div id="trailimageidContainer">';
	
    
    newHTML = newHTML + '<div class="image">';
    newHTML = newHTML + '<img src="' + imagename + '" border="0"></div>';

	newHTML = newHTML + '</div>';
	gettrailobjnostyle().innerHTML = newHTML;
	gettrailobj().display="inline";
}

function hidetrail(){
	gettrailobj().innerHTML = " ";
	gettrailobj().display="none"
	document.onmousemove=""
	gettrailobj().left="-500px"
    clearTimeout(timer);

}

function followmouse(e){
    
	var xcoord=offsetfrommouse[0]
	var ycoord=offsetfrommouse[1]
    //alert(offsetfrommouse);

	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(docwidth + ' / ' + docheight);
	//if (document.all){
	//	gettrailobjnostyle().innerHTML = 'A = ' + truebody().scrollHeight + '<br>B = ' + truebody().clientHeight;
	//} else {
	//	gettrailobjnostyle().innerHTML = 'C = ' + document.body.offsetHeight + '<br>D = ' + window.innerHeight;
	//}

	if (typeof e != "undefined"){
        //alert(e.pageX);
		if (docwidth - e.pageX < 468){
			xcoord = e.pageX - xcoord - 486; // Move to the left side of the cursor
		} else {
			xcoord += e.pageX;
		}
		if (docheight - e.pageY < (currentimageheight + 110)){
			ycoord += e.pageY - Math.max(0,(110 + currentimageheight + e.pageY - docheight - truebody().scrollTop));
		} else {
			ycoord += e.pageY;
		}

	} else if (typeof window.event != "undefined"){
		if (docwidth - event.clientX < 468){
			xcoord = event.clientX + truebody().scrollLeft - xcoord - 486; // Move to the left side of the cursor
		} else {
			xcoord += truebody().scrollLeft+event.clientX
		}
		if (docheight - event.clientY < (currentimageheight + 110)){
			ycoord += event.clientY + truebody().scrollTop - Math.max(0,(110 + currentimageheight + event.clientY - docheight));
		} else {
			ycoord += truebody().scrollTop + event.clientY;
		}
	}

	if(ycoord < 0) { ycoord = ycoord*-1; }
	gettrailobj().left=xcoord+"px"
	gettrailobj().top=ycoord+"px"

}