// JavaScript Document

function disp(txt) {document.write(txt);}
function don_date_maj()
	{var date_maj=new Date(document.lastModified);
	date_maj=don_date_format(date_maj);
	return date_maj;}
function don_date_jour()
	{var date_jour=new Date();
	date_jour=don_date_format(date_jour);
	return date_jour;}
function don_date_format(d1) {
	var m=new Array(13);
	m[1]="Janvier"; m[2]="Février";	m[3]="Mars"; m[4]="Avril"; m[5]="Mai"; m[6]="Juin";
 	m[7]="Juillet";	m[8]="Aout"; m[9]="Septembre"; m[10]="Octobre";	m[11]="Novembre"; m[12]="Décembre";
	var d=new Array(8);
	d[1]="Dimanche"; d[2]="Lundi"; d[3]="Mardi"; d[4]="Mercredi"; d[5]="Jeudi"; d[6]="Vendredi"; d[7]="Samedi";
	var mois=m[d1.getMonth()+1];
	var jour=d[d1.getDay()+1];
	var date=d1.getDate();
	var an=d1.getYear();
	if (an<200) an=1900+an;
	date=jour+" "+date+" "+mois+" "+an;
	return date;
	}
	
var old_sec=0;
var old_min=0;
var old_heure=0;
function disp(txt) {document.write(txt);}
function dispLayer(x,y,nom,indice) {
	var aff=indice; if (indice<10) {aff="0"+indice;}
	if (document.layers) {
		if(nom=="min" || nom=="heure"){
			disp("<LAYER name='"+nom+indice+"' top="+y+" left="+x+"' visibility='hide'>");
			disp("<FONT size='-1' face='verdana'>"+aff+":</FONT>");
			disp("</LAYER>");
		}
		else {
			disp("<LAYER name='"+nom+indice+"' top="+y+" left="+x+"' visibility='hide'>");
			disp("<FONT size='-1' face='verdana'>"+aff+"</FONT>");
			disp("</LAYER>");
		}
	}
	if (document.all) {
	if(nom=="min" || nom=="heure"){
			disp("<DIV id='"+nom+indice+"' style='position:absolute;top:"+y+";left:"+x+";visibility:hidden'>");
			disp("<FONT size='-1' face='verdana'>"+aff+":</FONT>");
			disp("</DIV>");
		}
		else {
			disp("<DIV id='"+nom+indice+"' style='position:absolute;top:"+y+";left:"+x+";visibility:hidden'>");
			disp("<FONT size='-1' face='verdana'>"+aff+"</FONT>");
			disp("</DIV>");
		}
	}
	
	

}

function InitHorloge(x,y) {
	for (var i=0;i<60;i++) {
		dispLayer(x+40,y,"sec",i);
		dispLayer(x+20,y,"min",i);
	}
	for(i=0;i<24;i++) {
		dispLayer(x,y,"heure",i);
	}
	Heure();
}

function Heure() {
	var d=new Date;
	var sec=d.getSeconds();
	var min=d.getMinutes();
	var heure=d.getHours();
	if (document.layers) {
		document.layers["sec"+sec].visibility="show";
		document.layers["min"+min].visibility="show";
		document.layers["heure"+heure].visibility="show";
		if (old_sec!=sec) {document.layers["sec"+old_sec].visibility="hide"; old_sec=sec;	}
		if (old_min!=min) {document.layers["min"+old_min].visibility="hide"; old_min=min;	}
		if (old_heure!=heure) {document.layers["heure"+old_heure].visibility="hide"; old_heure=heure;}
	}
	if (document.all) {
		document.all["sec"+sec].style.visibility="visible";
		document.all["min"+min].style.visibility="visible";
		document.all["heure"+heure].style.visibility="visible";
		if (old_sec!=sec) {document.all["sec"+old_sec].style.visibility="hidden"; old_sec=sec;	}
		if (old_min!=min) {document.all["min"+old_min].style.visibility="hidden"; old_min=min;	}
		if (old_heure!=heure) {document.all["heure"+old_heure].style.visibility="hidden"; old_heure=heure;}
	}
	setTimeout("Heure()",1000);
}


// valide le formulaire de telechargement
function test()
{
	//alert("salut !! ");  || (document.mail.ques2.value == "true") && (document.mail.ques3.value == "true") && (document.mail.ques4.value == "true") && (document.mail.ques5.value == "true") && (document.mail.ques6.value == "true")
	if ((document.form1.coch1.checked == true) && (document.form1.agence.value != "") && (document.form1.ville.value != "") && (document.form1.nom.value != "") && (document.form1.dep.value != "") ) {
		document.form1.submit();
	}
	else
		alert("Vous devez cocher la case et remplir le formulaire avec votre Nom, Agence, Département et Ville");
}



// verifie les champs d'un formulaire
function champok(nform)
{
if (document.getElementById(nform).nom.value.length == 0){alert("Le nom est obligatoire, Merci");return false;}

if (nform=="assistform"){
	if (document.getElementById(nform).agence.value.length == 0){alert("Le nom de l'agence est obligatoire, Merci");return false;}
}

if (document.getElementById(nform).ville.value.length == 0){alert("La ville est obligatoire, Merci");return false;}
if (document.getElementById(nform).dep.value.length == 0){alert("Le département est obligatoire, Merci");return false;}
if (document.getElementById(nform).pays.value.length == 0){alert("Le pays est obligatoire, Merci");return false;}
if (document.getElementById(nform).tel.value.length == 0){alert("Le téléphone est obligatoire, Merci");return false;}
if (nform != "assistform"){
	if (document.getElementById(nform).mail.value.length == 0){alert("L'email est obligatoire, Merci");return false;}
	email=document.getElementById(nform).mail.value;
	a = email.indexOf("@");
	if ( a == -1 ) {alert("Il y a une erreur dans l'email"); return false;}
	p = email.indexOf(".", a);
	if ( p == -1 ) {alert("Il y a une erreur dans l'email"); return false;} 
}

if (nform=="parrain"){
	if (document.getElementById(nform).nom2.value.length == 0){alert("Le nom est obligatoire, Merci");return false;}
	if (document.getElementById(nform).ville2.value.length == 0){alert("La ville est obligatoire, Merci");return false;}
	if (document.getElementById(nform).dep2.value.length == 0){alert("Le département est obligatoire, Merci");return false;}
	if (document.getElementById(nform).pays2.value.length == 0){alert("Le pays est obligatoire, Merci");return false;}
	if (document.getElementById(nform).tel2.value.length == 0){alert("Le téléphone est obligatoire, Merci");return false;}
	if (nform != "assistform"){
		if (document.getElementById(nform).mail2.value.length == 0){alert("L'email est obligatoire, Merci");return false;}
		email=document.getElementById(nform).mail2.value;
		a = email.indexOf("@");
		if ( a == -1 ) {alert("Il y a une erreur dans l'email"); return false;}
		p = email.indexOf(".");
		if ( p == -1 ) {alert("Il y a une erreur dans l'email"); return false;} 
	}
}


document.getElementById(nform).submit();
}



//Change la page html dans l'iframe
function iframe_dsp(page,krispols) {
	document.getElementById("central").src=page;
	document.getElementById("central").scrolling=krispols;
}


// change l'image temoin
function change_tem(imgname) {
	newimg="images/"+imgname+".jpg"
	document.imgtem.src=newimg;
}


//ouverture d'une popup
function popupopen(page){
	page=page+".html";
	window.open(page,'Connaître','width=400,height=400');
}



//ajoute la page aux favoris
function addfav(){
window.external.AddFavorite(location.href, document.title);
}
