
function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}




function execImage(id_media,id_site){
window.open('/image.php?id_media='+id_media+'&id_site='+id_site,'image','status=no,toolbar=no,menubar=no,location=no,scrollbars=yes')
}
function execVideo(id_media,id_site,w,h){
window.open('/shared/video.php?id_media='+id_media+'&id_site='+id_site+'&w='+w+'&h='+h,'image','width='+(w+100)+',height='+(h+150)+',status=no,toolbar=no,menubar=no,location=no,scrollbars=yes')
}

function changeFontSize(size){
if(fontsizeh1!= "undefined") var fontsizeh1 =parseInt(150);
if(fontsizenormal!= "undefined") var fontsizenormal    = parseInt(100);
if(fontsizeh2!= "undefined") var fontsizeh2 =parseInt(110);

	chaine = LireCookie2('MelunSize')
	
	if(chaine)
	{
		var tableau=chaine.split(',');
		var fontsizeh1 = parseInt(tableau[0]) ;
		var fontsizeh2 = parseInt(tableau[1]) ;
		var fontsizenormal = parseInt(tableau[2]) ;
	}

	var     els = document.getElementById("titrePrincipal");
	var     els2 = document.getElementById("chapeau");	
	var     els3 = document.getElementById("colonneNormal");
	var     els4 = document.getElementById("contenuHaut");
	var     els5 = document.getElementById("accueilPratique");
	var     els6 = document.getElementById("colonneNormalActu");
	
	if (((fontsizenormal+size) >= 80)&&((fontsizenormal+size) <= 170))
	{
		fontsizenormal    = (fontsizenormal+size);
	}
	
	if (((fontsizeh1+size) >= 130)&&((fontsizeh1+size) <= 220))
	{
		fontsizeh1    = (fontsizeh1+size);
		
	}
	
	if (((fontsizeh2+size) >= 80)&&((fontsizeh2+size) <= 170))
	{
		fontsizeh2    = (fontsizeh2+size);
	}
	if(document.getElementById("titrePrincipal")) els.style.fontSize = fontsizeh1 +"%" ;
	if(document.getElementById("chapeau")) els2.style.fontSize = fontsizeh2 +"%" ;
	if(document.getElementById("colonneNormal")) els3.style.fontSize = fontsizenormal +"%" ;
	if(document.getElementById("contenuHaut")) els4.style.fontSize = fontsizenormal +"%" ;
	if(document.getElementById("accueilPratique")) els5.style.fontSize = fontsizenormal +"%" ;
	if(document.getElementById("colonneNormalActu")) els6.style.fontSize = fontsizenormal +"%" ;
	
	var CookieFont = new Array(fontsizeh1,fontsizeh2,fontsizenormal);
	date=new Date;
 	date.setMonth(date.getMonth()+1); // expire dans un mois
	ecrire_cookie("MelunSize", CookieFont,date,'/');


}

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) 
		{
			var chaine=getCookieVal(j);	
			var tableau=chaine.split(',');
			var     els = document.getElementById("titrePrincipal");
			var     els2 = document.getElementById("chapeau");	
			var     els3 = document.getElementById("colonneNormal");
			var     els4 = document.getElementById("contenuHaut");
			var     els5 = document.getElementById("accueilPratique");
			var     els6 = document.getElementById("colonneNormalActu");
			
			if(document.getElementById("titrePrincipal")) els.style.fontSize = tableau[0] +"%" ;
			if(document.getElementById("chapeau")) els2.style.fontSize = tableau[1] +"%" ;
			if(document.getElementById("colonneNormal")) els3.style.fontSize = tableau[2] +"%" ;
			if(document.getElementById("contenuHaut")) els4.style.fontSize = tableau[2] +"%" ;
			if(document.getElementById("accueilPratique")) els5.style.fontSize = fontsizenormal +"%" ;
			if(document.getElementById("colonneNormalActu")) els6.style.fontSize = fontsizenormal +"%" ;
		}
		i=document.cookie.indexOf(" ",i)+1;
		if (i==0) break;
	}

return null;
}


function LireCookie2(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) 
		{
			var chaine=getCookieVal(j);	
			return chaine
		
		}
		i=document.cookie.indexOf(" ",i)+1;
		if (i==0) break;
	}

return null;
}


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

function ecrire_cookie(nom, valeur, expires,path) {
  document.cookie=nom+"="+escape(valeur)+
  ((path==null) ? "" : ("; path="+path))+
  ((expires==null) ? "" : ("; expires="+expires.toGMTString()));
}

function fnInsertIcone()
{
  
	fnInsertPrint();
	fnInsertMoins();
	fnInsertPlus();
}

function fnInsertPrint()
{
 /************ IMPRESSION ***********************/
  // Création d'un lien
   var oA = document.createElement('a');
   oA.setAttribute('href', '#');
   oA.innerHTML='<img src="/sites/web/gabarit/img/icon-print.gif" alt="Imprimer" width="20" height="20" border="0" />';

   // Affectation de la méthode print() au clic sur le lien
   oA.onclick = function() { window.print(); return false; }
	
   // Positionnement du lien dans la page
   var oCont = document.getElementById('print');
   if(!oCont) return;
   oCont.appendChild(oA); 
}


function fnInsertPlus()
{   
   /************ AUGMENTE TAILLE TYPO *******************/
   // Création d'un lien
   var oA2 = document.createElement('a');
   oA2.setAttribute('href', '#');
   oA2.innerHTML='<img src="/sites/web/gabarit/img/icon-zoom2.gif" alt="Agrandir la taille du texte" width="20" height="20" border="0" />';

   // Affectation de la méthode changeFontSize() au clic sur le lien
   oA2.onclick = function() { changeFontSize(+10); return false; }
	
   // Positionnement du lien dans la page
   var oCont = document.getElementById('typoplus');
   if(!oCont) return;
   oCont.appendChild(oA2); 	
}

function fnInsertMoins()
{
	/************ DIMINUE TAILLE TYPO *******************/
   // Création d'un lien
   var oA = document.createElement('a');
   oA.setAttribute('href', '#');
   oA.innerHTML='<img src="/sites/web/gabarit/img/icon-zoom1.gif" alt="Réduire la taille du texte" width="20" height="20" border="0" />';

   // Affectation de la méthode changeFontSize() au clic sur le lien
   oA.onclick = function() { changeFontSize(-10); return false; }
	
   // Positionnement du lien dans la page
   var oCont = document.getElementById('typomoins');
   if(!oCont) return;
   oCont.appendChild(oA); 	
}


