
function popup(url, w, h) {

	window.open(url,"","width="+ w +",height="+ h +",scrollbars=yes,toolbar=no,location=no,directories=no,status=no,resizable=yes,copyhistory=no");
}

// alterne images
function Alterneur(id, time, prefix, suffix) {
	this.id = id;
	this.time = time;
	this.n = 1;
	this.prefix = prefix;
	this.suffix = suffix;
}

var alt;

function alterne(id, time, prefix, suffix) {
	alt = new Alterneur(id, time, prefix, suffix);
	alterne2();
}

function alterne2() {
	document.getElementById(alt.id).setAttribute("src", alt.prefix + alt.n + alt.suffix);
	alt.n = alt.n%2 + 1;
	setTimeout("alterne2()", alt.time * 1000);
}
// alterne images


function getFileName(path) {
	
	var lastslash = path.lastIndexOf('/');
	var lastantislash = path.lastIndexOf('\\');

	var lastsep = (lastslash>lastantislash)?lastslash:lastantislash;

	return path.substring(lastsep+1,path.length);		
}


function trim(str) {
	
	var i = 0;
  var lg = str.length;
	var j = lg-1;

  while (i<lg && ((str.charCodeAt(i)==9) || (str.charCodeAt(i)==10) || (str.charCodeAt(i)==13) || (str.charCodeAt(i)==32))) {
	  i++;
	}

  while (j>i && ((str.charCodeAt(j)==9) || (str.charCodeAt(j)==10) || (str.charCodeAt(j)==13) || (str.charCodeAt(j)==32))) {
	  j--;
	}

	return str.substring(i,j+1);
}


function reptrim(element) {
	element.value = trim(element.value);
}


function urlEncode(strText) {
  return escape(strText);
}

function confirmNewsLetter() {
	if (isEmail(document.getElementById('EmailNews').value)){
		return window.confirm("Confirmez-vous votre inscription \u00E0 notre newsletter ?");
	} else {
		alert ("Votre email est invalide.");
		return false;
	}
}

function prepareRecherche() {
	str = document.getElementById('MotsCles').value;
	str2 = "";
	for(i=0; i<str.length; i++) {
		str2 = str2 + ((str.charAt(i)==' ')?",":str.charAt(i));
	}
	document.getElementById('MotsCles').value = str2;
}


img0=new Image(); img0.src="images/horloge/img0.bmp"
img1=new Image(); img1.src="images/horloge/img1.bmp"
img2=new Image(); img2.src="images/horloge/img2.bmp"
img3=new Image(); img3.src="images/horloge/img3.bmp"
img4=new Image(); img4.src="images/horloge/img4.bmp"
img5=new Image(); img5.src="images/horloge/img5.bmp"
img6=new Image(); img6.src="images/horloge/img6.bmp"
img7=new Image(); img7.src="images/horloge/img7.bmp"
img8=new Image(); img8.src="images/horloge/img8.bmp"
img9=new Image(); img9.src="images/horloge/img9.bmp"

function horloge(){
today = new Date();
heure = today.getHours();
minute = today.getMinutes();
seconde = today.getSeconds();
h1 = Math.floor(heure / 10);
h2 = heure - (10 * h1);
m1 = Math.floor(minute / 10);
m2 = minute - (10 * m1);
s1 = Math.floor(seconde / 10);
s2 = seconde - (10 * s1);
document.images.ih1.src=eval("img"+h1+".src")
document.images.ih2.src=eval("img"+h2+".src")
document.images.im1.src=eval("img"+m1+".src")
document.images.im2.src=eval("img"+m2+".src")
document.images.is1.src=eval("img"+s1+".src")
document.images.is2.src=eval("img"+s2+".src")
window.setTimeout("horloge();", 100)
}


