/**************************************************************************************************
 *
 * FONCTIONS DIVERSES
 *
 **************************************************************************************************/
/*
	AFOpen : Ouvre une Fenêtre
*/
function AFOpen(url,name,width,height) 
{
  var opt = "top=0,left=0,resizable=yes,toolbar=yes,scrollbars=yes,menubar=no,location=yes,statusbar=yes";
  opt += ",width=" + width + ",height=" + height;
  var win = window.open(url,name,opt).focus();
}
/*
	AFOpenFS : Ouvre une Fenêtre en Full Screen
*/
function AFOpenFS(url,name) 
{
  var opt = "top=0,left=0,resizable=yes,toolbar=no,scrollbars=auto,menubar=no,location=no,statusbar=yes";
  opt += ",width=" + screen.width + ",height=" + screen.height;
  name = new String('openfs');
  var win = window.open(url,name,opt).focus();
}

function FigaroPrint()
{
	url = document.location.href + '?mode=imprimer';
  	opt = "top=0,left=0,resizable=yes,toolbar=no,scrollbars=yes,menubar=yes,location=no,statusbar=no,width=600,height=700";
	window.open(url,'imprimer',opt).focus();
}

function openwin(ow) { 
url = '/scripts/pop.htm?' + ow;
fen = window.open(url,"fenetre","width=350,height=350,scrollbars=1,toolbar=0,menubar=0,location=0,resizable=yes,status=0");
}



/**************************************************************************************************
 *
 * COOKIES
 *
 **************************************************************************************************/

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

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

function GetCookie (name) {
	var arg=name+"=";
	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;
}


/**************************************************************************************************
 *
 * ELEMENTS PAR ID (show/hide)
 *
 **************************************************************************************************/

function getByID(id)
{
	if (document.all)
	{
		return document.all(id) ;
	}
	if(document.getElementById)
	{
		return document.getElementById(id) ;
	}
}
function hide(id)
{
	var o = getByID(id) ;
	if (o)
	{
		if (document.all)
		{
			o.display = "none" ;
		}
		if(document.getElementById)
		{
			o.style.display = "none" ;
		}
	}
}
function show(id)
{
	var o = getByID(id) ;
	if (o)
	{
		if (document.all)
		{
			o.display = "visible" ;
		}
		if(document.getElementById)
		{
			o.style.display = "block" ;
		}
	}
}


/**************************************************************************************************
 *
 * DIAPORAMAS / MEDIACENTER
 *
 **************************************************************************************************/

function FigDiapo(bigdst,bigmax,mindst,minnbr) 
{
        this.Idx = 1;				/* Element en cours */
        this.Max = bigmax;			/* Nombre total d'Affiches */
	this.MinNbr = minnbr;			/* Nombre de "Miniatures" par Objet */

	this.BigDst = bigdst;			/* Préfix des Affiches */
	this.MinDst = mindst;			/* Préfix des Miniatures */
	this.OBigDst = getByID(bigdst);		/* Objet "Affiche" à remplir */
	this.OMinDst = getByID(mindst);		/* Objet "Miniature" à remplir */

	for(i=1;i<=this.Max;i++)
	{	
		hide(this.BigDst + '_' + i);
		hide(this.MinDst + '_' + i);
	}

        this.next = function() {
                this.Idx++;
		if(this.Idx > this.Max)
			this.Idx = 1;
		this.affiche();
        }

        this.prev = function() {
                this.Idx--;
		if(this.Idx < 1)
			this.Idx = this.Max
		this.affiche();
        }

        this.iset = function(i) {
                this.Idx = i;
		this.affiche();
        }

	this.affiche = function() {

		/* On Remplace le contenu de l'Affiche */
		if(this.OBigDst)
		{	OBigSrc = getByID(this.BigDst + '_' + this.Idx);
			this.OBigDst.innerHTML = OBigSrc.innerHTML;
		}

		/* On Remplace le contenu de la liste des Miniatures */
		if(this.OMinDst)
		{
			nb=0;
			this.OMinDst.innerHTML = "";
			for(i=this.Idx;nb<=this.MinNbr;i++)
			{	if(i<=this.Max)
				{	nb++;
					OMinScr = getByID(this.MinDst + '_' + i);
					this.OMinDst.innerHTML += OMinScr.innerHTML;
				}
				else if (this.Idx == 1)
				{	
				
			//	this.OMinDst.innerHTML = "";
					break;
					
				} else {
					
					i=0;
				}
			}
		}

		
	} 
	this.affiche();
}

