// source du code compressé avec http://dean.edwards.name/packer/

// utile pour rebasculer rapidement en version draft
var baseurl = 'http://dascritch.net' ;
// tu t'es vu quand tu me frame ?
if (top.location != self.location)
	{
		top.location = self.location.href;
	} //naaaaaaaaaaaaan mais !
var noanim = false;
var minisom = false;
// avec Fx.Slide, Element.Event, Window.DomReady, Window.Size, Fx.Style, Fx.Styles, Fx.Transitions, Plugin.smoothScrool, Plugin.Tips

var masquable = new Object();
var attendu=true;
var navigateurdemairde=false;
MSIEgroscon();
// addEvent(window, "load", stage5);
// var lien_e = [];
// var _e=0;
// var lien_i = [];
// var _i=0;

//insererlibjs(baseurl+'/themes/DSN11/js/jquery.js');
//insererlibjs(baseurl+'/themes/DSN11/js/jquery.lightbox.X.js');

var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-81365-1']);
_gaq.push(['_trackPageview']);
insererlibjs('http://google-analytics.com/ga.js');
//stageG();


if (/post\//.test(self.location.href))
{
	var post_remember_str = 'Se souvenir de moi ... sur ce blog';
	insererlibjs(baseurl+'/themes/DSN11/js/jquery.cookie.js');
	insererlibjs(baseurl+'/themes/DSN11/js/post.js');
}

/*window.addEvent('domready', function(){
  alert('the dom is ready');
});
j'aurais aimé que ça marche, mais pas hélas en mm temps que insererlibjs


avec jquery, on fera http://dev.jquery.com/ticket/919

tout ça parce que http://www.google.com/search?num=50&hl=en&safe=off&client=firefox-a&rls=org.mozilla%3Aen-US%3Aofficial&hs=MjY&q=%22the+page+cannot+be+displayed%22+internet+explorer+javascript+dom&btnG=Search

*/

new domFunction(showtime);

function kimkay(stage) {
//* débuggueur
//	document.getElementById('hotbar').style.backgroundColor=stage;
};

function showtime() {
;;;	 if (document.body)	{kimkay('green');} else {kimkay('#770000');}

	if (document.getElementById('hotbar').style.visibility!='visible')
	{

	// if (document.all) {MSIEgroscretin();} /// DESACTIVE 14/03/2011 : MSIE n'existe plus, non de dieu

	var masqueurs=GetElementsWithClassName('*','masqueur');
	document.getElementById('hotbar').style.visibility='visible';
	insererbar();
	document.getElementById('wrapper').style.backgroundColor=readCookie('bg');
	var zoomfactor=readCookie('zoom');
	document.body.style.fontSize=zoomfactor;
	// inserergoo(); /// DESACTIVE 14/03/2011 la double recherche, finalement, c'est confusionnant
	insererpop();
	noanim=(readCookie('noanim')==='true'?true:false);
	inserermel();
//	insereraddthis();
	insererh3res();
	inserertxa();
	insereraext();
	if (navigateurdemairde) MSIEgrosnul();
//	if (window.Fx) {stage4();} // MISE gueule tout le temps
	if ((typeof(jQuery) != 'undefined')) {stage4();}

/*	insererlibjs(baseurl+'/js/prototype.js');
	insererlibjs(baseurl+'/js/effects.js');
	insererlibjs(baseurl+'/js/lightbox.js');*/

	} else {
;;;		kimkay('red');
	}
};


function stage4() {
	attendu=false;
	inserermasq();
	if (minisom) {$('#minisom_m').slideDown();};
	inserertip();


$(function(){
			$.Lightbox.construct(/*{
				show_info:true,
				show_linkback:	false,
				download_link:false,
				text: {
					of:'de',close:'fermer'
				},
				files: {
					images: {prev:'/nav/icons/48/action-1left.png',
					next:'/nav/icons/48/action-1right.png',
					loading:'/nav/smallwaitanim.gif'},
				}
			}*/);
		});
};



window.onload = function stage5() {
	if (attendu) {stage4();}
};


//http://simon.incutio.com/js/getElementsBySelector.js
//http://simon.incutio.com/archive/2003/03/25/getElementsBySelector
// A REVOIR en prenant http://css.viapanda.com/getElementsBySelector/
// NAN trouvé sur http://www.webmaster-hub.com/lofiversion/index.php/t21834.html
/****** getElementsBySelector DEBUT */
function hasClass(object, className) {
	if (!object.className) {return false;}
	return (object.className.search('(^|\\s)' + className + '(\\s|$)') != -1);
};

function GetElementsWithClassName(elementName,className) {
	var allElements = document.getElementsByTagName(elementName);
	var elemColl = new Array();
	for (var i = 0; i< allElements.length; i++) {
		if (hasClass(allElements[i], className)) elemColl[elemColl.length] = allElements[i];
	}
	return elemColl;
};
/****** getElementsBySelector FIN */

/** GESTION cookies selon quirksmode http://www.quirksmode.org/js/cookies.html  */

function createCookie(name,value) {
	var date = new Date();
	var aconsoavant=7776000000; //date limite de consommation
	// je considère que 90 jours sera bien 90*24*60*60*1000
	date.setTime(date.getTime()+aconsoavant);
	var expires = '; expires='+date.toGMTString();
	document.cookie = name+'='+value+expires+'; path=/';
};

function readCookie(name) {
	var nameEQ = name + '=';
	var ca = document.cookie.split(';');
	for(var i=0;i < ca.length;i++) 	{
		var c = ca[i];
		while (c.charAt(0)==' ') c = c.substring(1,c.length);
		if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
	}
	return null;
};

function eraseCookie(name) {
//	createCookie(name,"",-1);
	document.cookie = name+'= ; expires=0; path=/';
};

/**** gestion cookies FIN */


function zoomtext(t,m) {
	var actuel=document.body.style.fontSize;
	var unite='%';
	if (actuel.indexOf(unite)!=-1)
		{
		actusize=parseInt(actuel);
		}
	else {
		actusize=75;
		}
	if (t!=m)
	{
		document.body.style.fontSize=(actusize+t)+unite;
		createCookie('zoom',document.body.style.fontSize,'');
	}
};

function inserermel() {
	var vazor=document.getElementsByTagName('img'); // fallait un nom de variable idiot
	for (var i=0;i<vazor.length;i++) {
		if (vazor[i].src==baseurl+'/nav/gmail.png') {
			vazor[i].style.cursor='pointer';
			vazor[i].onclick = function () {mailmoi();};
		}
	}
};

/*
function flipflop(masquable)
{
	q=document.getElementById(masquable).style;
	if (q.display=='none')
	{
		q.visibility='visible';
		q.display='block';
	} else	{
		q.visibility='hidden';
		q.display='none';
	}
}*/

function inserermasq() {

 // 
/* Cette fonction cache/décache un block masquable. Son usage principal est pour aérer la présentation du site.
Pour des raisons d'accessibilités, sur recommandation de Tristan Nitot, les blocs masquables sont "visible"s dans le style, mais cachés en javascript:onload
algo de modif de propriété par class trouvé sur www.mozilla.org/docs/web-developer/css1technote/css1tojs.html
mais méthode originale pas propre.
Suggéré par Shift sur woof.lu  de passer de l'UA sniffing à fonction snif
plus ajoût de la méthode 4 très gruik
 
 V2 :
 doit repérer
 	si element.className=='masqueur'
 	alors :
		onclick="Effect.toggle(id+'_m','slide')"
		title="cliquez pour afficher ou cacher"
		style.cursor="n-resize";
		select id+'_m' style.display='none';
 
*/
///v3	var masqueurs=GetElementsWithClassName('*','masqueur');

$('.masqueur').each(function()
	{
		$(this).click(function()
		{
			if (noanim)
			{
				$('#'+(this.id)+'_m').toggle();
			} else {
				$('#'+(this.id)+'_m').slideToggle('slow');
			}
		})

		this.title='cliquez pour afficher ou cacher::';
		this.style.cursor='pointer'; // ou row-resize

		if (hasClass(document.getElementById(this.id+'_m'),'masquee'))
		{
		//	if (noanim)
			{
				$('#'+(this.id)+'_m').hide();
		//	} else {
		//		$('#'+(this.id)+'_m').slideUp();
			}
		};

	});



// attention, on cache que si on peut décacher. Si masquee ou masquable n'ont pas de masqueur, alors que nib

/*	for (var i=0; i!=masqueurs.length; i++) 	{
		var masqueur=masqueurs[i];
		masqueur.onclick = function () {
			//PROTO{if (!noanim) {Effect.toggle((this.id+'_m'),'blind');} else flipflop(this.id+'_m');}

			if (noanim)
				{
			masquable[this.id].toggle();
				} else {
			masquable[this.id].slideToggle();
				}
			};
		masqueur.title='cliquez pour afficher ou cacher::';
		masqueur.style.cursor='pointer'; // ou row-resize
		//PROTOmasquable=document.getElementById(masqueur.id+'_m');
		masquable[masqueur.id]=new Fx.Slide(masqueur.id+'_m');
		//PROTOif (hasClass(masquable,'masquee')) masquable.style.display='none';
		//PROTOif (hasClass(masquable,'masquee')) masquable[masqueur.id].hide();
		if (hasClass(document.getElementById(masqueur.id+'_m'),'masquee')) { masquable[masqueur.id].hide();  };
	}
*/
};

function chainevide(chaine) {
	var gni=false;
	if (chaine=='') gni=true;
	if (chaine=='null') gni=true; // IE le plus con de tous les navigateurs
	return gni;
};

function hotbar(fonction)
{
	switch (fonction)
	{
	case 1:
		zoomtext(-5,40);
	break;
	case 2:
		zoomtext(+5,120);
	break;
	case 3:
		document.getElementById('wrapper').style.backgroundColor=(document.getElementById('wrapper').style.backgroundColor=='white'?'':'white');
		createCookie('bg',document.getElementById('wrapper').style.backgroundColor);
	break;
	case 4:
		// pas d'animation sinon risque d'être trop long
		/*PROTO
		demasq=GetElementsWithClassName('*','masquable');
		for (i=0;i!=demasq.length;i++) demasq[i].style.display='';
		//gruik. à appender
		demasq=GetElementsWithClassName('*','masquee');
		for (i=0;i!=demasq.length;i++) demasq[i].style.display='';
		*/
		for (var ademasquer in masquable) 
			masquable[ademasquer].show();
	break;
	case 5:
		noanim=(noanim?false:true);
		createCookie('noanim',noanim);
/*		var masqueurs=GetElementsWithClassName('*','masqueur');
		for (var i=0; i!=masqueurs.length; i++)
		{
			var masqueur=masqueurs[i];
			masquable[masqueur.id].effects({duration:(noanim?0:500)});
		}
*/
	break;
	case 6:
		var ss;
		d=document.body.style;
		d.backgroundColor='';d.fontSize='';
		noanim=false;
/*
		demasq=GetElementsWithClassName('*','masquable');
		for (i=0;i!=demasq.length;i++)  //demasq[i].style.display='';
		demasq=GetElementsWithClassName('*','masquee');
		for (i=0;i!=demasq.length;i++) //demasq[i].style.display='none';*/
		eraseCookie('noanim');
		eraseCookie('bg');
		eraseCookie('zoom');
		
		function deG(auss) 
		{
			$('body').css({'-moz-transform':'rotate('+auss+'deg)','-webkit-transform':'rotate('+auss+'deg)','transform':'rotate('+auss+'deg)'});
		}
		window.clearTimeout();
		
		for (var au=0;au<=4;au++)
		{
			ss=(au-4)*2;
			ss=(au%2)==0?-ss:ss;
			window.setTimeout(deG,au*200,ss);
		}
	break;
	case 7:
		window.open('http://supplementweekend.fr');//url faute de mieux
		urchinTracker('/EXIT/podcast');
	break;
	case 8:
		prompt('Copier collez cette adresse dans votre lecteur de rss, de podcast ou agrégateur','http://dascritch.net/dotclear/rss.php');
	break;
	case 9:
		mailmoi();
	break;
	}
};

function mailmoi()
{
	prout='rmd@gm';
	location.href='mai'+'lto:xavie'+prout+'ail.'+'com?subject=j%27ai%20vu%20votre%20site : '+encodeURI(location.href);
};

function insererh3res() {
// 30/5/6 Créa totalement originale. GNU-GPL Thanks to credit http://dascritch.net
// et dire qu'après, je suis tombé sur http://www.quirksmode.org/dom/toc.html
	var titres = document.getElementsByTagName('h3');

	if (titres.length>3)
	{
		var side = document.getElementById('sidebar').getElementsByTagName('div')[0];
		bloc=document.createElement('dl');
		bloc.id='cettepage';
		bloc_t=document.createElement('dt');
		bloc.appendChild(bloc_t);
		bloc_t.appendChild(document.createTextNode('Mini-sommaire de cette page'));
		bloc_t.id='minisom';
		bloc_t.className='masqueur';
		bloc_d=document.createElement('dd');
		bloc.appendChild(bloc_d);
		bloc_d.id='minisom_m';
		bloc_d.className='masquable';
		bloc_d.style.display='none';		// standard, grace à jquery
		liste = document.createElement('ul');
		bloc_d.appendChild(liste);
		side.insertBefore(bloc,document.getElementById('sitenav'));
		for (titre=0;titre<titres.length;titre++) {
			texte=titres[titre];
			id=titres[titre].id;
			if (chainevide(id)) id=titres[titre].id='chap-'+titre;
			var li=document.createElement('li');
			liste.appendChild(li);
			var li_a=document.createElement('a');
			var node=document.all?texte.innerText:texte.textContent;
			if (!node) {node=texte.innerHTML.replace(/<[^<>]+>/g,"");} // ce regexp a été trouvé par coup de chance en rédigeant http://dascritch.net/blog.php/post/2007/07/05/Javascript-comme-un-dialecte
			li_a.appendChild(document.createTextNode(node));
			li.appendChild(li_a);
			li_a.href='#'+id;
		}
		minisom=true;
	}
};

function insererbar()
{
	// JS? détruire la barre d'accès et reconstruire
	var libeles=new Array('dézoomer','zoomer','éclairer','déplier','sans anim','RAZ','écouter',"s'abonner","m'écrire");
	var alt= new Array("Réduire la taille du texte. raccourci: Alt -","Augmenter la taille du texte. raccourci: Alt +","Changer le fond du site","Montrer les éléments cachés de cette page","Supprimer les effets de transition","Retour à zéro du style et dégauss moniteur","Écouter les émissions du “Supplément Week-End”","S'abonner au fil d'info","Écrire à l'auteur du site");
	var icones=new Array('hotbar-moins','hotbar-plus','hotbar-lum','hotbar-deplier','hotbar-noanim','hotbar-raz','hotbar-ecouter','application-rss+xml','hotbar-ecrire');
	var contexte=new Array();
	var that = document.createElement('ul');
	that.id='prefs';
	that.className='screen';
	for (var i=0;i<9;i++) {
		var l=document.createElement('li');
		l.appendChild(document.createTextNode(libeles[i]));
		var l_i=document.createElement('img');
		l_i.src=baseurl+'/nav/icons/16/'+icones[i]+'.png';
		l_i.className='favicon';
		l.title=alt[i];
		l.appendChild(l_i);
		l.name=(i+1);
		that.appendChild(l);
		l.onclick=function /*hot_act*/() {hotbar(this.name);};
	}
	document.getElementById('hotbar').appendChild(that);
};

function insererpop() {
// Crée une navigation plus conviviale du plugin pagination de dotclear

	var inserers=GetElementsWithClassName('*','poplistepage');

	for (var bloc=0;bloc!=inserers.length;bloc++) {
		var inserer=inserers[bloc];

		var soif=parseInt(inserer.getElementsByTagName('strong')[0].innerHTML); // textContent
		var faim=parseInt(inserer.getElementsByTagName('span')[0].innerHTML);

// chercher "mantra", en fonctionn de lien suivant ou si faim=)=soif, lien  précédent

			var invoq=false;
			var invoque = /\/page\/[0-9]+/ ;
			var monastere = inserer.parentNode.getElementsByTagName('a');
			var moine = monastere[0].href;
			if (invoque.test(moine)){ mantra=moine.replace(invoque , '/page/##' );invoq=true; }
				else
				{
					if (monastere.length>1)
					{
						var moine = monastere[1].href;
						if (invoque.test(moine)) 
							{mantra=moine.replace(invoque , '/page/##' );invoq=true; }
					}
				}

		if (invoq) { //on a pas tout faux, la détection d'url cible n'a pas foiré...
			var faurm=document.createElement('form');
			faurm.action='';
			faurm.style.display='inline';
			inserer.parentNode.insertBefore(faurm,inserer);
			var selek=document.createElement('select');
			selek.name='url';
			selek.className='screen';
			selek.style.visibility='hidden';
			faurm.appendChild(selek); // A CONDITIONNER AVEC opcio

		//if ((soif!=0)&&(soif!='NaN')&&(faim!=0)&&(faim!='NaN')) 
			// on vérifie qu'on est pas dans un cas où les variables 'nont pu être lues, ce qui causerait un bug
			for (var p=1;p<=faim;p++)
			{
				var opcio=document.createElement('option');
				selek.appendChild(opcio);
				opcio.text='Page '+p;
//			opcio.value="/blog.php/page/"+p;
				opcio.value=mantra.replace(/##/,p);


//		opcio.appendChild(document.createTextNode("Page "+p));

//			selek.option[p-1] = new Option("Page "+p,"/blog.php/page/"+p);

//			if (p==soif) {
//				opcio.selected=true;
//				opcio.disabled=true;
//				}
//			if (document.all) {selek.add(opcio) } // À l'usage exclusif du petit cancre au fond de la classe, MSIE
//			else 			

/*			try {
			//selek.add(opcio,null); // standards compliant; doesn't work in IE
			selek.appendChild(opcio);


//			selek.option[p-1] = new Option("Page "+p,"/blog.php/page/"+p);

			}
	 		catch(ex) {
			selek.add(opcio); // IE only
 		}
*/

			}
			selek.onchange=function /*poplistepage*/()
			{/*
			paje=this.form;
			selecteditem=paje.url.selectedIndex;
			uerelle=paje.url.options[selecteditem].value;*/

				uerelle=this.value;

				if (uerelle.length!=0) location.href=/*baseurl+*/uerelle;
			};

			opcio=selek.options[soif-1];

			if (opcio.text=='Page '+soif)
			{
				opcio.selected=true;
				opcio.disabled=true;
				inserer.className='noscreen';
				selek.style.visibility='visible';
			}
		}
	}
};

function inserergoo() {
// La flemme de chercher comment faire un double bouton de validation, l'un pour une recherche locale, l'autre vers google, alors j'ai inséré en JS. Et hop.

//xavier ,17 juin 2007 
/*if*/ var rech=document.getElementById('rech');
	{
	var quest=document.getElementById('quest');
	if (chainevide(quest.value)) {
		quest.style.background='url(/nav/icons/16/action-viewmag.png) no-repeat 50% 50%';
		quest.onclick = function () {quest.style.background='transparent';};
		quest.onblur = function () {if (chainevide(quest.value)) {quest.style.background='url(/nav/icons/16/action-viewmag.png) no-repeat 50% 50%';}};
	}

	var dogo=document.createElement('input');
	dogo.type='button';
	dogo.name='site';
	dogo.value='le site';
	rech.getElementsByTagName('fieldset')[0].appendChild(dogo);
	dogo.onclick= function()
		{
			dogo=document.createElement('input');
			dogo.type='hidden';
/*			dogo.name='cref';
			dogo.value='http%3A%2F%2Fdascritch.net%2Fggcse.xml';*/
			dogo.name='cx';
			dogo.value='006494614859442274176:p-l5af2gryu';
			rech.getElementsByTagName('fieldset')[0].appendChild(dogo);
			dogo=document.createElement('input');
			dogo.type='hidden';
			dogo.name='cof';
			dogo.value='FORID:11';
			rech.getElementsByTagName('fieldset')[0].appendChild(dogo);
/*			rech.action='http://www.google.com/cse';*/
			rech.action='/search.php';
			rech.submit();	
		};
	}
};

function insereraext() {
				/** POINT IMPORTANT : à modifier dans slimbox

					click: function(link){
					if (link.rel.length == 8) return this.show(link.href, link.title);

					PAR
					if (link.rel.length == 8) return this.show(link.href, chainevide(link.title)?link.longDesc:link.title);

					VOIRE PAR
					if (link.rel.length == 8) return this.show(link.href, link.longDesc);

					et plus loin
					images.push([el.href, el.title]);

					PAR
					images.push([el.href, el.longDesc]);
				**/
/*
	var liens=document.getElementsByTagName('a');

	for (var i = 0; i != liens.length; i++) 	{
		var that=liens[i];
		that.title=that.title.indexOf('http')==0?'':that.title;
		if ((that.href.indexOf('http')==0) && ((that.href.indexOf(baseurl)!=0)) )
		{
			that.rel=that.rel+(!chainevide(that.rel)?' ':'')+'external';
			that.target='_blank'; // eh eh, tant qu'on y est !
			
			that.title=(chainevide(that.hreflang)?'':'['+that.hreflang+'] '+that.rel)+(chainevide(that.title)?'':('::'+that.title));
// 			if (!chainevide(that.title)) lien_e[_e++]=that;
		} else {
			if (!chainevide(that.title))
			{	
//				if (/lightbox/.test(that.rel) ){ // slimbox bonus
				if (that.rel.indexOf('lightbox')==-1){ 
				if (that.title.indexOf('::')==-1) {that.title='::'+that.title;}
				} else {

					that.title='Cliquez pour '+((that.rel.indexOf('lightbox[')>-1)?"ouvrir la galerie d'images::":"zoomer l'image::")+that.title;
// 					lien_i[_i++]=that;
				}
			}
		}
	}
*/
};


function inserertip() {
/*
	var raws=document.getElementsByTagName('*');
	var pure = [];
	var j=0;
	var e;
	for (var i=0;i<raws.length;i++)
	{
		e=raws[i];
		if ((e.tagName!='A')&&(!chainevide(e.title))) pure[j++]=e;
	}
	var tips=new Tips(pure,{
	className:'titl', maxTitleChars: 100
	});
	var tips=new Tips(lien_e,{
	className:'extl', maxTitleChars: 100
	});
	var tips=new Tips(lien_i,{
	className:'intl', maxTitleChars: 100
	});
*/

	$('body').append('<div id="tip"></div>');
	
	$('body').mousemove(function(e)
	{
		var doo=document;
		var Tx=(e.pageX+200)<(doo.all?doo.body.clientWidth:doo.width)?e.pageX:((doo.all?doo.body.clientWidth:doo.width)-200);
		var Ty=e.pageY+25 > (doo.all?doo.body.clientHeight:doo.height) ? e.pageY-50 : e.pageY+25;
		$('#tip').css({top:Ty+'px',left:Tx+'px'})
	});


	$('A').each(function()
	{
		var tit=this.title.indexOf('http')==0?'':this.title;
		var subt='';
		if ((this.href.indexOf('http')==0) && ((this.href.indexOf(baseurl)!=0)) )
		{
			subt=(chainevide(this.hreflang)?'':'['+this.hreflang+'] '+this.rel);
			this.rel=this.rel+(!chainevide(this.rel)?' ':'')+'external';
			this.target='_blank'; // eh eh, tant qu'on y est !
		} else {
			if (this.rel.indexOf('lightbox')>-1)
			{
				subt='Cliquez pour '+((this.rel.indexOf('lightbox[')>-1)?"ouvrir la galerie d'images":"zoomer l'image");
			}
		}
		/*this.atitle=(chainevide(tit)?'':('<div id="tiptit">'+tit+'</div>'))+(chainevide(subt)?'':('<div id="tipsub">'+subt+'</div>'));*/

		if (tit.indexOf('::')>-1)
 				{
 					subt=tit.split('::');
 					tit = '<div id="tiptit">'+subt[1]+'</div><div id="tipsub">'+subt[0]+'</div>';
 				} else {
 					tit = chainevide(tit)?'':('<div id="tiptit">'+tit+'</div>');
 				}


		this.atitle=tit;


		$(this).hover(function()
		{

			if (!chainevide(this.atitle))
			{
				this.title='';
///TODO
				if (this.href.indexOf(baseurl)!=0)
				{
					tAt='external';
				} else {
					tAt='';
				}
				$('#tip').html(this.atitle).attr('class',tAt).show();
			}

		// pour MSIE, les balises ALT sont filtrées plus bas
		},function()
		{
			$('#tip').hide();
///TODO restaure title
		});
	});

	$('[title]').each(function()
	{
		if (this.tagName!='A')
		{

			var tit=$(this).attr('title');
			if (tit.indexOf('::')>-1)
				{
					subt=tit.split('::');
					tit = '<div id="tiptit">'+subt[1]+'</div><div id="tipsub">'+subt[0]+'</div>';
				} else {
					tit = '<div id="tiptit">'+tit+'</div>';
				}
			this.atitle=tit;
	
			$(this).hover(function()
			{
				$(this).prop('title')='';
///TODO
				if (!chainevide(this.atitle))
				{
					$('#tip').html(this.atitle).attr('class','').show();
				}
	
			// pour MSIE, les balises ALT sont filtrées plus bas
			},function()
			{
				$('#tip').hide();
///TODO restaure title
				$(this).prop('title',this.atitle);
			});
		}
	});

};


/* Retiré : pas utilisé
function insereraddthis() {
// script originel http://s9.addthis.com/js/widget.php?v=10

	if (bouton=document.getElementById('addthis'))
	{
		document.getElementById('addthis').onclick= function ()
		{
			var obj=this;
			 window.open('http://www.addthis.com/bookmark.php?v=1&pub=dascritch&url='+encodeURIComponent(location.href)+'&title='+encodeURIComponent(document.title),'addthis','scrollbars=yes,menubar=no,width=620,height=520,resizable=yes,toolbar=no,location=no,status=no,screenX=200,screenY=100,left=200,top=100');
			return false;
		};
	}

};
*/

function insererlibjs(url) {
	script = document.createElement('script');
	script.type = 'text/javascript';
	script.src = url;
	document.getElementsByTagName('head')[0].appendChild(script);
};

function inserertxa() {
	/* ** alonger la taille du champ textarea du commentaire. Supprimé
	tx=document.getElementById('c_content');
	if (tx) 
		{
			tx.onkeyup=function ()
			{
				tx.style.height=tx.scrollHeight+'px';
			};
		tx.style.height=tx.scrollHeight+'px';
		}
	*/
};

// Add an eventListener to browsers that can do it somehow.
// Originally by the amazing Scott Andrew.
function addEvent(obj,evType,fn) {
	if (obj.addEventListener){
		obj.addEventListener(evType,fn,true);
		return true;
	} else if (obj.attachEvent){
		var r=obj.attachEvent('on'+evType,fn);
		return r;
	} else {
		return false;
	}
};

function MSIEgroscon() {
// marche pour MSIE 6
	// http://ejohn.org/blog/html5-shiv/
		if(document.all){
	document.createElement('abbr');
	}

};

// Rendre MSIE 6- moins con
function MSIEgrosnul() {

	function MakeHover( elementals,police,fond) {
		for (i=0; i!=elementals.length; i++) {
			var that=elementals[i];
			that.police=police;
			that.fond=fond;
			that.onmouseenter=function /*Hover*/() {
				this.style.color=this.police;
				this.poire=this.style.backgroundColor;
				this.style.backgroundColor=this.fond;
			};
			that.onmouseleave=function /*UnHover*/() {
				this.style.color='';
				this.style.backgroundColor=this.poire;//='';
			};
		}
	};


/*	function fix_inline_PNGs()
	{
	// source : http://files.codes-sources.com/fichier.aspx?id=43542&f=yPNGFix%5cypngfix.js
		var images = document.getElementsByTagName('img'); // liste de tous les élément <img /> du document
		images.each(
**			function(e)
			{
				var this_src = e.getProperty('src');
				var this_height = e.height;
				var this_width = e.width;
				var this_class = e.getProperty('class');
				if (this_src.toUpperCase().contains('.PNG'))
				{
					var this_new = new Element('span',
						{
						'styles': {
							'filter': "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+this_src+"', sizingMethod='scale')",
							'display': 'inline-block',
							'height': this_height,
							'width': this_width,
							'backgroundImage': 'none'
							},
						'class':this_classes;
						}
					);
				e.replaceWith(this_new);
				}
			};
	**	)
	};
*/


/*
function fix_inline_PNGs(){
// source : http://files.codes-sources.com/fichier.aspx?id=43542&f=yPNGFix%5cypngfix.js

	var images = $$('img'); // liste de tous les élément <img /> du document
	images.each(function(e){
	var this_src = e.getProperty('src');
	var this_height = e.height;
	var this_width = e.width;
	var this_class = e.getProperty('class');
	if (this_src.toUpperCase().contains('.PNG')){
		var this_new = new Element('span',
				{
					'styles': {
						'filter': 'progid:DXImageTransform.Microsoft.AlphaImageLoader(src=\''+this_src+'\', sizingMethod=\'scale\')',
						'display': 'inline-block',
						'height': this_height,
						'width': this_width
					},
					'class':this_classes;
				});
		e.replaceWith(this_new);
		}
	});
	};
*/

/*
Autre source pour PNG fix : http://komodomedia.com/blog/index.php/2007/11/05/css-png-image-fix-for-ie/

(this.runtimeStyle.behavior="none")&&(this.pngSet?this.pngSet=true:(this.nodeName == "IMG" && this.src.toLowerCase().indexOf('.png')>-1?(this.runtimeStyle.backgroundImage = "none",
this.runtimeStyle.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + this.src + "', sizingMethod='image')",
this.src = "transparent.gif"):(this.origBg = this.origBg? this.origBg :this.currentStyle.backgroundImage.toString().replace('url("','').replace('")',''),
this.runtimeStyle.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + this.origBg + "', sizingMethod='crop')",
this.runtimeStyle.backgroundImage = "none")),this.pngSet=true)
);

*/

	{
	//http://positioniseverything.net/explorer/expandingboxbug.html
	document.body.style.wordWrap='break-word';
	MakeHover(document.getElementById('hotbar').getElementsByTagName('li'),'black','white');
	MakeHover(document.getElementById('sidebar').getElementsByTagName('dl'),'black','#e6f4ff');
	MakeHover(GetElementsWithClassName('*','masqueur'),'white','black url(/nav/masquable.gif) no-repeat right bottom');
//	fix_inline_PNGs();

	}
};

function MSIEgroscretin() {
	if(document.all){

	// vire moi ton putain de tooltip des images sur alt, et ta toolbar par la même occase, putain !

		var that=document.getElementsByTagName('img');
		for(var i=0; i<that.length; i++)
			{
		that[i].alt='';
		that[i].galleryimg='no';
			}
	// http://www.mix-fx.com/flash-prompt.htm  pour virer le popup eolas
// ça marche pas... au pire, http://blog.deconcept.com/swfobject/ ce sera mieux
/*		that = document.getElementsByTagName("object");
		for (var i = 0; i < that.length; i++)
			{
		that[i].outerHTML = that[i].outerHTML;
			}*/

/* autre http://www.hoeben.net/node/135/
for(var j=0;tagName=["object","embed"][j];j ) {
  for(var i=0;elem=document.getElementsByTagName(tagName)[i];i ) {
    elem.outerHTML = elem.outerHTML;
  }
}
*/
	}
};

/*   http://www.codingforums.com/showthread.php?t=56369&page=2
*/

//DOM-ready watcher
function domFunction(f, a)
{
	//initialise the counter
	var n = 0;
	
	//start the timer
	var t = setInterval(function()
	{
		//continue flag indicates whether to continue to the next iteration
		//assume that we are going unless specified otherwise
		var c = true;

		//increase the counter
		n++;
	
		//if DOM methods are supported, and the body element exists
		//(using a double-check including document.body, for the benefit of older moz builds [eg ns7.1] 
		//in which getElementsByTagName('body')[0] is undefined, unless this script is in the body section)
		if(typeof document.getElementsByTagName != 'undefined' && (document.getElementsByTagName('body')[0] != null || document.body != null))
		{
			//set the continue flag to false
			//because other things being equal, we're not going to continue
			c = false;

			//but ... if the arguments object is there
			if(typeof a == 'object')
			{
				//iterate through the object
				for(var i in a)
				{
					//if its value is "id" and the element with the given ID doesn't exist 
					//or its value is "tag" and the specified collection has no members
					if
					(
						(a[i] == 'id' && document.getElementById(i) == null)
						||
						(a[i] == 'tag' && document.getElementsByTagName(i).length < 1)
					) 
					{ 
						//set the continue flag back to true
						//because a specific element or collection doesn't exist
						c = true; 

						//no need to continue
						break; 
					}
				}
			}

			//if we're not continuing
			//we can call the argument function and clear the timer
			if(!c) { f(); clearInterval(t); }
		}
		
		//if the timer has reached 60 (so timeout after 15 seconds)
		//in practise, I've never seen this take longer than 7 iterations [in kde 3.2.2 
		//in second place was IE6, which takes 2 or 3 iterations roughly 5% of the time]
		if(n >= 60)
		{
			//clear the timer
			clearInterval(t);
		}
		
	}, 250);
};

/*
*/

