﻿/*ouverture d'une fenêtre navigateur*/
function zyva(fichier,haut,larg){
Conception=window.open(fichier,'palette','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no,width='+larg+',height='+haut)
} // fin de zyva()
function zyva2(fichier,haut,larg){
Conception=window.open(fichier,'palette','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,width='+larg+',height='+haut)
} // fin de zyva()

/* Ouverture d'une popup issu des bandeaux pub */
// Popup sans Scroll
function zyvaPub0(fichier,nomPopup,haut,larg){
	Conception=window.open(fichier,nomPopup,'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,width='+larg+',height='+haut)
}
// Popup avec Scroll
function zyvaPub1(fichier,nomPopup,haut,larg){
	Conception=window.open(fichier,nomPopup,'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no,width='+larg+',height='+haut)
}

function PopupCentrer(page,largeur,hauteur,type) {
	var options = "";
	if(type == 'zyvaPub1')options = "toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no";
	if(type == 'zyvaPub0')options = "toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no" ;
  var top=(screen.height-hauteur)/2;
  var left=(screen.width-largeur)/2;
  window.open(page,"","top="+top+",left="+left+",width="+largeur+",height="+hauteur+","+options);
}

/*fonctionnement du menu deroulant acces direct du bloc de gauche*/
function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);

function MM_findObj(n, d) { //v4.0
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && document.getElementById) x=document.getElementById(n); return x;
}

function Menudirect() { //v3.0
  var i,p,v,obj,args=Menudirect.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v='hide')?'hidden':v; }
    obj.visibility=v; }
}

//fonction qui affiche un layer
function montrer(nom_div){
	if (document.layers && document.layers[nom_div]){ 
			document.layers[nom_div].style.display = 'inline';
	}else if (document.all){
			document.all[nom_div].style.display = 'inline';
			document.all[nom_div].style.zIndex = 100;
	}else if (document.getElementById){
			document.getElementById(nom_div).style.display = 'inline';
			document.getElementById(nom_div).style.zIndex = 100; 
  }
}
//fonction qui cache un layer
function cacher(nom_div){
  if (document.layers && document.layers[nom_div]){ 
		document.layers[nom_div].style.display = 'none';
  }else if (document.all){ 
    document.all[nom_div].style.display = 'none';
  }else if (document.getElementById){
    document.getElementById(nom_div).style.display = 'none'; 
	}
}

//affichage des pubs en EXPAND
function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_showHideLayers() { //v6.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
    obj.visibility=v; }
}

//fonction de vérification de mail similaire à celle d'ASP (string.asp => ismail())
function ismail(email){
	var reg = /^(\w([-.\w]*\w)*@(\w[-\w]*\w\.)+[a-zA-Z]{2,4})$/;
	//var reg = /^([\w-\.]+)@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([\w-]+\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$/ //utilisée par microsoft;
	if(reg.exec(email)==null){
		return false;
	}else{
		return true;
	}
}

function aff_petit(repvignette,repbigsize)
	{
	document.write('<A HREF="javascript:aff_grand(\''+repbigsize+'\')"><IMG SRC="'+repvignette+'" HSPACE=0 VSPACE=0 BORDER=0 ALT="Cliquez pour agrandir..."></A>');
	}

function aff_grand(chemin)
	{
	i1 = new Image;
	i1.src = chemin;
	html = '<HTML><HEAD><TITLE>Grand format</TITLE></HEAD><BODY LEFTMARGIN=0 MARGINWIDTH=0 TOPMARGIN=0 MARGINHEIGHT=0><CENTER><IMG SRC="'+chemin+'" NAME=imageTest onLoad="window.resizeTo(document.imageTest.width+14,document.imageTest.height+32)"></CENTER></BODY></HTML>';
	popupImage = window.open('','_blank','toolbar=0,location=0,directories=0,menuBar=0,scrollbars=0,resizable=0');
	popupImage.document.open();
	popupImage.document.write(html);
	popupImage.document.close()
	};

//fonction de gestion de cookies utilisé dans la gestion des pub
function PoseCookie(nom, valeur)
{
  document.cookie= nom + "=" + escape(valeur);
}

function SetCookie (name, value) {
	var argv=SetCookie.arguments;
	var argc=SetCookie.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=name+"="+escape(value)+
		((expires==null) ? "" : ("; expires="+expires.toGMTString()))+
		((path==null) ? "" : ("; path="+path))+
		((domain==null) ? "" : ("; domain="+domain))+
		((secure==true) ? "; secure" : "");
}