/**************************************************************************************************
 *
 * ZOOM                          
 *
 **************************************************************************************************/

function FigZoom(bigmax,mindst,minnbr) 
{
        this.Idx = 1;				/* Element en cours */
        this.Max = bigmax;			/* Nombre total d'Affiches */
	this.MinNbr = minnbr;			/* Nombre de "Miniatures" par Objet */

	this.MinDst = mindst;			/* Préfix des Miniatures */
	this.OMinDst = getByID(mindst);		/* Objet "Miniature" à remplir */

	for(i=1;i<=this.Max;i++)
	{	
		hide(this.MinDst + '_' + i);
	}

        this.next = function() {
                this.Idx++;
		if(this.Idx > this.Max)
			this.Idx = 1;
		this.affiche();
        }

        this.prev = function() {
                this.Idx--;
		if(this.Idx < 1)
			this.Idx = this.Max
		this.affiche();
        }

        this.iset = function(i) {
                this.Idx = i;
		this.affiche();
        }

	this.affiche = function() {

		/* On Remplace le contenu de la liste des Miniatures */
		if(this.OMinDst)
		{
			nb=0;
			this.OMinDst.innerHTML = "";
			for(i=this.Idx;nb<=this.MinNbr;i++)
			{	if(i<=this.Max)
				{	nb++;
					OMinScr = getByID(this.MinDst + '_' + i);
					this.OMinDst.innerHTML += OMinScr.innerHTML;
				}
				else
				{	i=0;
				}
			}
		}

		
	} 
	this.affiche();
}

function opensenat(){
window.open('http://www.lefigaro.fr/live_streaming/player_whigh.html','','toolbar=no,location=no,status=no,menubar=no,scrollbars=no,resizable=no,width=285,height=335');
}

/**************************************************************************************************
 *
 * Favoris   & verif pour page de demarrage                       
 *
 **************************************************************************************************/

