$(document).ready(function(){ // liens externes dans nouvelle fenetre
	$('a[href^="http://"]').not('a[href^="http://www.planetoscope.com/"]')
	.click(function() {
		window.open(this.href); return false;
	})
	.attr({
		title: "S\'ouvre dans une nouvelle fenêtre"
	});
});

$(document).ready(function(){ //
	function bookmarksite(title, url){
		if (document.all)
			window.external.AddFavorite(url, title);
		else if (window.sidebar)
			window.sidebar.addPanel(title, url, "")
	}
	var listitem = document.createElement('li');
	$(listitem).attr('class','marquepage').appendTo("#accessoire ul.raccourcis");
	var anchor = document.createElement('a');
	$(anchor)
		.attr('href','#')
		.text('Ajouter à mes favoris')
		.click(function() {
			bookmarksite('Planetoscope.com - statistiques écologiques en temps réel', 'http://www.planetoscope.com')
		})
		.appendTo(listitem);
});

$(document).ready(function(){
	var navfooterlien = document.createElement('a');
	$(navfooterlien)
		.attr('href','')
		.text('Haut de page')
		.click(function() {
				$.scrollTo( 0, { duration:1000 } );return false;
		})
		.appendTo("#nav-footer");
});

$(document).ready(function() {	

    $('.picto-replace').each(function() {
      pictotext = $(this).text();
      filename = pictotext.toLowerCase().replace(/ /g, '-').replace(/([^0-9a-z-])/g,'');
      $(this).html('<img src="' + baseuri + 'img/picto-' + filename + '.png" alt="" />');
    });

});

$(document).ready(function(){ // categorie et resultats de recherche
	$(".stat-titre .libelle").each(function() {
		$(this).mouseover(function() {
			$(this).next("div").addClass("showlabel");
		});
		$(this).mouseout(function() {
			$(this).next("div").removeClass("showlabel");
		});
	});
});

