
	// config SWF Object
	var flashvars = {
		//tassimoOffer: 1, // onglet tassimo
		contentPath: "",
		basePath: "",
		source: swfobject.getQueryParamValue("source"),
		uid: swfobject.getQueryParamValue("uid"),
		preFill: swfobject.getQueryParamValue("invite"),
		autoOpen: swfobject.getQueryParamValue("voir"),
		sid: swfobject.getQueryParamValue("sid")
	};
	
	var email = swfobject.getQueryParamValue("email");
	if (email) 
	{
		if (!flashvars.autoOpen) flashvars.autoOpen = "inscription";
		flashvars.email = unescape(email);
	}
	
	var params = {
		menu: "false",
		scale: "noScale",
		allowFullscreen: "true",
		allowScriptAccess: "always",
		bgcolor: "#000000",
		wmode: "opaque",
		base: ""
	};
	var attributes = {
		id:"DMShell"
	};

	//if ($.browser.mozilla) delete params.wmode;

	function init(basePath, contentPath)
	{
		var v = swfobject.getQueryParamValue("v");
		if (v && v.length > 0) v = "?v=" + v;

		flashvars.contentPath = contentPath;
		params.base = basePath;
		swfobject.embedSWF(basePath + "dmloader.swf" + v, "altContent", "100%", "100%", "9.0.0",
			basePath + "desiretmoi/swf/expressInstall.swf",
			flashvars, params, attributes);
	}

	// tracking

	function track(site, page)
	{
		sa_onclick("http://www.dunoirnaitledesir.com/" + site + "/index.swf?flashpage=" + page);
		pageTracker._trackPageview("/" + site + "/" + page);
	}

	function smartAd(page)
	{
		var div = document.getElementById("smartad");
		div.innerHTML = '<iframe src="' + page + '" /></iframe>';
	}

	// layers HTML

	var viewWidth;
	var viewHeight;
	var viewLayer;
	var maskLayer;

	function centerOverlay(w, h)
	{
		viewWidth = w;
		viewHeight = h;

		moveLayer();
	}

	function moveLayer()
	{
		if (viewLayer)
			$(viewLayer).css({
				left: Math.round((viewWidth - 900) / 2),
				top: Math.round((viewHeight - 500) / 2)
			});
	}

	function createViewLayer()
	{
		if (viewLayer) viewLayer.empty();
		else viewLayer = $('<div></div>').css({ position:"absolute", width:1, height:1 });
	}

	function showViewLayer()
	{
		moveLayer();
		viewLayer.appendTo($("body"));
	}

	function showMaskLayer()
	{
		if (maskLayer) return;
		maskLayer = $("<div></div>").css({ position:"absolute", top:0, left:0,
			background:"#000", width:"100%", height:"100%", opacity:0.7 });
		maskLayer.appendTo($("body"));
	}

	function showCouponsIFrame(src)
	{
		createViewLayer();

		$('<iframe id="highco" frameborder="0" scrolling="no" allowTransparency="true"></iframe>')
			.css({ position:"absolute", top:78, left:0, width:895, height:410,
				background:"url('img/ajax-loader.gif') no-repeat center #000" })
			.attr("src", src)
			.appendTo(viewLayer);

		showViewLayer();
	}

	function hideCouponsIFrame()
	{
		if (viewLayer)
		{
			$(viewLayer).remove();
			viewLayer = null;
		}
	}

	function couponsPrintedConfirmation()
	{
		document.getElementById(attributes.id).couponsPrintedConfirmation();
	}


	function playerAllocine(url)
	{
		if (viewLayer) return;
		showMaskLayer();

		createViewLayer();

		//url = "http://www.allocine.fr/blogvision/18942606";
		var src = "<a href='#' class='close'>X</a>"
		+"<object width='720' height='576'>"
		+"<param name='player' value='"+url+"'></param>"
		+"<param name='bgcolor' value='#000000'></param>"
		+"<param name='allowFullScreen' value='true'></param>"
		+"<param name='allowScriptAccess' value='always'></param>"
		+"<embed src='"+url+"' type='application/x-shockwave-flash' width='720' height='576' bgcolor='#000000' allowFullScreen='true' allowScriptAccess='always'/>"
		+"</object>";

		var content = $("<div></div>").css({ position:"relative", top:-40, left:90 }).html(src);
		content.find("a")
			.css({ position:"absolute", top:0, left:720, width:20, height:20,
				background:"#333", color:'#E4C281', "text-align":"center", "text-decoration":"none" })
			.click(closeAllocine);
		content.appendTo(viewLayer);

		showViewLayer();
	}

	function closeAllocine(e)
	{
		e.preventDefault();
		viewLayer.find("a").remove();
		setTimeout("clearAllocine()", 200);
		return false;
	}

	function clearAllocine()
	{
		if (viewLayer)
		{
			viewLayer.remove();
			viewLayer = null;
		}
		if (maskLayer)
		{
			maskLayer.remove();
			maskLayer = null;
		}
	}