function favoris() {
	if ( navigator.appName == 'Microsoft Internet Explorer' )
	{	window.external.AddFavorite("http://www.lefigaro.fr/","Le Figaro.fr"); }
	else if (navigator.appName=='Netscape') {window.sidebar.addPanel("Le Figaro.fr","http://www.lefigaro.fr","");}
	else if (navigator.appName=='Opera'){ alert('Vous utilisez Opéra. Pour ajouter à vos Favoris le site du FIGARO.fr faites la combinai son de touches [CLTR] + D'); }
	else { alert('Pour ajouter à vos Favoris le site du FIGARO.fr faites la combinaison de touches [CMD] + D'); }
}
<!--
var BrowserDetect = {
	init: function () {
		this.browser = this.searchString(this.dataBrowser) || "An unknown browser";
		this.version = this.searchVersion(navigator.userAgent)
			|| this.searchVersion(navigator.appVersion)
			|| "an unknown version";
		this.OS = this.searchString(this.dataOS) || "an unknown OS";
	},
	searchString: function (data) {
		for (var i=0;i<data.length;i++)	{
			var dataString = data[i].string;
			var dataProp = data[i].prop;
			this.versionSearchString = data[i].versionSearch || data[i].identity;
			if (dataString) {
				if (dataString.indexOf(data[i].subString) != -1)
					return data[i].identity;
			}
			else if (dataProp)
				return data[i].identity;
		}
	},
	searchVersion: function (dataString) {
		var index = dataString.indexOf(this.versionSearchString);
		if (index == -1) return;
		return parseFloat(dataString.substring(index+this.versionSearchString.length+1));
	},
	dataBrowser: [
		{
			string: navigator.vendor,
			subString: "Apple",
			identity: "Safari"
		},
		{
			prop: window.opera,
			identity: "Opera"
		},
		{
			string: navigator.vendor,
			subString: "iCab",
			identity: "iCab"
		},
		{
			string: navigator.vendor,
			subString: "KDE",
			identity: "Konqueror"
		},
		{
			string: navigator.userAgent,
			subString: "Firefox",
			identity: "Firefox"
		},
		{		// for newer Netscapes (6+)
			string: navigator.userAgent,
			subString: "Netscape",
			identity: "Netscape"
		},
		{
			string: navigator.userAgent,
			subString: "MSIE",
			identity: "Explorer",
			versionSearch: "MSIE"
		},
		{
			string: navigator.userAgent,
			subString: "Gecko",
			identity: "Mozilla",
			versionSearch: "rv"
		},
		{ 		// for older Netscapes (4-)
			string: navigator.userAgent,
			subString: "Mozilla",
			identity: "Netscape",
			versionSearch: "Mozilla"
		}
	],
	dataOS : [
		{
			string: navigator.platform,
			subString: "Win",
			identity: "Windows"
		},
		{
			string: navigator.platform,
			subString: "Mac",
			identity: "Mac"
		},
		{
			string: navigator.platform,
			subString: "Linux",
			identity: "Linux"
		}
	]

};
BrowserDetect.init();
// -->
function verif () {

switch(BrowserDetect.browser) {

case "Firefox":
alert ('Utilisateur de Firefox, glissez l\'icon à gauche de l\'adresse url dans la petite maison de démarrage' );
break;

case "Opera":
alert ('Utilisateur d\'Opéra, tapez [CLTR] F12 puis tapez l\'adresse                "http://www.lefigaro.fr" dans le champs prévu à cet effet' );
break;

case "Safari":
alert ('Utilisateur de Safari, glissez l\'icon à gauche de l\'adresse url dans la petite maison de démarrage' );
break;

}
}

/**************************************************************************************************
 *
 * QCM
 *
 **************************************************************************************************/

var qcmdate=new Date(2015, 12, 31);
var qcmhost='lefigaro.fr';

function FigQCM(obj,qcm,hvote,hresu,statut,votants) 
{
        this.obj = getByID(obj);		/* Identifiant de l'Objet recevant le code HTML */
        this.qcm = 'Q' + qcm;			/* Id QCM */
        this.hvote = hvote;			/* HTML Formulaire de vote */
	this.hresu = hresu;			/* HTML Affichage des résultats */
	this.statut = statut;			/* Statut du Sondage (A|O|F) */
	this.votants = votants;			/* Nb Votants du Sondage */

	this.idcount = 'QCM' + qcm + '-votants';
        this.objcount = getByID(this.idcount);


	this.cookie = GetCookie(this.qcm);

	if(this.cookie)
	{
		this.tab=this.cookie.split("-");
		this.cvote=this.tab[0];
		this.cmode=this.tab[1];
		this.clast=this.tab[2];
	}
	else
	{
		this.cvote=this.qcm;
		this.cmode='V';
		this.clast='';
		this.cookie = this.cvote + '-' + this.cmode + '-' + this.clast
		SetCookie(this.qcm,this.cookie,"/",null,qcmhost);
	}

	this.affiche = function() {
		if(this.statut == 'F')
			this.obj.innerHTML += this.hresu;
		else
		{
			if(this.cmode == 'R' || this.cmode == 'X' || this.cmode == 'A')
				this.obj.innerHTML += this.hresu;
			else
				this.obj.innerHTML += this.hvote;
		}

		if(this.objcount)
			this.objcount.innerHTML = this.votants;
		
	} 
	this.affiche();
}
function FigQCMVote(qcm,vote,url) {
	var mod;
	ncookie = 'Q' + qcm;	
	c = GetCookie(ncookie);
	if(c)
	{
		tab = c.split("-");
		mod = tab[1];
	}

	if(mod=='R'||mod=='X')
		mod='X';
	else
		mod='R';

	cookie = vote + '-' + mod + '-' + qcm
	SetCookie(ncookie,cookie,"/",qcmdate,qcmhost);
	document.location=url;
}
function FigQCMVoir(qcm,url) {
	var mod;
	ncook = 'Q' + qcm;	
	c = GetCookie(ncook);
	if(c)
	{
		tab = c.split("-");
		mod = tab[1];
	}

	if(mod=='R'||mod=='X')
		mod='X';
	else
		mod='A';
	cookie = vote + '-' + mod + '-' + qcm
	ncookie = 'Q' + qcm;
	SetCookie(ncookie,cookie,"/",qcmdate,qcmhost);
	document.location=document.location;
}


