//popup
function myPop() {
     this.square = null;
     this.overdiv = null;    
     
     this.popOut = function(msgtxt) {        
	     //filter:alpha(opacity=25);-moz-opacity:.25;opacity:.25;        
	     this.overdiv = document.createElement("div");        
	     this.overdiv.className = "overdiv";        
	     this.square = document.createElement("div");        
	     this.square.className = "square";        
	     this.square.Code = this;        
	     var msg = document.createElement("div");        
	     msg.className = "msg";        
	     msg.innerHTML = msgtxt;        
	     var closebtn = document.createElement("button");
	     	closebtn.style.color="black";
	     	closebtn.style.backgroundColor ="white";
	     	closebtn.style.border = "solid black 1px";
	     	closebtn.style.height = "20px";
	     	closebtn.style.width = "60px";
	     	closebtn.style.padding = "0 0 2px 1px";
	     	closebtn.style.margin = "0 0 2px 0";
        
	     closebtn.onclick = function() {            
	     this.parentNode.Code.popIn();        
	     }        
	     closebtn.innerHTML = "x fermer";        

	     this.square.appendChild(closebtn);        
	     this.square.appendChild(msg);        

	     document.body.appendChild(this.overdiv);        
	     document.body.appendChild(this.square);    
     }    
     this.popIn = function() {        
	     if (this.square != null) {            
	     document.body.removeChild(this.square);            
	     this.square = null;        
	     }        
	     if (this.overdiv != null) {        
	     document.body.removeChild(this.overdiv);        
	     this.overdiv = null;        
	     }    
     }
}
function ScanCookie(variable)
{
	cook = document.cookie;
	variable += "=";
	place = cook.indexOf(variable,0);
	if (place <= -1)
		return("0");
	else
		{
		end = cook.indexOf(";",place)
		if (end <= -1)
			return(unescape(cook.substring(place+variable.length,cook.length)));
		else
			return(unescape(cook.substring(place+variable.length,end)));
		}
}

function CreationCookie(nom,valeur,permanent)
{
	if(permanent)
		{
		dateExp = new Date(2099,11,11);
		dateExp = dateExp.toGMTString();
		ifpermanent = '; expires=' + dateExp + ';';
		}
	else
		ifpermanent = '';
	document.cookie = nom + '=' + escape(valeur) + ifpermanent;
}


// JavaScript Document


/*search*/
function focusMotValue(input)
{
	switch(input)
	{ 
		case 'champ_recherche_style2': 
		if (document.getElementById && document.getElementById(input).value == 'Chercher')
		{
			document.getElementById(input).value='';
		}
		break;
		case 'champ_email_style2': 
		if (document.getElementById && document.getElementById(input).value == 'Votre E-mail')
		{
			document.getElementById(input).value='';
		}
		break; 
	}
}

function blurMotValue(input)
{
	if (document.getElementById && document.getElementById(input).value == '')
	{
		switch(input)
		{ 
			case 'champ_recherche_style2': 
			document.getElementById(input).value='Chercher';
			break;
			case 'champ_email_style2': 
			document.getElementById(input).value='Votre E-mail';
			break; 
		}
	}
}


/*mailing*/
function verif()
{ var stop=0;
var str='';
var adresse = document.form_mailing.mail.value;
var place = adresse.indexOf("@",1);
var point = adresse.indexOf(".",place+1);
if ((document.form_mailing.mail.value == '') || (document.form_mailing.mail.value == 'Votre E-mail'))
{	
	str=str+'\n - Votre E-mail';
	stop=1;
}
else
{	
	if ((place > -1)&&(adresse.length >2)&&(point > 1)&&(adresse.length > point+2))
	{
	}
	else
	{	if (stop == 0)
		{	
		stop=1;
		alert('Veuillez saisir une adresse E-mail valide.');
		document.form_mailing.mail.focus();
		}
	}
}
if(document.form_mailing.abonne[0].checked || document.form_mailing.abonne[1].checked)
{
	if (stop==0) 
		document.form_mailing.submit();
	else if (str != '') 
		alert('Veuillez saisir : '+str);
}
else
{
	alert('Veuillez sélectionner abonnement ou désabonnement');
}
}

function verif2()
{ var stop=0;
var str='';
var adresse = document.form_mailing2.mail.value;
var place = adresse.indexOf("@",1);
var point = adresse.indexOf(".",place+1);
if ((adresse == '') || (adresse == 'Votre E-mail'))
{	
	str=str+'\n - Votre E-mail';
	stop=1;
}
else
{	
	if ((place > -1)&&(adresse.length >2)&&(point > 1)&&(adresse.length > point+2))
	{
	}
	else
	{	if (stop == 0)
		{	
		stop=1;
		alert('Veuillez saisir une adresse E-mail valide.');
		document.form_mailing2.mail.focus();
		}
	}
}
if(document.form_mailing2.abonne[0].checked || document.form_mailing2.abonne[1].checked)
{
	if (stop==0) 
		document.form_mailing2.submit();
	else if (str != '') 
		alert('Veuillez saisir : '+str);
}
else
{
	alert('Veuillez sélectionner abonnement ou désabonnement');
}
}


/*déroulant*/

var tempsNav =800;
var timeOut;
function afficheNav(id){
	stopAffiche();
	for (var i = 1; i<=10; i++){
		var id2 = "sousMenu"+i;
		if(id != id2){
			if (document.getElementById(id2)){
				document.getElementById(id2).style.display='none';
			}
		}
	}
	if (document.getElementById(id)){
		document.getElementById(id).style.display='block';
	}
}

function dessafichNav(){
	for (var i = 1; i<=10; i++){
		if (document.getElementById('sousMenu'+i)){
			document.getElementById('sousMenu'+i).style.display='none';
		}
	}
}

function projectionBlock(){
	timeOut = setTimeout('dessafichNav()', tempsNav);
}
function stopAffiche(){
	if(timeOut)
		clearTimeout(timeOut);
}
