function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

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_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

fDomOffset = function( oObj, sProp )
{
 var iVal = 0;
 while (oObj && oObj.tagName != 'BODY') {
  eval('iVal += oObj.' + sProp + ';');
  oObj = oObj.offsetParent;
 }
 return iVal;
}

function Affiche(region, radicaux, nom, choix) {
	Masque(radicaux);
	document.getElementById(region).style.display="block";
}

function AfficheChoix(nom, choix)
{
	if (nom=='' || nom=='<ul></ul>' || nom=='<UL></UL>') document.getElementById('recap'+choix).innerHTML = document.getElementById('recap'+choix).innerHTML.replace("=\"on\"","=\"off\"").replace("=on","=off");
	else document.getElementById('recap'+choix).innerHTML = document.getElementById('recap'+choix).innerHTML.replace("=\"off\"","=\"on\"").replace("=off","=on");
	document.getElementById('listeRecap'+choix).innerHTML = nom;
}

function Masque(radicaux) {
	a = document.getElementsByTagName("ul");
	for(i = 0 ; a.length>i ; i++) {
		for(j=0 ; radicaux.length>j ; j++) {
			if(a[i].id.match(radicaux[j])) {
				a[i].style.display="none";
				break;
			}
		}
	}
}

function ouvrir(action, cible, wr, hr, centrer) {
	w=parseInt(top.screen.availWidth*wr);
	h=parseInt(top.screen.availHeight*hr);

	feat='width='+w+',height='+h+',toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=1';

	if(centrer) {
		t=parseInt(top.screen.availHeight*((1-hr)/2));
		l=parseInt(top.screen.availWidth*((1-wr)/2));

		feat = 'top='+t+',left='+l+ ',' + feat;

	}
	
	top.open(action, cible, feat);

	return false;
}

function activer(parent, element) {
	 var balises = document.getElementById(parent).getElementsByTagName("a");							
   	 for (var i=0;i<balises.length;i++)
	 {
		balises[i].className = "";
	 }
	 if (document.getElementById(element)) {
     	document.getElementById(element).className = "active";
     }
}

function videSerie () {
	document.getElementById('seriesListe').innerHTML='';
	selectSousTheme('', '', '');
}

function ajoutSelection(selection, element, conserve) {
     document.getElementById("titre"+selection).className = "on";
     
     if (conserve) {
     	if (document.getElementById("liste"+selection).innerHTML.indexOf("<p>"+document.getElementById(element).innerHTML+"</p>")==-1) 
     	document.getElementById("liste"+selection).innerHTML = document.getElementById("liste"+selection).innerHTML+"<p>"+document.getElementById(element).innerHTML+"</p>";
     }
     else {
     	document.getElementById("liste"+selection).innerHTML = "<p>"+document.getElementById(element).innerHTML+"</p>";
     }
}
function supprSelection(selection, element) {
     
     if (element == "all") {
     	document.getElementById("liste"+selection).innerHTML = "";
     }
     else {
     	document.getElementById("liste"+selection).innerHTML = document.getElementById("liste"+selection).innerHTML.replace("<p>"+document.getElementById(element).innerHTML+"</p>","");
     }
    
     if (document.getElementById("liste"+selection).innerHTML == "") {
     	document.getElementById("titre"+selection).className = "off";
     }
}

function get_cookie ( cookie_name )
{
  var results = document.cookie.match ( '(^|;) ?' + cookie_name + '=([^;]*)(;|$)' );

  if ( results )
    return ( unescape ( results[2] ) );
  else
    return null;
}
window.onload = function getSize() {
	var fontSize = document.body.style.fontSize;
	//r?cup valeur
	if (fontSize == '') fontSize = "10px"; //lecture cookie
	if (get_cookie("fontSize") != null) fontSize = get_cookie("fontSize");
	fontSize = fontSize.replace("px","");
	document.body.style.fontSize = fontSize + "px";
}
function changeSize(mode) {
	//r?cup valeur
	var fontSize = document.body.style.fontSize;
	
	//incr?ment
	fontSize = fontSize.replace("px","");
	if (mode == '+') fontSize = Math.floor(fontSize) + 1;
	if (mode == '-') fontSize = Math.floor(fontSize) - 1;
	document.body.style.fontSize = fontSize + "px";
	
	//cookie
	document.cookie = "fontSize="+fontSize+";";
}

