function flash(tag) {
	
	document.write(tag);
}

 function PopupImage(img) {
	w=open("",'image','weigth=toolbar=no,scrollbars=no,resizable=no, width=620, height=500');
	w.document.write("<HTML><BODY onblur=\"window.close();\"><IMG src='"+img+"'>");
	w.document.write("</BODY></HTML>");
	w.document.close();
} 

function popUp(strURL,strType,strHeight,strWidth) {

	var strOptions="";
	if (strType=="console") strOptions="resizable,height="+strHeight+",width="+strWidth;
	if (strType=="fixed") strOptions="status,height="+strHeight+",width="+strWidth;
	if (strType=="elastic") strOptions="toolbar,menubar,scrollbars,resizable,location,height="+strHeight+",width="+strWidth;
	newWin = window.open(strURL, 'newWin', strOptions);
	newWin.focus();
} 

 function fenetreCent(url,nom,largeur,hauteur,options) {
	var haut=(screen.height-hauteur)/2;
	var Gauche=(screen.width-largeur)/2;
	f=window.open(url,nom,"top="+haut+",left="+Gauche+",width="+largeur+",height="+hauteur+","+options);
	self.focus();
}

function EcrireCookie(nom, valeur)
{
   var argv=EcrireCookie.arguments;
   var argc=EcrireCookie.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=nom+"="+escape(valeur)+
      ((expires==null) ? "" : ("; expires="+expires.toGMTString()))+
      ((path==null) ? "" : ("; path="+path))+
      ((domain==null) ? "" : ("; domain="+domain))+
      ((secure==true) ? "; secure" : "");
}

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

