//FONCTION qui redimensionne la hauteur de la cellule qui contient les pointillés verticaux car on ne sait pas à l'avance
//QUELLE TAILLE va faire la case et ça pose des pb de mise en page sinon!
function resize() {
	if (ie) {
		document.getElementById("colonneD").style.height = (document.getElementById("colonneE").offsetHeight+19)+"px";
	}
	else {
		if (location.href.indexOf("lucca-philosophie")!=-1)
			document.getElementById("colonneD").style.height = window.document.body.scrollHeight-120+"px";
		else
			document.getElementById("colonneD").style.height = window.document.body.scrollHeight-100+"px";
		document.getElementById("colonneD").style.top = 61+"px";
	}
}

//FONCTION qui calcule l'économie générée dans la FAQ (version FR)
function ce() {
	var ida = document.getElementById("a");
	var idb = document.getElementById("b");
	var idc = document.getElementById("c");
	var idd = document.getElementById("d");
	var ide = document.getElementById("e");
	if (ida&&idb&&idc&&idd&&ide) {
		ide.value = Math.round(ida.value*idb.value*(idc.value/20)*(3/2)*idd.value.replace(",", ".")/100);
	}
}

function pop2(objet,msg,bak) {
	var content ="<TABLE class=\"concurrent\" ID=\"popTable\" BORDER=1 CLASS=aide CELLPADDING=2 CELLSPACING=0 BGCOLOR="+bak+"><TR><TD nowrap>"+msg+"</TD></TR></TABLE>";
	aide(this, msg, bak, 100, 50, 10, 50, 50, 10, 50);
}

function NewWin3(){
	var largeurEcran = (screen.width - 600) / 2;
  	var hauteurEcran = (screen.height - 500) / 2;
	win3 = window.open("","win3","0,0,0,0,0,top="+hauteurEcran+",left="+largeurEcran+",scrollbars=yes,resizable=yes,width=600,height=500");
	if( self.focus ) win3.focus();
}
function NewWin2(){
	var largeurEcran = (screen.width - 600) / 2;
  	var hauteurEcran = (screen.height - 500) / 2;
	win2 = window.open("","win2","0,0,0,0,0,top="+hauteurEcran+",left="+largeurEcran+",scrollbars=yes,resizable=yes,width=600,height=500");
	if( self.focus ) win2.focus();
}
function NewWin1(){
	var largeurEcran = (screen.width - 900) / 2;
  	var hauteurEcran = (screen.height - 400) / 2;
	win1 = window.open("","win1","0,0,0,0,0,top="+hauteurEcran+",left="+largeurEcran+",scrollbars=yes,resizable=yes,width=900,height=350");
	if( self.focus ) win1.focus();
}

function ouvre_fenetre(URL,Nom,largeur,hauteur,sscrollbars,llocation){
	//Il peut y avoir des espace dans la variable Nom et ça pose un PB, donc on remplace par rien!! à améliorer
	Nom = Nom.replace(/ /g,"");
	largeur = 		largeur; 	// valeur en pixels
	hauteur = 		hauteur; 	// valeur en pixels
	coin_haut = 	( screen.height - hauteur ) / 2; 		// valeur en pixels
	coin_gauche = 	( screen.width - largeur ) / 2; 		// valeur en pixels

	ttoolbar= 		"no" 		// toolbar = barre avec les boutons precedent ...
	mmenubar = 		"no"		// menubar = barre de menu : fichier, edit ... 
	llocation = 	llocation		// location = barre URL
	ddirectories = 	"no"		// directories = barre avec le liens des bookmarks 
	sstatus = 		"no"		// status = barre qui s'affiche en bas des fenetres
	sscrollbars=	sscrollbars	// scrollbars = cree les ascenceurs si necessaire
	rresizable = 	"no"		// resizable = on peut changer la taille de la fenetre
//	dependent = 	"no"		// si on ferme la fenetre qui l'a appele, elle se ferme aussi Netscape 4.0 et +

	options = "width=" + largeur + ",height=" + hauteur + ",top=" + coin_haut + ",left=" + coin_gauche + ",toolbar=" + ttoolbar + ",location=" + llocation + ",directories=" + ddirectories + ",status=" + sstatus + ",menubar=" + mmenubar + ",scrollbars=" + sscrollbars + ",resizable=" + rresizable + "";
	window.open(URL, Nom, options);
}// fin de la fonction ouvre_fenetre

