/*
Simple Image Trail script- By JavaScriptKit.com
Visit http://www.javascriptkit.com for this script and more
This notice must stay intact
*/

var ua = navigator.userAgent.toLowerCase();
var divw=0;
var divh=0;
var xto;

if (document.getElementById || document.all)
	document.write('<div id="imgtrailer" style="position:absolute;visibility:hidden;z-index:121;"></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 trailOff()
{
		if (xto && xto > 0)
		{
			clearTimeout(xto);
		}

		document.onmousemove='';
		gettrailobj().visibility="hidden";
}

function trailOn(thumbimg, largeur, hauteur, imgl, imgh){
		if (imgl && imgh)
		{ imagesize = 'style="width:'+imgl+'px;height:'+imgh+'px;"'; }
		else
		{ imagesize = ''; }
		
		gettrailobj().left="-500px";
		largeurdiv = largeur;
		divw = largeurdiv + 20;
		hauteurdiv = hauteur;
		divh = hauteurdiv + 20;
		gettrailobject().innerHTML = '<div style="background-color: black; layer-background-color: black; border: 1px solid black; width:'+largeurdiv+'px;height:'+hauteurdiv+'px;z-index:122"><img src="'+thumbimg+'" '+imagesize+' id="btcontainer" alt="apercu" title="apercu" /></div>';
		//setTimeOut
		xto = setTimeout("xtimeOut('"+thumbimg+"')",100);
		gettrailobj().visibility="visible";
		document.onmousemove=followmouse;

}

function xtimeOut(thumbimgg){
	if (document.getElementById)
		document.getElementById('btcontainer').src = thumbimgg;
	else if (document.all)
		document.all.btcontainer.src = thumbimgg;

}
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 < 20+e.clientX+divw)
			xcoord = e.clientX-divw-10;
		else
			xcoord = 20+e.clientX;
		//alert(docheight +'<'+(eclientY+divh));
		if(docheight < e.clientY+divh)
		{
			ycoord = window.pageYOffset+ (docheight - divh);
		}
		else
		{
			ycoord = window.pageYOffset + e.clientY - Math.max(0,(divh + e.clientY - docheight - truebody().scrollTop - 40));
		}
	}
	else if (typeof window.event != "undefined")
	{
		if(docwidth < 20+truebody().scrollLeft+event.clientX+divw)
			xcoord = truebody().scrollLeft-10+event.clientX-divw;
		else
			xcoord = truebody().scrollLeft+20+event.clientX;
		//alert(docheight +'<'+(event.clientY+divh));
		if(docheight < (event.clientY + divh))
		{
			//Position en bas
			ycoord = truebody().scrollTop + (docheight - divh);
		}
		else
		{
			//Suivi souris en hauteur
			ycoord = truebody().scrollTop + event.clientY - Math.max(0,(divh + event.clientY - docheight - 40));
		}
	}
	gettrailobj().left=xcoord+"px"
	gettrailobj().top=ycoord+"px"
}


var expDays = 30;
var exp = new Date(); 
exp.setTime(exp.getTime() + (expDays*24*60*60*1000));

function When(info){
	// When
	    	var rightNow = new Date()
		var WWHTime = 0;
		WWHTime = GetCookie('WWhenH')
		
		WWHTime = WWHTime * 1

		var lastHereFormatting = new Date(WWHTime);  // Date-i-fy that number
	        var intLastVisit = (lastHereFormatting.getYear() * 10000)+(lastHereFormatting.getMonth() * 100) + lastHereFormatting.getDate()
	        var lastHereInDateFormat = "" + lastHereFormatting;  // Gotta use substring functions
	        var dayOfWeek = lastHereInDateFormat.substring(0,3)
	        var dateMonth = lastHereInDateFormat.substring(4,10)
		var hours = "" + lastHereFormatting.getHours()
		var year = lastHereFormatting.getYear()
                if (year < 1000) year+=1900
		var minutes = "" + lastHereFormatting.getMinutes()
		if (minutes.substring(0,1) == minutes){
			minutes = "0" + minutes
		}
	        var WWHText = dayOfWeek + ", " + dateMonth + " " + year + " à " +  hours + ":" + minutes// display
	
		SetCookie ("WWhenH", rightNow.getTime(), exp)

	return WWHText;
}

function Count(info){
	var psj=0;
	// How many times
		var WWHCount = GetCookie('WWHCount')
		if (WWHCount == null) {
			WWHCount = 0;
		}
		else{
			WWHCount++;
		}
		SetCookie ('WWHCount', WWHCount, exp);


	return WWHCount+1;
}



function set(){
//	VisitorName = prompt("Who are you?", "Nada");
//	SetCookie ('VisitorName', VisitorName, exp);
	SetCookie ('WWHCount', 0, exp);
	SetCookie ('WWhenH', 0, exp);
}

function getCookieVal (offset) {  
	var endstr = document.cookie.indexOf (";", offset);  
	if (endstr == -1)    
		endstr = document.cookie.length;  
		return unescape(document.cookie.substring(offset, endstr));
}

function GetCookie (name) {  
	var arg = name + "=";  
	var alen = arg.length;  
	var clen = document.cookie.length;  
	var i = 0;  
	while (i < clen) {    
	var j = i + alen;    
	if (document.cookie.substring(i, j) == arg)      
		return getCookieVal (j);    
		i = document.cookie.indexOf(" ", i) + 1;    
		if (i == 0) break;   
	}  
	return null;
}

