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






//----------------------------------------------------------------------
//	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);
	var urlImpression = url;
	window.open(urlImpression,'_blank','toolbar=0,location=0,directories=0,menuBar=0,scrollbars=1,resizable=1,width=640,height=608');

}
function envoiami(id) 
{
	fen = window.open('lib/sendfriend.php?id='+id+'&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 fbs_click() {
	u=location.href;
	t=document.title;
	window.open('http://www.facebook.com/sharer.php?u='+encodeURIComponent(u)+'&t='+encodeURIComponent(t),'sharer','toolbar=0,status=0,width=626,height=436');
	return false;
}