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_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_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];}
}



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



function SetImage (src,name,W,H,lien,target,width,height) {

	var txt;

	if (lien==null) {

		lien="";

	}	

	if (target==null || target=="") {

		target = "_self";

	}

	if (width==null || width=="") {

		width = "752";

	}

	if (height==null || height=="") {

		height = "500";

	}
	
	var obj_cadre_visu = MM_findObj(name);

	var ext = src.substr(src.length-3).toUpperCase();



	if (ext=="SWF") {
		txt =  '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="'+W+'" height="'+H+'">';

		txt += '	<param name="movie" value="'+src+'?lien='+lien+'&target='+target+'&w='+width+'&h='+height+'">';
		txt += '	<param name="wmode" value="transparent">';
		txt += '	<param name="quality" value="high">';

		txt += '	<embed src="'+src+'?lien='+lien+'&target='+target+'&w='+width+'&h='+height+'" wmode="transparent" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="'+W+'" height="'+H+'">';

		txt += '	</embed>';

		txt += '</object>';
	} else if (ext=="JPG" || ext=="JPEG") {

				

		if (lien.length) {

			txt = '<img src="'+src+'" onload="javascript:F_resizeImage (this,'+W+','+H+');" border="0" alt="Cliquez ici">';

			if (target=="popup") {

				txt = '<a href="#" onClick="F_open (\"'+lien+'\",'+width+','+height+');">'+txt+'</a>';

			} else {

				txt = '<a href="'+lien+'" target="'+target+'">'+txt+'</a>';

			}

		} else {

			txt = '<img src="'+src+'" onload="javascript:F_resizeImage (this,'+W+','+H+');" border="0">';

		}

	} else {

		

		if (lien.length) {

			txt = '<img src="'+src+'" width="'+W+'" height="'+H+'" border="0" alt="Cliquez ici">';

			if (target=="popup") {

				txt = '<a href="#" onClick="F_open (\"'+lien+'\",'+width+','+height+');">'+txt+'</a>';

			} else {

				txt = '<a href="'+lien+'" target="'+target+'">'+txt+'</a>';

			}

		} else {

			txt = '<img src="'+src+'" width="'+W+'" height="'+H+'" border="0" >';

		}

	}



	obj_cadre_visu.innerHTML = txt;

}



/*-------------------------------------------Pour les vignettes---------------------*/
var oImg;
function F_resizeImage (path,width,height) {
		oImg = new Image();
		oImg.path = path;
		oImg.h = height;
		oImg.w = width;
		oImg.onload = F_resizeImage0;
		oImg.src = path.src;
}

function F_resizeImage0 () {
	var oImg = this;
	var path = oImg.path;
	
	var h = dH = oImg.height;
	var w = dW = oImg.width;
	
	if ((h > oImg.h) && (w > oImg.w)) {

		if ((h/oImg.h)>(w/oImg.w)) {
			 dH = oImg.h;
			 dW = parseInt(w * (dH / h), 10);			
		} else {
			 dW = oImg.w;
			 dH = parseInt(h * (dW / w), 10);
		}

	} else if ((h > oImg.h)) {
		
	  dH = oImg.h;
	  dW = parseInt(w * (dH / h), 10);			
	} else if ((w > oImg.w)) {
	  dW = oImg.w;
	  dH = parseInt(h * (dW / w), 10);
	}

	
	path.height = dH;
	path.width = dW;
	
}


function F_open (url,w,h){

	//if (Objfenetre!=null) {

	//	Objfenetre.close();

	//}


	if (parent.parent && parent.parent.visioneuse) {

		parent.location.href=url;

	} else {

		if (url.indexOf("?")==-1) {

			url += "?pop=1";

		} else {

			url += "&pop=1";

		}

		Objfenetre = window.open(url, "WinPartdieu", "width="+w+", height="+h+", top=200, left=200, scrollbars=yes,toolbar=no,location=no,directories=no,status=no,menubar=no,resizable=no");

		Objfenetre.focus();

	}

}



function gotonewpage(what)
{
  value = what.options[what.selectedIndex].value;
  if (value == "") return;
  window.open(value,"Recherche","scrollbars=yes,resizable=no,width=710,height=600");
}


function gotonewpagetv(what)
{
  value = what.options[what.selectedIndex].value;
  if (value == "") return;
  window.location.href = value;
}

function gotonewpagetvblog(what)
{
  value = what.options[what.selectedIndex].value;
  if (value == "") return;
  window.location.href = window.location.href+value;
}

function passerLIntro()
{
	document.getElementById('pop').style.display='none';
}

function checkQuiz()
{
	var error1=0;
	for (i=0;i<3;i++) { 
		if (document.forms.form_quiz.quest1[i].checked==false) { 
			error1++;
		}
	}
	
	var error2=0;
	for (i=0;i<3;i++) { 
		if (document.forms.form_quiz.quest2[i].checked==false) { 
			error2++;
		}
	}
	
	var error3=0;
	for (i=0;i<3;i++) { 
		if (document.forms.form_quiz.quest3[i].checked==false) { 
			error3++;
		}
	}
	
	if ((error1>2) || (error2>2) || (error3>2)) {
		alert ('Vous devez sélectionner une proposition pour chacune des questions du quiz !');	
	} else {
		document.form_quiz.submit();
	}
}

function checkQuiz2()
{
	var error1=0;
	for (i=0;i<3;i++) { 
		if (document.forms.form_quiz_2.quiz_quest1[i].checked==false) { 
			error1++;
		}
	}
	
	var error2=0;
	for (i=0;i<3;i++) { 
		if (document.forms.form_quiz_2.quiz_quest2[i].checked==false) { 
			error2++;
		}
	}
	
	var error3=0;
	for (i=0;i<3;i++) { 
		if (document.forms.form_quiz_2.quiz_quest3[i].checked==false) { 
			error3++;
		}
	}
	
	var error4=0;
	if (document.forms.form_quiz_2.quiz_quest4.value=='') { 
		error4++;
	}
	
	if ((error1>2) || (error2>2) || (error3>2) || (error4>0)) {
		alert ('Vous devez sélectionner une proposition pour chacune des questions du quiz !');	
	} else {
		document.form_quiz_2.submit();
	}
}