// affiche le menu
function displayMenu(L0, L1, D0, D1, language){
	var so = new SWFObject("swf/menu.swf", "flashMenu", "950", "60", "9", "#ffffff");
	so.addParam("scale", "noscale");
	so.addParam("allowFullScreen", "true");
	so.addParam("wmode", "transparent");
	so.addParam("menu", "false");
	so.addVariable("xmlFile", "swf/menu.php?language="+language);
	so.addVariable("L0", L0);
	so.addVariable("L1", L1);
	so.addVariable("D0", D0);
	so.addVariable("D1", D1);
	so.write("menu");
}

// affiche le flash de la home
function displayHome(){	
	var so = new SWFObject("swf/RdVideoHome.swf", "flashItem", "950", "478", "9", "#FFFFFF");
	so.addParam("scale", "noscale");
	so.addParam("allowFullScreen", "true");
	so.addParam("wmode", "opaque");
	so.addParam("menu", "false");
	so.addVariable("vidFile", "RdVideoHome.flv");
	so.addVariable("urlFr", "/collections.php");
	so.addVariable("urlEn", "/en/collections.php");
	so.addVariable("cible", "_top");	
	so.write("flashhome");	
	showDeadCenterDiv();
}

// affiche la vidéo
function displayVideo(language){
	if(language == 'fr')
		var so = new SWFObject("swf/playerSavoir.swf", "flashItem", "864", "480", "9", "#FFFFFF");
	else
		var so = new SWFObject("swf/playerSavoir-en.swf", "flashItem", "864", "480", "9", "#FFFFFF");
	so.addParam("scale", "noscale");
	so.addParam("allowFullScreen", "true");
	so.addParam("wmode", "opaque");
	so.write("video");
}

// affiche le flash partie fabrication
function displayFab(img){
	var so = new SWFObject("swf/RdFabrication.swf", "flashItem", "950", "470", "9", "#cccccc");
	so.addParam("scale", "noscale");
	so.addParam("allowFullScreen", "true");
	so.addParam("wmode", "transparent");
	so.addParam("menu", "false");
	so.addVariable("imgFile", "pics/"+img+".png");
	so.write("fabricationFlash");
}

// affiche le flash collection home
function displayCollectionHome(language){
	var so = new SWFObject("swf/RdCollectionHome.swf", "flashItem", "950", "410", "9", "#ffffff");
	so.addParam("scale", "noscale");
	so.addParam("allowFullScreen", "true");
	so.addParam("wmode", "transparent");
	so.addParam("menu", "false");
	so.addVariable("xmlFile", "swf/RdCollectionHome.php?language="+language);
	so.write("collectionHome");	
}

// affiche le flash collection opening
function displayCollectionOpening(collection, language){
	var so = new SWFObject("swf/RdCollectionOpening.swf", "flashItem", "950", "360", "9", "#ffffff");
	so.addParam("scale", "noscale");
	so.addParam("allowFullScreen", "true");
	so.addParam("wmode", "transparent");
	so.addParam("menu", "false");
	so.addVariable("xmlFile", escape("swf/RdCollectionOpening.php?id="+collection+"&language="+language));
	so.write("collectionOpening");
}

// gère l'item actif du menu
function setMenu(L1,L2) { $("flashMenu").setMenu(L1,L2); }

/* Gestion ajax points de vente */
function displayCountries(z){
	$("pays").update("<img src='pics/charte/ajax-loader.gif' width='16' height='16' alt='loading'/>");
	$("magasins").update("&nbsp;");
	CallAjax($H({zone: z}), "displayCountries");	
}
function displayShops(code){
	$("magasins").update("<img src='pics/charte/ajax-loader.gif' width='16' height='16' alt='loading'/>");
	CallAjax($H({pays: code}), "displayShops");	
}

// affiche le formulaire de contact
function showDeadCenterDiv() {	
	
	divid = 'flashhome';
	Xwidth = 850;
	Yheight = 478;	
	
	// First, determine how much the visitor has scrolled
	
	var scrolledX, scrolledY;
	if( self.pageYOffset ) {
	scrolledX = self.pageXOffset;
	scrolledY = self.pageYOffset;
	} else if( document.documentElement && document.documentElement.scrollTop ) {
	scrolledX = document.documentElement.scrollLeft;
	scrolledY = document.documentElement.scrollTop;
	} else if( document.body ) {
	scrolledX = document.body.scrollLeft;
	scrolledY = document.body.scrollTop;
	}
	
	// Next, determine the coordinates of the center of browser's window
	
	var centerX, centerY;
	if( self.innerHeight ) {
	centerX = self.innerWidth;
	centerY = self.innerHeight;
	} else if( document.documentElement && document.documentElement.clientHeight ) {
	centerX = document.documentElement.clientWidth;
	centerY = document.documentElement.clientHeight;
	} else if( document.body ) {
	centerX = document.body.clientWidth;
	centerY = document.body.clientHeight;
	}
	
	// Xwidth is the width of the div, Yheight is the height of the
	// div passed as arguments to the function:
	var leftOffset = scrolledX + (centerX - Xwidth) / 2;
	var topOffset = scrolledY + (centerY - Yheight) / 2;
	// The initial width and height of the div can be set in the
	// style sheet with display:none; divid is passed as an argument to // the function
	var o=document.getElementById(divid);
	var r=o.style;
	r.position='absolute';
	r.top = topOffset + 'px';
	//r.left = leftOffset + 'px';
	r.display = "block";
}