function ChercheCookie(Nom) {
  var cherche = Nom + "="
  var returnvaleur = "";
  if (document.cookie.length > 0) {
    offset = document.cookie.indexOf(cherche)
    if (offset != -1) { // if cookie exists
      offset += cherche.length
      end = document.cookie.indexOf(";", offset);
      if (end == -1)
         end = document.cookie.length;
      returnvaleur=unescape(document.cookie.substring(offset, end))
      }
   }
  return returnvaleur;
}

function bookmark()
{
 /* INFORMATIONS A PERSONNALISER */
 urlSite = top.location;
 nomSite = document.title
 // netscape 6.x ... firefox
 if (window.sidebar){window.sidebar.addPanel(nomSite,urlSite,"")}
 // internet explorer 4.x windows
 else if (window.external){window.external.AddFavorite(urlSite,nomSite)}
 // internet explorer mac
 else if (document.all && (navigator.userAgent.indexOf('Win') < 0)){alert ("COMMAND + B pour mettre en favoris : " + nomSite + " !")}
 // netscape 4.x
 else if (document.layers){alert ("CTRL + D pour mettre en favoris : " + nomSite + " !")}
 // opéra
 else if (navigator.userAgent.indexOf('Opera') != -1){alert ("CTRL + T pour mettre en favoris : " + nomSite + " !")}
 
}

function homepage()
{
	if(navigator.appName=="Microsoft Internet Explorer"){
		lien.style.behavior='url(#default#homepage)';
		lien.setHomePage(location.href);
	}else{
		window.alert('Votre navigateur ne supporte pas cette fonction. \nPour mettre le site en page de démarrage, glissez l\'icône à gauche de l\'adresse du site en haut, sur l\'icône en forme de maison de la barre d\'outils de votre navigateur.');
	}
}


var taille = 12 //default stylesheet
function ChangeTaille(inc)
{
	//li represente la feuille de style
	//temoin == 1 si une feuille de style a été activé sinon 0
	var li, temoin = 0;
	//on boucle sur tous les éléments <link  ... />
	for(var i=0; li=document.getElementsByTagName("link")[i]; i++)
	{
		//si c'est une feuille de style pour changer la taille (on peut imaginer n'augmenter la taille que du corps de texte)
		if(li.getAttribute("title").indexOf("generaltaille") !=-1)
		{
			//on stocke la feuille actellement active
			if(li.disabled == false)iActive = i; 
			//si cette feuille correspond à la taille demandée
			if(li.getAttribute("title").indexOf(taille + inc)!=-1)
			{
				li.disabled = false; //activation de la feuille
				temoin = 1;//indique qu'une feuille est activée
			}
			else //si cette feuille ne correspond pas à la taille demandée
			{
				li.disabled = true; //on désactive la feuille
			}
		}
	}
	//si aucune feuille n'est active (taille impossible à trouver)
	if(temoin == 0)
	{
		document.getElementsByTagName("link")[iActive].disabled = false; //on réactive l'ancienne feuille
	}
	else
	{
		taille = taille + inc; //on stock la prochaine taille
	}
	
}

// fonction permettant l'appel d'un flash avec ses paramètres d'hauteur, de largeur, son url, son identifiant, ainsi que sa transparence
function Appelflash(flash_hauteur, flash_largeur, flash_url, flash_id, flash_trans) {
	// si l'on ne définit pas la transparence ou avec une autre valeur que "transparent", le flash sera affiché en opaque
	if (flash_trans != "transparent") { flash_trans="opaque"; } 	
	document.write('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" width="' + flash_largeur + '" height="' + flash_hauteur + '" id="' + flash_id + '"><param name="wmode" value="' + flash_trans + '" /><param name="allowScriptAccess" value="sameDomain" /><param name="movie" value="' + flash_url + '" /><param name="quality" value="high" /><param name="bgcolor" value="#ffffff" />');
	document.write('<embed src="' + flash_url + '" quality="high" bgcolor="#ffffff" wmode="' + flash_trans + '" width="' + flash_largeur + '" height="' + flash_hauteur + '" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" id="' + flash_id + '" /></object>');
}

//fonction qui affiche un div qui est caché ou cache un div qui est affiché
function InverseDisplay(id){
	var oDiv = document.getElementById(id);
	if(oDiv.style.display == 'block'){oDiv.style.display = 'none'}else{oDiv.style.display = 'block'};
}