// JavaScript Document

/* FONCTION D'ECRITURE DU SWF */
function WriteSWF(path, file, width, height, wmode, bgcolor, id){
var EmbedSWF = "<object classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0\" id=\""+id+"\" width=\""+width+"\" height=\""+height+"\"><param name=\"movie\" value=\""+path+file+"\" /><param name=\"quality\" value=\"high\" /><param name=\"menu\" value=\"false\" /><param name=\"wmode\" value=\""+wmode+"\" /><param name=\"bgcolor\" value=\""+bgcolor+"\" /><param name=\"allowScriptAccess\" value=\"sameDomain\" /><embed src=\""+path+file+"\" bgcolor=\""+bgcolor+"\" wmode=\""+wmode+"\" menu=\"false\" quality=\"high\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\" type=\"application/x-shockwave-flash\" name=\""+id+"\" allowScriptAccess=\"always\" swLiveConnect=\"true\" width=\""+width+"\" height=\""+height+"\"></embed></object>";

document.write(EmbedSWF);
}

function WriteSpotSWF(path_file, width, height, wmode, bgcolor, id){
var EmbedSWF = "<object classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0\" id=\""+id+"\" width=\""+width+"\" height=\""+height+"\"><param name=\"movie\" value=\""+path_file+"\" /><param name=\"quality\" value=\"high\" /><param name=\"menu\" value=\"false\" /><param name=\"wmode\" value=\""+wmode+"\" /><param name=\"bgcolor\" value=\""+bgcolor+"\" /><param name=\"allowScriptAccess\" value=\"sameDomain\" /><embed src=\""+path_file+"\" bgcolor=\""+bgcolor+"\" wmode=\""+wmode+"\" menu=\"false\" quality=\"high\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\" type=\"application/x-shockwave-flash\" name=\""+id+"\" allowScriptAccess=\"always\" swLiveConnect=\"true\" width=\""+width+"\" height=\""+height+"\"></embed></object>";

document.write(EmbedSWF);
}

/* FONCTION DE COMMUNICATION JAVASCRIPT AVEC LE  SWF */

function getMovieName(movieName) {
    if (navigator.appName.indexOf("Microsoft") != -1) {
        return window[movieName]
   }
   else {
        return document[movieName]
   }
}

function ChangeZoom(images, isBackVisualEnabled){
	var imgArray = images.split(",");
	if (imgArray.length > 1) {			
		getMovieName("zoom").changeVisual(imgArray[0], imgArray[1], imgArray[2], imgArray[3], isBackVisualEnabled);
	}
}

/* DIAPORAMA ACTUS */
var varActus = new Array();
varActus[0] = ["_tmp_img_visuel01.jpg", "_tmp_img_visuel02.jpg", "_tmp_img_visuel03.jpg"];
varActus[1] = "videofile.flv";

/*Si une video et pas de diaporama --> varActus[0] = "videofile.flv"; */

function Diapo(){
	getMovieName("diaporama").slideshow(varActus);
}

/* FONCTIONS DE ROLLOVER */

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.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 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 disableselect(e){
return false
}

function reEnable(){
return true
}

//if IE4+
document.onselectstart=new Function ("return false")

//if NS6
if (window.sidebar){
document.onmousedown=disableselect
document.onclick=reEnable
}*/

/*    Fonction Affichage         */
function displayActuPage(numPage ,nombrePages ){
	
    for( var i=1 ; i <= nombrePages ; i++) {
         if(i == numPage)
         	{
         	document.getElementById("page"+i).style.display = "block";
         	document.getElementById("pagination"+i).className="on";
         	}
         else 
    		{
    		document.getElementById("page"+i).style.display = "none";
    		document.getElementById("pagination"+i).className="";
    		}
    
    }
}

/*OVERTURE ET FERMERTURE FAQ ENGAGEMENT*/
function OpenClose(index){
	my_obj=document.getElementById("resp"+index);
	my_link = document.getElementById("item"+index);
	if(my_obj.style.display=="block"){
		my_obj.style.display="none";
		my_link.className="off";
		my_link.parentNode.className="type";
	}
	else{
		my_obj.style.display="block";
		my_link.className="on";
		my_link.parentNode.className="type_on";
		}
	}
	
/*OUVERTURE ET FERMERTURE RECHERCHE AVANCEE*/
function OpenCloseLayer() {
		layer=document.getElementById("encartRechercheAvancee");
	if(layer.style.display=="block"){
		layer.style.display="none";
	}
	else{
		layer.style.display="block";
		}
}
