// JavaScript Document
function datetime()
{       
	var now = new Date();
	var day = now.getDay();
	var date = now.getDate();
	var month = now.getMonth() +1;
	var year = now.getYear();
	var heure = now.getHours();
	var minutes = now.getMinutes();
	var divider = "h";
	var jour = "";
	var mois = "";

	if (year < 1900)
		year = year + 1900;

	if (day == 0) 		jour = "Dimanche";
	if (day == 1)		jour = "Lundi";
	if (day == 2)		jour = "Mardi";
	if (day == 3)		jour = "Mercredi";
	if (day == 4)		jour = "Jeudi";
	if (day == 5)		jour = "Vendredi";
	if (day == 6)		jour = "Samedi";

	if (month == 1)		mois = "janvier";
	if (month == 2)		mois = "f&eacute;vrier";
	if (month == 3)		mois = "mars";
	if (month == 4)		mois = "avril";
	if (month == 5)		mois = "mai";
	if (month == 6)		mois = "juin";
	if (month == 7)		mois = "juillet";
	if (month == 8)		mois = "ao&ucirc;t";
	if (month == 9)		mois = "septembre";
	if (month == 10)		mois = "octobre";
	if (month == 11)		mois = "novembre";
	if (month == 12)		mois = "d&eacute;cembre";

	return( jour + ", " + date + " " + mois   + " " + year + " - " + heure + divider + minutes  );
}

function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location=\""+selObj.options[selObj.selectedIndex].value+"\"");
  if (restore) selObj.selectedIndex=0;
}

function change(ref,image)
{
	if (ref != null) ref.src = image; return true;
}

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();
}

function getByID(id)
{
	if (document.all)
	{
		return document.all(id) ;
	}
	if(document.getElementById)
	{
		return document.getElementById(id) ;
	}
	alert(id+' not found') ;
}

function hide(id)
{
	alert(id);
  var o = getByID(id) ;
	if (o)
	{
		if (document.all)
		{
			o.display = "none" ;
		}
		if(document.getElementById)
		{
			o.style.display = "none" ;
		}
	}
}

function show(id)
{
	alert(id);
  var o = getByID(id) ;
	if (o)
	{
		if (document.all)
		{
			o.display = "block" ;
		}
		if(document.getElementById)
		{
			o.style.display = "block" ;
		}
	}
}

function hideongletsplus()
{
	hide('ong1on');
	hide('ong2on');
	hide('ong3on');
	hide('ong1off');
	hide('ong2off');
	hide('ong3off');
	hide('list1');
	hide('list2');
	hide('list3');
}

function hideongletsimm()
{
	hide('ongim1on');
	hide('ongim2on');
	hide('ongim1off');
	hide('ongim2off');
	hide('immann');
	hide('immannloc');
	hide('immrech');
}

function showHide(elem) {
  //alert(elem.id);
	if (elem.style.display=='block') {
		elem.style.display='none';
	}
	else {
		elem.style.display='block';
	}
}

function hideResports()
{
  if(navigator.appName == 'Netscape')
  {
    resultats = window.document.getElementsByName('resports');
    for(i=0; i<resultats.length; i++)
    {
      resultats[i].style.display='none';
    }
    les_plus = window.document.getElementsByName('b-resports-plus');
    for(i=0; i<les_plus.length; i++)
    {
      les_plus[i].style.display='block';
    }
    les_moins = window.document.getElementsByName('b-resports-moins');
    for(i=0; i<les_moins.length; i++)
    {
      les_moins[i].style.display='none';
    }
  }
  else
  {
    elements = window.document.getElementsByTagName('div');
    for(i=0; i<elements.length; i++)
    {
      if(elements[i].name == 'resports')
        elements[i].style.display='none';
    }
    elements = window.document.getElementsByTagName('img');
    for(i=0; i<elements.length; i++)
    {
      if(elements[i].name == 'b-resports-plus')
        elements[i].style.display='block';
      else
      { 
        if(elements[i].name == 'b-resports-moins')
          elements[i].style.display='none';
      }
    }
  }
}