function SetCookie (name, value) {  
	var argv = SetCookie.arguments;  
	var argc = SetCookie.arguments.length;  
	var expires = (argc > 2) ? argv[2] : null;  
	var path = (argc > 3) ? argv[3] : null;  
	var domain = (argc > 4) ? argv[4] : null;  
	var secure = (argc > 5) ? argv[5] : false;  
	document.cookie = name + "=" + escape (value) + 
	((expires == null) ? "" : ("; expires=" + expires.toGMTString())) + 
	((path == null) ? "" : ("; path=" + path)) +  
	((domain == null) ? "" : ("; domain=" + domain)) +    
	((secure == true) ? "; secure" : "");
}

function DeleteCookie (name) {  
	var exp = new Date();  
	exp.setTime (exp.getTime() - 1);  
	// This cookie is history  
	var cval = GetCookie (name);  
	document.cookie = name + "=" + cval + "; expires=" + exp.toGMTString();

}




function VersionNavigateur(Netscape, Explorer) {
  if ((navigator.appVersion.substring(0,3) >= Netscape && navigator.appName == 'Netscape') ||      
      (navigator.appVersion.substring(0,3) >= Explorer && navigator.appName.substring(0,9) == 'Microsoft'))
    return true;
else return false;
}
function Semaine(){
           this[0] = "Dimanche";  this[1] = "Lundi";
           this[2] = "Mardi";     this[3] = "Mercredi";
           this[4] = "Jeudi";     this[5] = "Vendredi";
           this[6] = "Samedi";
           }

function Mois(){
           this[0] = "Janvier";    this[1] = "Février";
           this[2] = "Mars";       this[3] = "Avril";
           this[4] = "Mai";        this[5] = "Juin";
           this[6] = "Juillet";    this[7] = "Août";
           this[8] = "Septembre";  this[9] = "Octobre";
           this[10] = "Novembre";  this[11] = "Décembre";
           }
today = new Date;
function date(){
        var semaine=new Semaine();
        var mois=new Mois();
        var myDate=new Date();
        annee = today.getFullYear();
  

        var result=semaine[myDate.getDay()]+" "+myDate.getDate()+" "+mois[myDate.getMonth()]+" "+annee;
        document.writeln(result);
    }
        function openWin( windowURL, windowName, windowFeatures ) { 
                return window.open( windowURL, windowName, windowFeatures ) ; 
        }
		


		
		
		
		
		
		
		
		
		
		
function affiche_avis(i,nbpage) {
		for(j=1;j<=nbpage;j++){
			document.getElementById('avis'+j).style.display = 'none';
			document.getElementById('num_page'+j).style.background = '#3f7d7c';
			document.getElementById('avis2'+j).style.color = 'white';
		}
		document.getElementById('avis'+i).style.display = 'block';
		document.getElementById('num_page'+i).style.background = 'white';
		document.getElementById('avis2'+i).style.color = '#3f7d7c';
		document.getElementById('num_page'+i).style.border = '1px solid #3f7d7c';
	}


	function deposer_avis() {
		if (document.getElementById('avis_revue').style.display == "none") {
			document.getElementById('avis_revue').style.display = "block";
		} else {
			document.getElementById('avis_revue').style.display = "none";
		}
	}
	function onclean1() {
		if (document.formavis.pseudo.value == "Votre pseudo") {
			document.formavis.pseudo.value = "";
		}
		if (document.formavis.commentaire.value == "") {
			document.formavis.commentaire.value = "Votre message";
		}
	}
	function onclean2() {
		if (document.formavis.commentaire.value == "Votre message") { document.formavis.commentaire.value = ""; }
		if (document.formavis.pseudo.value == "") { document.formavis.pseudo.value = "Votre pseudo"; }
	}
	function onclean3() {
		if (document.formavis.spam.value == "Code Antispam") {
			document.formavis.spam.value = "";
		}
	}
	function valider_avis() {
		if (document.formavis.pseudo.value == "") {
			alert("Merci de renseigner votre pseudo");
			document.formavis.pseudo.focus();
			return;
		}
		if (document.formavis.pseudo.value == "Votre pseudo") {
			alert("Merci de renseigner votre pseudo");
			document.formavis.pseudo.select();
			document.formavis.pseudo.focus();
			return;
		}
		
		if (document.formavis.note.value == "0") {
			alert("Merci de préciser votre journal");
			document.formavis.note.focus();
			return;
		}
		
		if (document.formavis.commentaire.value == "") {
			alert("Merci d'écrire votre message");
			document.formavis.commentaire.focus();
			return;
		}
		if (document.formavis.commentaire.value == "Votre message") {
			alert("Merci d'écrire votre message");
			document.formavis.commentaire.select();
			document.formavis.commentaire.focus();
			return;
		}
		if (document.formavis.commentaire.value.length > 50000) {
			alert("Votre message ne peut pas dépasser 50001 caractères.");
			document.formavis.commentaire.select();
			document.formavis.commentaire.focus();
			return;
		}
		if (document.formavis.spam.value == "") {
			alert("Merci de recopier les chiffres antispam");
			document.formavis.spam.focus();
			return;
		}
		if (document.formavis.spam.value != "650"){ 
			alert("Erreur du code antispam"); 
			document.formavis.spam.focus(); 
			document.formavis.spam.select(); 
			return; 
		}
		document.formavis.submit();
	}