//*******************************************************************
// 05-18-09 Yuri Suzuki - Display Flash 
//                                  code provided by Sebastien Sanger from Triade Agency
//*******************************************************************

// affichages du flash

var popup = null;
var swf = null;
var masque = null;
var isIE6 = false;
var closing = null;
var hauteurInit = 650;

function modifImageSize (hauteur) {

	rechercheNav=RegExp("MSIE [0-9]+\.[0-9]+");
	
	var hauteurEcran = null;
	if (navigator.appVersion.match(rechercheNav)) {
		document.getElementsByTagName("html")[0].style.height = "100%";
		document.body.style.height = "100%";
		hauteurEcran = document.body.clientHeight-100;
	} else {
		hauteurEcran = window.innerHeight-100;
	}
	var facteur = (hauteur>hauteurEcran) ? hauteurEcran/hauteur : 1;
	return facteur;
}

function virtualPopup (width, height)
{
	var newWidth = Math.round(width*modifImageSize (hauteurInit));
	var newHeight = Math.round(height*modifImageSize (hauteurInit));
	rechercheNav=RegExp("MSIE [0-6].?[0-9]");

	if (navigator.appVersion.match(rechercheNav)) { 
    isIE6 = true;
    document.getElementsByTagName("html")[0].style.overflow = "hidden"; /*window.scrollTo(window.scrollX,document.body.scrollTop)*/
  };
	
	popup = document.createElement("div");
	popup.setAttribute("id", "popup");
	masque = document.createElement("div");
	masque.setAttribute("id", "masque");
	swf = document.createElement("div");
	swf.setAttribute("id", "swf");
	popup.appendChild(masque);
	popup.appendChild(swf);
	swf.style.width = newWidth+"px";
	swf.style.height = newHeight+"px";
	swf.style.marginLeft = "-"+((newWidth+2)/2)+"px";
	swf.style.marginTop = "-"+((newHeight+2)/2)+"px";
	document.body.appendChild(popup);
	
	swf = document.getElementById('swf');
	masque = document.getElementById('masque');
	
	swf.innerHTML = '<p id="closing"><a href="javascript:removeDIV()" title="close">X</a></p><div id="animationFlash"></div>';
	
	setStyle();
	
	var expressInstall = null;
                var flashVars = null;
	var parametres = {wmode:"transparent"};
	var attributs = {id:"animationFlash"};

	swfobject.embedSWF("https://www.sodexhocmsstaging.com/group_en/Images/sodexo_tcm13-287366.swf", "animationFlash", "100%", "100%", "8.0.24", expressInstall, flashVars, parametres, attributs);

		
	masque.onclick = removeDIV;
	

}
function removeDIV ()
{
	if (isIE6) document.documentElement.style.overflow = "auto";
	popup.parentNode.removeChild(popup);
}

function setStyle() {
	with (popup.style)
	{
		position = "fixed";
		top = "0";
		left = "0";
		zIndex = "99";
		height = "100%";
		width = "100%";
	}
	with (masque.style)
	{
		position = "absolute";
		top = "0";
		left = "0";
		background = "#000000";
		opacity = "0.75";
		filter = "alpha(opacity=75)";
		width = "100%";
		height = "100%";
		zIndex = "2";
	}
	with (swf.style)
	{
		background = "#72797F";
		position = "absolute";
		zIndex = "3";
		left = "50%";
		top = "50%";
		border = "1px solid #FFFFFF";
		textAlign = "left";
	}
	with (document.getElementById("closing").style)
	{
		display = "block";
		margin = "0";
		width = "10px";
		height = "10px";
		position = "absolute";
		right = "-15px";
		background = "no-repeat";
		top = "0px";
		textAlign = "center";
	}
	with (document.getElementById("closing").firstChild.style)
		{
			display = "block";
			background = "#ffffff";
			display = "block";
			height = "100%";
			width = "100%";
			font = "bold 9px/10px Arial, sans-serif";
			color = "#990000";
			textDecoration = "none";
		}
	document.getElementById("closing").firstChild.onmouseout = function () {
		document.getElementById("closing").firstChild.style.color = "#990000";
	}
	document.getElementById("closing").firstChild.onmouseover = function () {
		document.getElementById("closing").firstChild.style.color = "#FF0000";
	}
	if (isIE6) {
		popup.style.position = "absolute";
    	popup.style.top = (document.documentElement.scrollTop || document.body.scrollTop) + document.documentElement.offsetHeight - document.documentElement.offsetHeight;
	}
}