function writeG() 
{ return true;
	// détection navigateur + manière de retourner la width et height
	var ua = navigator.userAgent.toLowerCase();
    var isStrict = document.compatMode == 'CSS1Compat',
        isOpera = ua.indexOf("opera") > -1,
        isIE = ua.indexOf('msie') > -1,
        isIE7 = ua.indexOf('msie 7') > -1,
        isBorderBox = isIE && !isStrict,
        isSafari = (/webkit|khtml/).test(ua),
        isSafari3 = isSafari && !!(document.evaluate),
        isGecko = !isSafari && ua.indexOf('gecko') > -1,
        isWindows = (ua.indexOf('windows') != -1 || ua.indexOf('win32') != -1),
        isMac = (ua.indexOf('macintosh') != -1 || ua.indexOf('mac os x') != -1),
        isLinux = (ua.indexOf('linux') != -1);
	
	var absolute_pos = isIE && !isIE7;
	 
	var height = window.innerHeight; // Safari
	var mode = document.compatMode;
	if((mode || isIE) && !isOpera){
		var h = isStrict ? document.documentElement.clientHeight : document.body.clientHeight;
	}


	var width = window.innerWidth; // Safari
	var mode = document.compatMode;
	if(mode || isIE){
		var w = isStrict ? document.documentElement.clientWidth : document.body.clientWidth;
	}

   var scrollHeight = isStrict ? document.documentElement.scrollHeight : document.body.scrollHeight;
   var scrollWidth = isStrict ? document.documentElement.scrollWidth : document.body.scrollWidth;
   
   var realH = Math.max(scrollHeight, h);
   var realW = Math.max(scrollWidth, w);
	
	
	// flash + append
	//var top = (realH/2)-(700/2);
	var top = (realH/2)-(650/2);
    var left = (realW/2)-(950/2);
	/*var top = 0;
    var left = 0;
    var swfW = 1200;
    var swfH = 800;*/
	var swfW = 950;
    var swfH = 650;
   // var swf = 'http://www.vahine.fr/fileadmin/animHome/anim_home2.swf';
   var swf = 'http://www.vahine.fr/fileadmin/ppg/flashTransparent_v1.swf';
    
    var body_node = document.body;
    var css = '#container-flash {top:'+top+'px;left:'+left+'px;position:absolute;z-index:2000;} #container-bg {position:absolute;top:0;left:0;width:'+realW+'px;height:'+realH+'px;background-color:#FFFFFF;z-index:1999;opacity:0.8;filter:alpha(opacity=80);}';
     
    var style_node =  document.createElement("style"); 
    style_node.setAttribute('type', 'text/css');       
    
    if(style_node.styleSheet){// IE
        style_node.styleSheet.cssText = css;
    } else {// w3c
        var style_data = document.createTextNode(css);
        style_node.appendChild(style_data);
    }
    body_node.appendChild(style_node);
    
    // create div
	
	var mother_div_node = document.createElement("div");
	mother_div_node.setAttribute('id', 'container-bg');
	mother_div_node.setAttribute('onclick',"fermerFlash");
	mother_div_node.onclick = fermerFlash;
	
    var div_node =  document.createElement("div");
    div_node.setAttribute('id', 'container-flash');

  body_node.appendChild(mother_div_node);
	body_node.appendChild(div_node);  
	
	
	
    var so = new SWFObject(swf, "pixmania", swfW, swfH, "8", "#000000");
    so.addParam("wmode", "transparent");
    so.addParam("quality", "high");
	so.addVariable("lienGamme", "http://www.vahine.fr/?id=465");
    so.write("container-flash");	
	


	
}


function fermerFlash(){
	
	/*var a = document.getElementById("container-flash");
	tyty = a.removeChild(document.getElementById("puy_fou"));*/
	tutu = document.body.removeChild(document.getElementById("container-flash"));
	toto = document.body.removeChild(document.getElementById("container-bg"));
	
	// pb : sous FF, Qd le remove est fait, le curseur est déjà en mode sélection et dès qu'on déplace la souris, le texte est sélectionné,
	// il faut re-cliquer pour désélectionner
		
	// enlève le mode sélection sous FF MAIS impossible de sélectionner du texte pendant tout le temps ou on est sur la page 
	document.getElementById('page').style.MozUserSelect ="none";
	
	// sinon essayer de donner le focus à un autre élément
	
}

function EcrireCookie(nom, valeur)
{
	var argv=EcrireCookie.arguments;
	var argc=EcrireCookie.arguments.length;
	var expires=(argc > 2) ? argv[2] : null;
	var path=(argc > 3) ? argv[3] : null;
	var domain=(argc > 4) ? argv[4] : null;
	var secure=(argc > 5) ? argv[5] : false;
	document.cookie=nom+"="+escape(valeur)+
	((expires==null) ? "" : ("; expires="+expires.toGMTString()))+
	((path==null) ? "" : ("; path="+path))+
	((domain==null) ? "" : ("; domain="+domain))+
	((secure==true) ? "; secure" : "");
}


function getCookieVal(offset)
{
	var endstr=document.cookie.indexOf (";", offset);
	if (endstr==-1) endstr=document.cookie.length;
	return unescape(document.cookie.substring(offset, endstr));
}

function LireCookie(nom)
	{
	var arg=nom+"=";
	var alen=arg.length;
	var clen=document.cookie.length;
	var i=0;
	while (i<clen)
	{
	var j=i+alen;
	if (document.cookie.substring(i, j)==arg) return getCookieVal(j);
	i=document.cookie.indexOf(" ",i)+1;
	if (i==0) break;

}
return null;
}


function UpdateTimer()
{
	if(jQuery("#flash-replace-anim_home").attr("id") != undefined) {
		clearTimeout(timerID);
		timerID  = 0; 
		writeG();
	}
}


jQuery(document).ready(function(){
	/*if(jQuery.browser.msie) {
		if (typeof(windowOnLoad) != 'undefined') {
		   windowOnLoad.push(writeG);
		} else {
		   window.onload = function () {
			   writeG();
			}
		}
	}
	else{
		window.alert("firefox");
		if (typeof(windowOnLoad) != 'undefined') {
			   windowOnLoad.push(writeG);
		} else {
		   window.onload = function () {
			   writeG();
			}
		}
	}*/
	
	if(LireCookie("dejavenuPPG")==null){
			writeG();
		EcrireCookie("dejavenuPPG", "oui");
		setTimeout("fermerFlash()", 20000) 
	}
	
	
});