/**************************************************************************************************
 *
 * VIDEO PLAYER
 *
 **************************************************************************************************/


function FigVideo(idobj,bigdst,mindst,liste) 
{
        this.Idx = 0;				/* Element en cours */
	this.IdObj = idobj;			/* IDENTIFIANT DE L'OBJET */
	this.Liste = liste;			/* Tableau des données */
	this.BigDst = bigdst;			/* Id Bloc Video */
	this.MinDst = mindst;			/* Id Bloc des Miniatures */
	this.OBigDst = getByID(bigdst);		/* Objet "Video" à remplir */
	this.OMinDst = getByID(mindst);		/* Objet "Miniature" à remplir */


	this.MinBuf = '';
	for (i=0;i<this.Liste.length;i++)
	{
		this.MinBuf += '<a href="JavaScript:' + this.IdObj + '.iset('+ i + ');"><img class="vignette" src="' + this.Liste[i][4] + '" border="0" /></a>';
		this.MinBuf += '<div class="tit"><a href="JavaScript:' + this.IdObj + '.iset('+ i + ');">' + this.Liste[i][1] + '</a></div>';
		this.MinBuf += '<div class="separe">&nbsp;</div>';
	}
	if(this.OMinDst)
	{
		this.OMinDst.innerHTML = this.MinBuf;
	}
	
        this.iset = function(i) {
                this.Idx = i;
		this.affiche();
        }

	this.affiche = function() {
		this.BigBuf = '';	

		this.BigBuf += '<object type="application/x-shockwave-flash" data="http://sa.kewego.com/swf/p3/epix.swf" width="240" height="182">';
		this.BigBuf += '<param name="flashVars" value="language_code=fr&playerKey=f5c5b9689b58&skinKey=0e1ec0f6f089&sig='+ this.Liste[this.Idx][5] + '&autostart=false" />';
		this.BigBuf += '<param name="movie" value="http://sa.kewego.com/swf/p3/epix.swf" />';
		this.BigBuf += '<param name="allowFullScreen" value="true" />';
		this.BigBuf += '<param name="allowscriptaccess" value="always" />';
		this.BigBuf += '</object>';
		this.BigBuf += '<br/>';



		this.BigBuf += '<span class="titre">'+ this.Liste[this.Idx][1] + '<br /></span>';
		this.BigBuf += '<span class="orange">Durée : ' + this.Liste[this.Idx][2] + ' le ' + this.Liste[this.Idx][6] +' </span>';
		this.BigBuf += '<div class="clear">&nbsp;</div>';

		/* On Remplace le contenu de l'Affiche */
		if(this.OBigDst)
		{
			this.OBigDst.innerHTML = this.BigBuf;
		}
	} 
	this.affiche();
}



/**************************************************************************************************
 *
 * Pour Commentaires
 *
 **************************************************************************************************/
var figcom_sep_bulle=false;
