//ouverture de pop-up envoieMailAmi
function popup(mylink, windowname){
	var href;
	if (! window.focus){
		return true;
	}
	if (typeof(mylink) == 'string'){
	   href=mylink;
	 }
	else{
	   href=mylink.href;
	}
	window.open(href, windowname, 'width=520,height=250,scrollbars=yes');
	return false;
}

// fonction pour la gestion du menu
function ouvreMenu(id){
	var divnavig = document.getElementById('navigMenu');
	
	var liPrincipal=divnavig.getElementsByTagName("li");
	for (i=0;i<liPrincipal.length;i++) {
		liPrincipal[i].className="";
	}
	
	
	var v = document.getElementById('select').value;
	if(v != "" && document.getElementById(v) != null){
		document.getElementById(v).className='';
	}
	
	document.getElementById('select').value=id;
	document.getElementById(id).className='selected';
}

//afficher une div
function afficheDiv(baliseId)
{
     if (document.getElementById && document.getElementById(baliseId) != null){
       var element = document.getElementById(baliseId).getElementsByTagName("tr");
	  	for(i = 0; i< element.length ; i++){
	  		element[i].style.visibility='visible';
	  		element[i].style.display='';
	  	}
     }
}

function cacheDiv(baliseId)
{
	 if (document.getElementById && document.getElementById(baliseId) != null){
	  	var element = document.getElementById(baliseId).getElementsByTagName("tr");
	  	for(i = 0; i< element.length ; i++){
	  		element[i].style.visibility='hidden';
	  		element[i].style.display='none';
	  	}
	 }
}

function Verif(idCheck,idDiv)
{
	   if (document.getElementById(idCheck).checked != true){
	   /* la checkbox est coch�e, on cache le div)*/
	       cacheDiv(idDiv);
	   }
	   else{
	       afficheDiv(idDiv);
	   }
}

//Permet d'afficher l'�toile indiquant que le champ est obligatoire en fonction du type de newsletter
//Utilis� dans newsletter.jsp et modification.jsp (ui/fo/newsletter)
function switchAffiche(formName){
	if (document.getElementById){
		var html = '';
		if( document.getElementById(formName+'_newsletter_noNewsletter1') != null 
			&& (document.getElementById(formName+'_newsletter_noNewsletter2').checked || document.getElementById(formName+'_newsletter_noNewsletter3').checked)){
			html = '*';
		}else{
			html = '<br />(facultatif)';
		}//if
		
		//Le champ adresse
		if (document.getElementById('champObligatoirAdresse')!=null){
			document.getElementById('champObligatoirAdresse').innerHTML=html;
		}//if
		//Le champ code postal
		if (document.getElementById('champObligatoirCodePostal')!=null){
			document.getElementById('champObligatoirCodePostal').innerHTML=html;
		}//if
		//Le champ Ville
		if (document.getElementById('champObligatoirVille')!=null){
			document.getElementById('champObligatoirVille').innerHTML=html;
		}//if
		
	}//if
}//switchAffiche
