/**************************************************************************************************
 *
 * 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();
}

/**************************************************************************************************
 *
 * JAVASCRIPT DE CONNECTION
 *
 **************************************************************************************************/

function AF_IDMS_ConnectWrite()
{
	IDMSIDENT=GetCookie('IDENTIFIANT');

	if(IDMSIDENT)
	{
		IDMSTAB=IDMSIDENT.split("|");	
		IDMSOK='Mon compte <img src="/icones/f_orange.gif" width="5" height="9" border="0" hspace="5" /><a href="http://bourse.jdf.com/user/deconnection.html">Se déconnecter</a> | <a href="http://bourse.jdf.com/user/modifier.html">Votre profil</a>';
		document.write(IDMSOK);
	}
	else
	{
		IDMSNOK='Mon compte <img src="/icones/f_orange.gif" width="5" height="9" border="0" hspace="5" /><a href="http://bourse.jdf.com/user/accueil.html">Se connecter</a> | <a href="http://bourse.jdf.com/user/index.html">S\'inscrire</a>';
		document.write(IDMSNOK);
	}
}

function AF_IDMS_ConnectOn()
{
	document.location = 'http://bourse.jdf.com/user/accueil.html';
}

function AF_IDMS_ConnectOff()
{
	SetCookie('IDENTIFIANT','');
	document.location = 'http://bourse.jdf.com/user/deconnection.html';
}
function AF_IDMS_Portfolio()
{
	IDMSIDENT=GetCookie('IDENTIFIANT');
	IDMSFOLIO=GetCookie('NAME_PORTFOLIO');

	alert(IDMSFOLIO);
}


/**************************************************************************************************
 *
 * 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
				{	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');
}

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

function favoris() {
	if ( navigator.appName == 'Microsoft Internet Explorer' )
	{	window.external.AddFavorite("http://www.jdf.com/","Le JDF.com"); }
	else if (navigator.appName=='Netscape') {window.sidebar.addPanel("Le JDF.fr","http://www.jdf.com","");}
	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 jdf.com faites la combinaison de touches [CMD] + D'); }
}

/********** 21-COMFI **********/
function formfocus(elem,defaut){if(elem.value==defaut){elem.value="";}}
function formblur(elem,defaut){if(elem.value==""){elem.value=defaut;}}

/********* 18-ARCHIVE *********/
function archive_zoom(elem){
//getElementsById("News").style.overflow="auto";
elem.getElementsByTagName("div")[0].style.display="block";
}
function archive_dezoom(elem){elem.style.display="none";}

