	/*
	onmouseover="javascript: showtrail('../visuels/php877XFm.jpg,../visuels/phpupZ49g.jpg,../visuels/phpLQm6jb.jpg,../visuels/php3nE4Xe.jpg,../visuels/phpZqeiu5.jpg');" onmouseout="javascript: hidetrail();"
	*/
	
	
	var secs = 1;
	var timerID = null;
	var timerRunning = false;
	var delay = 500;

	var theImages = new Array();

	var currentImage = -1;
	var maxImages = -1;
	//var trailimage = [theImages[currentImage], 376, 376];

	var trailimage = ["", 376, 376];
	var offsetfrommouse = [10,10];
	var currentimagewidth = 400;
	var currentimageheight = 400;
	var firstFlag = false;
	var userAgent = "0";


	if (document.getElementById || document.all) {
						userAgent = navigator.userAgent;
						
							if(userAgent.indexOf("MSIE") > 0) {
							userAgent = parseInt(userAgent.substring(userAgent.indexOf("MSIE") + 5, userAgent.indexOf("MSIE") + 8));
						} else {
							userAgent = "0";
						}

						if(userAgent == "5" || userAgent == "6") {
							document.write('<div id="trail_image" style="position:absolute;visibility:hidden;left:-386px;top:0px;"><img id="imageid" src="'+trailimage[0]+'" border="0" style="position: absolute; left: 5px; top: 5px;border:5px solid #ddd;z-index:999; "></div>');
						}
			
						if(userAgent == "7") {
					document.write('<div id="trail_image" style="position:absolute;visibility:hidden;left:-386px;top:0px;"><img id="imageid" src="'+trailimage[0]+'" border="0" style="position: absolute; left: 5px; top: 5pxborder:5px solid #ddd;;z-index:999; "></div>');
		
						}		
		else {
			document.write('<div id="trail_image" style="position: absolute; visibility: hidden; left: -386px; top: 250px;  ">');
			document.write('<img id="imageid" src="' + trailimage[0] + '" border="0" style="border:5px solid #ddd;" >');
			document.write('</div>');

		}
	}
	
	function gettrailobj() {
		if (document.getElementById) {
			if(theImages.length > 0) {
				
				return document.getElementById("trail_image").style;
			} else {
				
				return document.getElementById("trail_video").style;
			}
		} else if (document.all) {
			if(theImages.length > 0) {
		
				return document.all.trail_image.style;
			} else {
				
				return document.all.trail_video.style;
			}
		}
	}

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

	function showtrail(sURLs) {
var widthMax = 350;
		
		sURLs = 'http://www.cameleons.com/images/loadingv2.gif,' + sURLs;
		theImages = sURLs.split(",");
		currentImage = -1;
		maxImages = theImages.length - 1;
		
		if(maxImages > 4) {
			maxImages = 4;
		}
		for(i = 0; i <= maxImages; i++) {
			x = theImages[i];
			theImages[i] = new Image(376, 376);
			theImages[i].src = x;

/*
//alert(x+"#"+strpos(x,'loading',0));
			if( strpos(x,'loading',0) != false){
		 	var widthMax = 100;
//alert('true'+widthMax);
			//gettrailobj().style.width = 350;
			}else{
//alert('false'+widthMax);
			var widthMax = 350;
			}
*/

			
		}
    document.getElementById("imageid").src = theImages[0].src;
//alert(strpos(document.getElementById("imageid").src, 'loading'));
//if( strpos(document.getElementById("imageid").src,'loading',0) > 0){
		 document.getElementById("imageid").style.width = widthMax;
	//gettrailobj().style.width = 350;
//}else{
//document.getElementById("imageid").width = 350;
//}


		document.onmousemove = followmouse;
		InitializeTimer();

	}

	

	function hidetrail(){
		gettrailobj().visibility = "hidden";
		document.onmousemove = "";
        //document.getElementById("imageid").src = "/images/blank_image.jpg";
		StopTheClock();	
	}



function followmouse(e){
		var xcoord=offsetfrommouse[0]
		var ycoord=offsetfrommouse[1]
	
		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)
	
 if (typeof( window.addEventListener ) != "undefined" ) 
    {//ff
        if (docwidth - e.pageX < 650){
				xcoord = e.pageX - xcoord - 650; // gauche du curseur
			} else {
				xcoord += e.pageX-150;
			}
			if (docheight - e.pageY < (currentimageheight + 20)){
				ycoord += e.pageY - Math.max(0,(20 + currentimageheight + e.pageY - docheight - truebody().scrollTop))-300;
			} else {
				ycoord += e.pageY-200;
			}
    } 
    else 
    {//ie
       if (docwidth - event.clientX < 688){
				xcoord = event.clientX + truebody().scrollLeft - xcoord - 650; // gauche du curseur
			} else {
				xcoord += truebody().scrollLeft+event.clientX-250
			}
			if (docheight - event.clientY < (currentimageheight + 20)){
				ycoord += event.clientY + truebody().scrollTop - Math.max(0,(20 + currentimageheight + event.clientY - docheight))-150;
			} else {
				ycoord += truebody().scrollTop + event.clientY-150;
			}
    }
	
		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)
			if(ycoord < 0) { ycoord = ycoord*-1; }
		
		gettrailobj().left=xcoord+"px"
		gettrailobj().top=ycoord+"px"

//if(strpos(gettrailobj().src, 'loading') < 0){
		//gettrailobj().width = 350;
	//gettrailobj().style.width = 350;
//}

		//document.getElementById("debug").innerHTML = xcoord + ' ' + ycoord;



	}


	
	function InitializeTimer() {
	    StopTheClock();
	    StartTheTimer();
	}
	
	function StopTheClock() {
	    if(timerRunning) {
	        clearTimeout(timerID);
		}
    	timerRunning = false;
	}
	
function strpos( haystack, needle, offset){
    var i = haystack.indexOf( needle, offset ); // returns -1
    return i >= 0 ? i : false;
}

	function StartTheTimer() {
	    if (secs == 0) {
	    	if(timerRunning == false){
	    		firstFlag = true;
	    	}
	        StopTheClock();
	        currentImage++;
	        if(currentImage > maxImages) {
	        	currentImage = 0;
	        }
	        document.getElementById("imageid").src = theImages[currentImage].src;
			gettrailobj().visibility = "visible";
			
			if(firstFlag) {
				secs = 2;
			} else {
				secs = 1.5;
			}
	        StartTheTimer();
	    } else {
	        self.status = secs;
	        secs = secs - 0.5;
	        timerRunning = true;
	        timerID = self.setTimeout("StartTheTimer()", delay);
	    }
	}