//Correction des PNG, ne marche que pour IE et PAS pour les images qui sont en background-image=url(...)
function IE_CorrectAlpha_PNG(){ 
	for(i=0; i<document.images.length; i++){ 
		img    = document.images[i]; 
		imgExt  = img.src.substring(img.src.length-3, img.src.length); 
		imgExt  = imgExt.toUpperCase(); 
		if (imgExt == "PNG"){ 
			imgID    = (img.id) ? "id='" + img.id + "' " : ""; 
			imgClass= (img.className) ? "class='" + img.className + "' " : ""; 
			imgTitle= (img.title) ? "title='" + img.title + "' " : "title='" + img.alt + "' "; 
			imgStyle= "display:inline-block;" + img.style.cssText; 
			if (img.align == "left") { imgStyle = "float:left;"  + imgStyle; } else if (img.align == "right"){ imgStyle = "float:right;" + imgStyle; } 
			if (img.parentElement.href)   { imgStyle = "cursor:hand;" + imgStyle; }        
			strNewHTML    = '<span '+imgID+imgClass+imgTitle+' style="width:'+img.width+'px; height:'+img.height+'px;'+imgStyle+';'+'filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src=\''+img.src+'\', sizingMethod=\'scale\');"></span>'; 
			img.outerHTML = strNewHTML;
			i = i-1;
		}
	}
}
//window.attachEvent("onload", IE_CorrectAlpha_PNG); 

//NICO : pour s'inscrire à la formation AJAX
function openInscription() {
	( document.getElementById('inscriptionFormationAjax').style.display == 'none' ) ? document.getElementById('inscriptionFormationAjax').style.display = 'block' : document.getElementById('inscriptionFormationAjax').style.display = 'none';
}
function doInscription() {
	//location.href = '../ressources/formation-ajax/inscription.asp?s='+document.getElementById('societe').value.replace(/\'/g,'\\\'')+'&nb='+document.getElementById('nbpart').value+'&n='+document.getElementById('nom').value+'&t='+document.getElementById('tel').value+'&c='+document.getElementById('comment').value;
	if ( document.getElementById('societe').value == '' && document.getElementById('nbpart').value == '' && document.getElementById('nom').value == '' && document.getElementById('tel').value == '' && document.getElementById('comment').innerHTML == '' ) {
		document.getElementById('info').innerHTML = 'Vous devez remplir au moins un champ!';
	}
	else {
		document.getElementById('connexion').style.visibility = 'visible';
		setTimeout('connexion2(\'../ressources/formation-ajax/inscription.asp?s='+document.getElementById('societe').value.replace(/\'/g,'\\\'')+'&nb='+document.getElementById('nbpart').value+'&n='+document.getElementById('nom').value+'&t='+document.getElementById('tel').value+'&c='+document.getElementById('comment').value+'\');',0);
	}
}
function inscriptionOK() {
	document.getElementById('connexion').style.visibility = 'hidden';
	myDiv = document.createElement('DIV');
	//myDiv.className = 'texte';
	myDiv.style.height = '24px';
	myDiv.style.width = '100px';
	document.getElementById('div_societe').innerHTML = 'Soci&eacute;t&eacute; : '+document.getElementById('societe').value;
	document.getElementById('societe').style.display = 'none';
	document.getElementById('div_societe').style.width = '400px';
	document.getElementById('div_nbpart').innerHTML = 'Nombre de participants : '+document.getElementById('nbpart').value;
	document.getElementById('div_nbpart').style.width = '400px';
	document.getElementById('nbpart').style.display = 'none';
	document.getElementById('div_nom').innerHTML = 'Nom de la personne &agrave; contacter : '+document.getElementById('nom').value;
	document.getElementById('div_nom').style.width = '400px';
	document.getElementById('nom').style.display = 'none';
	document.getElementById('div_tel').innerHTML = 'T&eacute;l ou mail : '+document.getElementById('tel').value;
	document.getElementById('div_tel').style.width = '400px';
	document.getElementById('tel').style.display = 'none';
	document.getElementById('div_comment').innerHTML = 'Commentaire : '+document.getElementById('comment').value;
	document.getElementById('div_comment').style.width = '400px';
	document.getElementById('comment').style.display = 'none';
	myDiv.innerHTML = '';
	document.getElementById('envoi').parentNode.replaceChild(myDiv.cloneNode(true), document.getElementById('envoi'));
	document.getElementById('info').innerHTML = 'Votre inscription a &eacute;t&eacute; prise en compte. Nous allons prendre contact avec vous.';
}