//----------------------------------------------------------------------
//	Focntions en relations avec la barre d'outils des articles
//----------------------------------------------------------------------
var taille_texte=3;
var t;
if (t=readCookie('taille_texte')) taille_texte=t;


function augmenterTexte() 
{
	if (taille_texte==5) return;

	taille_texte = taille_texte+1;
	if (document.getElementById('divArticle')) 
	{
		var art = document.getElementById('divArticle');

		document.getElementById('divArticle').className='texte'+taille_texte;


		writeCookie('taille_texte',taille_texte);
	}
}
function diminuerTexte() 
{

	if (taille_texte==1) return;
	taille_texte=taille_texte-1;
	if (document.getElementById('divArticle')) 
	{
		var art=document.getElementById('divArticle');
		document.getElementById('divArticle').className='texte'+taille_texte;
		writeCookie('taille_texte',taille_texte);
	}
}
function readCookie(name) 
{
        var cname = '; ' + name + "=";
        var dc = '; '+document.cookie;

        if (dc.length > 0) 
	{
                begin = dc.indexOf(cname);
                if (begin != -1) 
		{
                        begin += cname.length;
                        end = dc.indexOf(";", begin);
                        if (end == -1) 	end = dc.length;

                        return unescape(dc.substring(begin, end));
                }
        }
        return null;
}
function writeCookie(name, value) 
{
        var expires = new Date();
        var pathname=location.pathname;
        var myDomain=pathname.substring(0,pathname.lastIndexOf('/')) +'/';

        expires.setTime(expires.getTime()+(365*24*3600*1000));

        document.cookie = name + "=" + escape(value) +
        ((expires == null) ? "" : "; expires=" + expires.toGMTString()) +
        ((pathname == null) ? "" : "; path=" + pathname) +
        ((myDomain == null) ? "" : "; domain=" + myDomain);
}

function hidePartager(id)
{
	var o = getByID(id) ;
	if (o)
	{
		if (document.all)
		{
			o.display = "none" ;
		}
		if(document.getElementById)
		{
			o.style.display = "none" ;
		}
	}
}

function showPartager(id)
{
	var o = getByID(id) ;
	if (o)
	{
		if (document.all)
		{
			o.display = "block" ;
		}
		if(document.getElementById)
		{
			o.style.display = "block" ;
		}
	}
}
function ouvrePopUp(url)
{
	//recuperation de l'url courant pour l'impression
	var urlImpression = url+"?url="+escape(window.location.href);
	window.open(urlImpression,'_blank','toolbar=0,location=0,directories=0,menuBar=0,scrollbars=1,resizable=1,width=640,height=608');

}
function envoiami(cle) 
{
	fen = window.open('/envoiami/index.php?cle='+cle+'&url='+document.location,"fenetre","width=430,height=380,scrollbars=0,toolbar=0,menubar=0,location=0,resizable=no,status=0");
}
function recupDomaine()
{
	var urlComplete	= window.location.href ;
	stopIndex	= urlComplete.indexOf("fr");
	url_sans_param	= urlComplete.substr(0,stopIndex)+"fr";

	return url_sans_param 
	
}
function ouvreFenetrePartager(urlPartage, url, nom)
{
	//on recherche le domaine et on reconstitu l'url
	var domaine = recupDomaine();
	var urlArt  = urlPartage+domaine+url;

	window.open(urlArt,'_blank','toolbar=0,location=0,directories=0,menuBar=0,width=924,height=608, scrollbars=yes,resizable=yes');
}
function signaler_abus(cle,id_com) 
{
	fen = window.open('/reactions/signaler/index.php?cle='+cle+'&id_com='+id_com+'&url='+document.location,"fenetre","width=430,height=200,scrollbars=0,toolbar=0,menubar=0,location=0,resizable=no,status=0");
}

//----------------------------------------------------------------------
// fonction killer frame par Davis S.
//----------------------------------------------------------------------
if (top.location != self.location) top.location.replace(self.location);