function LireCookie(nom)
{
   var arg=nom+"=";
   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 switch_couleur(couleur){
	setActiveStyleSheet('css_'+ couleur);
	// Ecrire le cookie, valide 6 mois
	date=new Date;
	date.setMonth(date.getMonth()+6);
	EcrireCookie("style_site_eo", 'css_'+ couleur, date);
	switch_ban(couleur);
}

function setActiveStyleSheet(title) {
   var i, a, main;
   for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {
     if(a.getAttribute("rel").indexOf("style") != -1
        && a.getAttribute("title")) {
       a.disabled = true;
       if(a.getAttribute("title") == title) a.disabled = false;
     }
   }
  
}

function switch_ban(coul) {
	
	if(coul == "white"){old_coul = "black";}else if(coul == "black"){old_coul = "white";}
	var obj = document.getElementById("ban_random");
	var ch = obj.src.toString();
	var reg=new RegExp(old_coul, "g");
	ch = ch.replace(reg,coul);
	obj.setAttribute('src',ch);
 

}

function VerifForm(formulaire,num) {
	
	var valid;

	mess = "";

	if(num == 1){
	
		//mail
		adresse = formulaire.email.value;
		var email_valide = checkEmail(adresse);
		if (email_valide == false) {
			mess += "- E-mail\n";
		}
		
		//msg
		if(formulaire.nom.value == "") {
			mess += "- Nom\n";
		}

		//tel
		if(formulaire.phone.value == "") {
			mess += "- N° de téléphone\n";
		}


		//nom societe
		if(formulaire.nom_societe.value == "") {
			mess += "- Nom de société\n";
		}

	}else if(num ==2){

		
		//titre projet
		if(formulaire.titre.value == "") {
			mess += "- Titre de votre projet\n";
		}
		
	}else if(num ==3){
		
		//Date rappel
		if((formulaire.date_rappel.value == "jj/mm/aaaa" && formulaire.reponse_client[1].checked ) || (formulaire.date_rappel.value == "" && formulaire.reponse_client[1].checked)) {
			mess += "- Date pour vous recontacter\n";
		}
	}

	if(mess != "") {
		alert("Attention, certains champs ne sont pas valides :\n"+mess);
		valid = false;
	}else{
		valid = true;
	}

	return valid;
}


function checkEmail(emailAddr) {
	// Cette fonction vérifie la bon format d'une adresse e-mail.
	// Comme :
	// user@domain.com ou user.perso@domain.com
	
	var i;
	
	// Recherche de @
	i = emailAddr.indexOf("@");
	if (i == -1) {
		return false;
	}
	
	// Séparation du nom de l'utilisateur et du nom de domaine.
	var username = emailAddr.substring(0, i);
	var domain = emailAddr.substring(i + 1, emailAddr.length)

	// Recherche des espaces au début du nom de l'utilisateur.
	i = 0;
	while ((username.substring(i, i + 1) == " ") && (i < username.length)) {
		i++;
	}
	// Les enlève s'il en trouve.
	if (i > 0) {
		username = username.substring(i, username.length);
	}

	// Recherche d'espaces à la fin du nom de domaine.
	i = domain.length - 1;
	while ((domain.substring(i, i + 1) == " ") && (i >= 0)) {
		i--;
	}
	// Les enlève s'il en trouve.
	if (i < (domain.length - 1)) {
		domain = domain.substring(0, i + 1);
	}

	// Vérifie que le nom de l'utilisateur et du domaine ne soit pas vide.
	if ((username == "") || (domain == "")) {
		return false;
	}
	
	// Vérifie s'il n'y a pas de caractères interdits dans le nom de l'utilisateur.
	var ch;
	for (i = 0; i < username.length; i++) {
		ch = (username.substring(i, i + 1)).toLowerCase();
		if (!(((ch >= "a") && (ch <= "z")) || 
			((ch >= "0") && (ch <= "9")) ||
			(ch == "_") || (ch == "-") || (ch == "."))) {
				return false;
		}
	}
	
	// Vérifie s'il n'y a pas de caractères interdits dans le nom de domaine
	for (i = 0; i < domain.length; i++) {
		ch = (domain.substring(i, i + 1)).toLowerCase();
		if (!(((ch >= "a") && (ch <= "z")) || 
			((ch >= "0") && (ch <= "9")) ||
			(ch == "_") || (ch == "-") || (ch == "."))) {
				return false;
		}
	}

// Ajouter ci-dessous de nouveaux noms de domaine.
// Voir tous les noms de domaine sur http://www.toulouse-renaissance.net/c_outils/c-nom-domaine.htm
//
var aSuffix = new Array("com","net","int","aero","biz","museum","name","info","coop","pro","eu","edu","org","gov","mil","bj","dz","de","ad","be","ca","bf","bi","cm","cf","cg","cd","ci","dj","fr","ga","gp","gf","lu","mg","ml","ma","mq","mr","mc","nc","pf","re","pm","sn","ch","td","tf","tn");
	var bFoundSuffix = false;
	i = 0;
	while (i < aSuffix.length) {
		if (("." + aSuffix[i]) == domain.substring(domain.length - aSuffix[i].length - 1, domain.length)) {
			return true;
		}
		i++;
	}
	// Si le nom de domaine est inconnu  : return false
	return false;
	
}	



function VerifFormRh(formulaire) {
	
	var valid;

	mess = "";

		//mail
		adresse = formulaire.courriel.value;
		var email_valide = checkEmail(adresse);

		if(formulaire.lenom.value == "") {
			mess += "- Nom\n";
		}
		
		
		if (email_valide == false) {
			mess += "- E-mail\n";
		}
		
		//nom
		if(formulaire.nom.value == "") {
			mess += "- Nom\n";
		}


		//tel
		if(formulaire.tel_mobile.value == "") {
			mess += "- N° de téléphone mobile\n";
		}

		//Ville
		if(formulaire.ville.value == "") {
			mess += "- Ville\n";
		}


		//departement
		if(formulaire.departement.value == 0) {
			mess += "- Département\n";
		}

		if(mess != "") {
			alert("Attention, certains champs ne sont pas valides :\n"+mess);
			valid = false;
		}else{
			valid = true;
		}

		return valid;


}

function sendEvent(swf,typ,prm) { 
  thisMovie(swf).sendEvent(typ,prm); 
};


// Ecriture des cookies
// Donner à la variable compteur la valeur du cookie
style_site=LireCookie("style_site_eo");
if (style_site==null)
{ // Le cookie  n'existe pas, donner la valeur au css
style_site = "css_white";
}
else
{ //Le cookie existe, donner le style à la page
setActiveStyleSheet(style_site);
}

//-->

//correction des images png
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;
		}
	}
}

var userAgent=navigator.userAgent;
if (userAgent.indexOf('MSIE') != -1) {
  window.attachEvent("onload", IE_CorrectAlpha_PNG);
}


function VerifFormNewsletter(formulaire) {
	
	var valid;

	mess = "";

		

		//mail
		adresse = formulaire.courriel.value;
		adresse2 = formulaire.courriel2.value;
		var email_valide = checkEmail(adresse);
		if (email_valide == false) {
			mess += "- L'e-mail est invalide\n";
		}

		//mail
		if(formulaire.courriel.value == "") {
			mess += "- Saisissez votre E-mail\n";
		}

		//mail 2
		if(formulaire.courriel2.value == "") {
			mess += "- Confirmez votre E-mail \n";
		}

		if (adresse != adresse2) {
			mess += "- Les deux adresses saisies ne coincident pas.\n";
		}
		
		

	
	if(mess != "") {
		alert("Attention, certaines informations sont incorrectes :\n"+mess);
		valid = false;
	}else{
		valid = true;
	}

	return valid;
}







