﻿/*Epingle le site sur la barre Window7*/
function addSite()
{
    try {
        window.external.msAddSiteMode();
    }
    catch (e) {
        alert("This feature is only available in Internet Explorer 9.");
    }
}
$(document).ready(function(){
    try {
        if (window.external.msIsSiteMode()) {
            // Continue intialization
        }
        else {
			if(BrowserDetect.browser == "Explorer" && BrowserDetect.version >= 9)
            	document.getElementById('divPinSite').style.display = "block";
        }
    }
    catch (e) {
        // Fail silently. Pinned Site API not supported.
    }	
});
/*FIN Epingle le site sur la barre Window7*/

/*  - - - - - - - - - - - Détection du navigateur et de l'OS - - - - - - - - - - - -*/
var BrowserDetect = {
	init: function () {
		this.browser = this.searchString(this.dataBrowser) || "An unknown browser";
		this.version = this.searchVersion(navigator.userAgent)
			|| this.searchVersion(navigator.appVersion)
			|| "an unknown version";
		this.OS = this.searchString(this.dataOS) || "an unknown OS";
	},
	searchString: function (data) {
		for (var i=0;i<data.length;i++)	{
			var dataString = data[i].string;
			var dataProp = data[i].prop;
			this.versionSearchString = data[i].versionSearch || data[i].identity;
			if (dataString) {
				if (dataString.indexOf(data[i].subString) != -1)
					return data[i].identity;
			}
			else if (dataProp)
				return data[i].identity;
		}
	},
	searchVersion: function (dataString) {
		var index = dataString.indexOf(this.versionSearchString);
		if (index == -1) return;
		return parseFloat(dataString.substring(index+this.versionSearchString.length+1));
	},
	dataBrowser: [
		{
			string: navigator.userAgent,
			subString: "Chrome",
			identity: "Chrome"
		},
		{ 	string: navigator.userAgent,
			subString: "OmniWeb",
			versionSearch: "OmniWeb/",
			identity: "OmniWeb"
		},
		{
			string: navigator.vendor,
			subString: "Apple",
			identity: "Safari",
			versionSearch: "Version"
		},
		{
			prop: window.opera,
			identity: "Opera"
		},
		{
			string: navigator.vendor,
			subString: "iCab",
			identity: "iCab"
		},
		{
			string: navigator.vendor,
			subString: "KDE",
			identity: "Konqueror"
		},
		{
			string: navigator.userAgent,
			subString: "Firefox",
			identity: "Firefox"
		},
		{
			string: navigator.vendor,
			subString: "Camino",
			identity: "Camino"
		},
		{		// for newer Netscapes (6+)
			string: navigator.userAgent,
			subString: "Netscape",
			identity: "Netscape"
		},
		{
			string: navigator.userAgent,
			subString: "MSIE",
			identity: "Explorer",
			versionSearch: "MSIE"
		},
		{
			string: navigator.userAgent,
			subString: "Gecko",
			identity: "Mozilla",
			versionSearch: "rv"
		},
		{ 		// for older Netscapes (4-)
			string: navigator.userAgent,
			subString: "Mozilla",
			identity: "Netscape",
			versionSearch: "Mozilla"
		}
	],
	dataOS : [
		{
			string: navigator.platform,
			subString: "Win",
			identity: "Windows"
		},
		{
			string: navigator.platform,
			subString: "Mac",
			identity: "Mac"
		},
		{
			   string: navigator.userAgent,
			   subString: "iPhone",
			   identity: "iPhone/iPod"
	    },
		{
			string: navigator.platform,
			subString: "Linux",
			identity: "Linux"
		}
	]
};
BrowserDetect.init();


/***** DETECTION IE6 *****/
function badBrowser(){
	if($.browser.msie && parseInt($.browser.version) <= 6){ return true;}
	//if($.browser.mozilla){ return true;} //Remove this line so you will not get the warning in Firefox.
	return false;
}

function getBadBrowser(c_name)
{
	if (document.cookie.length>0)
	{
	c_start=document.cookie.indexOf(c_name + "=");
	if (c_start!=-1)
		{ 
		c_start=c_start + c_name.length+1; 
		c_end=document.cookie.indexOf(";",c_start);
		if (c_end==-1) c_end=document.cookie.length;
		return unescape(document.cookie.substring(c_start,c_end));
		} 
	}
	return "";
}	

function setBadBrowser(c_name,value,expiredays)
{
	var exdate=new Date();
	exdate.setDate(exdate.getDate()+expiredays);
	document.cookie=c_name+ "=" +escape(value) + ((expiredays==null) ? "" : ";expires="+exdate.toGMTString());
}

if(badBrowser() && getBadBrowser('browserWarning') != 'seen' ){
	$(function(){
		$("<div id='browserWarning'><p>Votre navigateur est obsolète. Nous vous invitons à le <a href='http://www.microsoft.com/france/windows/internet-explorer/telecharger-ie8.aspx' target='_blank'>mettre à jour</a> ou à télécharger <a href='http://www.mozilla-europe.org/fr/firefox/' target='_blank'>Firefox</a>, <a href='http://www.apple.com/fr/safari/' target='_blank'>Safari </a>ou <a href='http://www.google.fr/chrome' target='_blank'>Chrome</a>.</p>[<a href='#' id='warningClose'>Fermer</a>] </div> ")
			.prependTo("body");
		
		$('#warningClose').click(function(){
			setBadBrowser('browserWarning','seen');
			$('#browserWarning').slideUp('slow');
			return false;
		});
	});	
}


/***** AFFICHAGE DE LA DATE DANS LE HEADER *****/
function afficherDate(){
	var C=new Date();
	var A=["dimanche","lundi","mardi","mercredi","jeudi","vendredi","samedi"];
	var B=["janvier","février","mars","avril","mai","juin","juillet","août","septembre","octobre","novembre","décembre"];
	document.write(A[C.getDay()]+"<span class='jour'> "+C.getDate()+" </span>"+B[C.getMonth()]+" "+C.getFullYear());
}


/* * * * * * * * * * * *  FAVORIS ET RESEAUX SOCIAUX  * * * * * * * * * * */

/* Ajout de la page courante dans les favoris du navigateur */
function BookmarkCurrentUrl() {
	var bookmarkurl=location.href;
	var bookmarktitle=document.title;	
	if(navigator.appName=="Microsoft Internet Explorer"){
		window.external.AddFavorite(bookmarkurl,bookmarktitle);		
	}else if (window.sidebar){ // firefox
		window.sidebar.addPanel(bookmarktitle, bookmarkurl, "");		
	}else{
		alert("Cette fonction n'est pas supportée par votre navigateur. Utilisez les touches CTRL+D pour ajouter manuellement cette page à vos favoris.");	
	}

}

/* Post sur Facebook et Twitter */
 var pop;
  
  function getLongUrl(){
    return "http://api.bit.ly/shorten?"
    + "version=2.0.1"
    + "&longUrl=" + window.location.href
    + "&login=eid1280"
    + "&apiKey=R_75c5efaf1eeba212b3bebbed6986e613"
    + "&history=0"
    + "&format=json&callback=?";
  }
  
  function getShortUrl(data){
    var first_result;
    for (var r in data.results) {
      first_result = data.results[r];
      break;
    }
    for (var key in first_result){
      if(key=="shortUrl"){
        return first_result[key].toString();
      }
    }
  }
  
  function getTitle(){
    metaTitle = " " + document.title;
    return encodeURIComponent(metaTitle);
  }
  
function goTwitter(data){
	if(data==null){
		pop = window.open();
		jQuery.getJSON(getLongUrl(), function(data){ goTwitter(data) } );
	}
	else {
		pop.location = "http://twitter.com/?status=" + getTitle() + " - " + getShortUrl(data);
	}
}

  
  function goFacebook(shortUrl){
    window.open("http://www.facebook.com/sharer.php?u=" + encodeURIComponent(window.location.href) + "&t=" + getTitle());
  }
  

/* * * * * * * * * * * * Contenu Partagé * * * * * * * * * * */
function OpenExternalContent (codeSite,urlPage) {
	window.location.replace("http://share.newslink.fr/index.php?website="+codeSite+"&target="+urlPage);
}

function callExternalScript(url){
$(document).ready(function() {	
	var n = document.createElement("script");
	n.setAttribute("type", "text/javascript");
	n.setAttribute("src", url);
	document.getElementsByTagName("head")[0].appendChild(n);
});
}

$(document).ready(function() {	
	$("#tabs").tabs({ 
		event: 'mouseover', 
		fx: { opacity: 'toggle', 
         duration: 10   
		} 
	}); 
	

	/***** GESTION DU PICTOLIEN *****/
	$(".mod.linkButtons li").mouseover(function(){	
		var linkEffect = $(this).find(".summary");
		$(linkEffect).slideDown(300);	
    }).mouseleave(function(){
		var linkEffect = $(this).find(".summary");
		$(linkEffect).slideUp(100);
    });
	
	/***** GESTION DE LA TAILLE DES POLICES *****/
	// id, classe ou balise HTML dont la fonte est modifiable dans ce tableau
	// indiquez html ou body si vous voulez modifier toute la page, e.g. var section = new Array('div.contenu p','div.contenu','p.titrepara','div.intro p')
	var section = new Array('body');
	section = section.join(',');	
	// Augmenter la taille
	$(".increasefont").click(function(){
		var currentFontSize = $(section).css('font-size');
		var currentFontSizeNum = parseFloat(currentFontSize, 10);
		var newFontSize = currentFontSizeNum+1;
		$(section).css('font-size', newFontSize);
		if(currentFontSizeNum>=15)
		{
			var finalFontSize = 15;
			$(section).css('font-size', finalFontSize);
		}
		return false;		
	});  
	// Diminuer la taille
	$(".decreasefont").click(function(){
		var currentFontSize = $(section).css('font-size');
		var currentFontSizeNum = parseFloat(currentFontSize, 10);
		var newFontSize = currentFontSizeNum-1;
		$(section).css('font-size', newFontSize);
		if(currentFontSizeNum<=9)
		{
			var finalFontSize = 9;
			$(section).css('font-size', finalFontSize);
		}		
		return false;
	});	

	var section2 = new Array('div.content');
	section2 = section2.join(',');	
	// Augmenter la taille
	$(".zoomin").click(function(){
		var currentFontSize = $(section2).css('font-size');
		var currentFontSizeNum = parseFloat(currentFontSize, 10);
		var newFontSize = currentFontSizeNum+1;
		if(newFontSize>16)
			newFontSize=16;
		$(section2).css('font-size', newFontSize);
		if(currentFontSizeNum>=16)
		{
			var finalFontSize = 16;
			$(section2).css('font-size', finalFontSize);
		}
		return false;		
	});  
	// Diminuer la taille
	$(".zoomout").click(function(){
		var currentFontSize = $(section2).css('font-size');
		var currentFontSizeNum = parseFloat(currentFontSize, 10);
		var newFontSize = currentFontSizeNum-1;
		$(section2).css('font-size', newFontSize);
		if(currentFontSizeNum<=9)
		{
			var finalFontSize = 9;
			$(section2).css('font-size', finalFontSize);
		}		
		return false;
	});	
	
	/* * * * * * Initialisation du lien "signaler un bug" * * * * * * */	
	var encodedurl = encodeURIComponent(window.location);
	$("#signaler").attr("href","/a-propos/signaler-bug?url="+encodedurl);
		
	/***** Page Contact *****/
	//Affichage des div contact//
	  /*On Masque les div qu'on ne veut pas*/
	  $("div#affiche_redaction").hide();
	  $("div#affiche_servicepublicite").hide();
	  $("div.catarticle div.i_bloccommentaires").hide();
	  
	  $("span.mod").click(function () {
		var div_catarticle = $(this).parents("div.catarticle");  
		var div_bloccom = $(div_catarticle).next(".i_bloccommentaires");
		$(div_bloccom).slideToggle("slow");
	  });
	  
	  $("a.redaction").click(function () {
		$("div#affiche_redaction").show();
		$("div#affiche_servicepublicite").hide();
	  });
	  
	  $("a.servicepub").click(function () {
		$("div#affiche_servicepublicite").show();
		$("div#affiche_redaction").hide();
	  });
	  
	  
	  /* * * * * * * * * Mise en place des sliders, onglets, accordéons..  * * * * * * * * */
	$(".vignettes").jcarousel({wrap: 'circular', scroll:1});
	$("#article_plus").tabs({ event: 'mouseover' });	
	$("#boitedernierscomms").tabs({ event: 'mouseover' });
	$("#infosservices #pa").tabs({ event: 'mouseover' });
	$("#homecommunes").tabs({ event: 'mouseover' });
	$(".rechercheweb2 #filtres").accordion({autoHeight: false , collapsible: true});
	
	
	// Formulaire de recherche
	var searchBox=$('#e_search form input.text');
	var searchBoxDefault="rechercher...";
	searchBox.focus(function(){
		if($(this).val() == searchBoxDefault) $(this).val("");
	});
	searchBox.blur(function(){
		if($(this).val() == "") $(this).val(searchBoxDefault);
	});


	
 $(".side1 .i_blocaffichette #listeAffichette").mouseover(function ()
	  {
		
		$(this).children(".jcarousel-prev").addClass('test');
		$(this).children(".jcarousel-next").addClass('test');
		
	  });

   $(".side1 .i_blocaffichette #listeAffichette").mouseout(function ()
	 {
		$(this).children(".jcarousel-prev").removeClass('test');
		$(this).children(".jcarousel-next" ).removeClass('test');
    });
   
	

});


/********** FAV TAGS **********/

jQuery.cookie = function (key, value, options) {
    
    // key and at least value given, set cookie...
    if (arguments.length > 1 && String(value) !== "[object Object]") {
        options = jQuery.extend({}, options);

        if (value === null || value === undefined) {
            options.expires = -1;
        }

        if (typeof options.expires === 'number') {
            var days = options.expires, t = options.expires = new Date();
            t.setDate(t.getDate() + days);
        }
        
        value = String(value);
        
        return (document.cookie = [
            encodeURIComponent(key), '=',
            options.raw ? value : encodeURIComponent(value),
            options.expires ? '; expires=' + options.expires.toUTCString() : '', // use expires attribute, max-age is not supported by IE
            options.path ? '; path=' + options.path : '',
            options.domain ? '; domain=' + options.domain : '',
            options.secure ? '; secure' : ''
        ].join(''));
    }

    // key and possibly options given, get cookie...
    options = value || {};
    var result, decode = options.raw ? function (s) { return s; } : decodeURIComponent;
    return (result = new RegExp('(?:^|; )' + encodeURIComponent(key) + '=([^;]*)').exec(document.cookie)) ? decode(result[1]) : null;
};

function DisplayFav(divdest)
{
	var favstr = $.cookie('favtags');
	if(favstr!=null && favstr!="")
	{
		//$('.i_blocFavTags').css("display", "block");
		$('.mod.favTags .bottom').css('display', 'block');
		var favarr = favstr.split(',');
		var htmlDisplay = "<ul>";
	
		for(i=0;i<favarr.length;i++)
		{
			//htmlDisplay = htmlDisplay + "<li><a href='" + favarr[i] +"'>" + favarr[i+1] + "</a><a href='#' onClick=\"RemoveFav('"+favarr[i]+"','"+favarr[i+1]+"');DisplayFav('"+ divdest +"');\"> Sup</a></li>"; 
			
			if(favarr[i+1].length>12)
			{
				htmlDisplay = htmlDisplay + "<li><a href='" + favarr[i] +"' title=\"" + favarr[i+1] + "\">" + favarr[i+1].substring(0,12) + "...</a></li>"; 
			}
			else
			{
				htmlDisplay = htmlDisplay + "<li><a href='" + favarr[i] +"' title=\"" + favarr[i+1] + "\">" + favarr[i+1] + "</a></li>"; 
			}
			i=i+1;
		}
		
		htmlDisplay += "</ul>";
		
		$(divdest).html(htmlDisplay);
		addContextMenu();
	}
	else
	{
		//$('.mod.favTags').css("display", "none");
		$(divdest).html('<p>Cliquez sur <img alt="Mes tags favoris" src="/fr/images/css/style/star.gif" /> pour ajouter le tag de la page &#224; vos tags favoris.</p>');
		$('.mod.favTags .bottom').css('display', 'none');
	}
	return false;
}


if(jQuery)( function() {
	$.extend($.fn, {
		
		contextMenu: function(o, callback) {
			// Defaults
			if( o.menu == undefined ) return false;
			if( o.inSpeed == undefined ) o.inSpeed = 150;
			if( o.outSpeed == undefined ) o.outSpeed = 75;
			// 0 needs to be -1 for expected results (no fade)
			if( o.inSpeed == 0 ) o.inSpeed = -1;
			if( o.outSpeed == 0 ) o.outSpeed = -1;
			// Loop each context menu
			$(this).each( function() {
				var el = $(this);
				var offset = $(el).offset();
				// Add contextMenu class
				$('#' + o.menu).addClass('contextMenu');
				
				// Simulate a true right click
				$(this).mousedown( function(e) {
					$(".contextMenu .favtags_name").html('"'+el.attr("title")+'"');
					var evt = e;
					evt.stopPropagation();
					$(this).mouseup( function(e) {
						e.stopPropagation();
						var srcElement = $(this);
						$(this).unbind('mouseup');
						if( evt.button == 2 ) {
							// Hide context menus that may be showing
							$(".contextMenu").hide();
							// Get this context menu
							var menu = $('#' + o.menu);
							
							if( $(el).hasClass('disabled') ) return false;
							
							// Detect mouse position
							var d = {}, x, y;
							if( self.innerHeight ) {
								d.pageYOffset = self.pageYOffset;
								d.pageXOffset = self.pageXOffset;
								d.innerHeight = self.innerHeight;
								d.innerWidth = self.innerWidth;
							} else if( document.documentElement &&
								document.documentElement.clientHeight ) {
								d.pageYOffset = document.documentElement.scrollTop;
								d.pageXOffset = document.documentElement.scrollLeft;
								d.innerHeight = document.documentElement.clientHeight;
								d.innerWidth = document.documentElement.clientWidth;
							} else if( document.body ) {
								d.pageYOffset = document.body.scrollTop;
								d.pageXOffset = document.body.scrollLeft;
								d.innerHeight = document.body.clientHeight;
								d.innerWidth = document.body.clientWidth;
							}
							(e.pageX) ? x = e.pageX : x = e.clientX + d.scrollLeft;
							(e.pageY) ? y = e.pageY : y = e.clientY + d.scrollTop;
							
							// Show the menu
							$(document).unbind('click');
							$(menu).css({ top: y, left: x }).fadeIn(o.inSpeed);
							// Hover events
							$(menu).find('A').mouseover( function() {
								$(menu).find('li.hover').removeClass('hover');
								$(this).parent().addClass('hover');
							}).mouseout( function() {
								$(menu).find('li.hover').removeClass('hover');
							});
							
							// Keyboard
							$(document).keypress( function(e) {
								switch( e.keyCode ) {
									case 38: // up
										if( $(menu).find('li.hover').size() == 0 ) {
											$(menu).find('li:last').addClass('hover');
										} else {
											$(menu).find('li.hover').removeClass('hover').prevAll('li:not(.disabled)').eq(0).addClass('hover');
											if( $(menu).find('li.hover').size() == 0 ) $(menu).find('li:last').addClass('hover');
										}
									break;
									case 40: // down
										if( $(menu).find('li.hover').size() == 0 ) {
											$(menu).find('li:first').addClass('hover');
										} else {
											$(menu).find('li.hover').removeClass('hover').nextAll('li:not(.disabled)').eq(0).addClass('hover');
											if( $(menu).find('li.hover').size() == 0 ) $(menu).find('li:first').addClass('hover');
										}
									break;
									case 13: // enter
										$(menu).find('li.hover A').trigger('click');
									break;
									case 27: // esc
										$(document).trigger('click');
									break
								}
							});
							
							// When items are selected
							$('#' + o.menu).find('A').unbind('click');
							$('#' + o.menu).find('li:not(.disabled) A').click( function() {
								$(document).unbind('click').unbind('keypress');
								$(".contextMenu").hide();
								// Callback
								if( callback ) callback( $(this).attr('href').substr(1), $(srcElement), {x: x - offset.left, y: y - offset.top, docX: x, docY: y} );
								return false;
							});
							
							// Hide bindings
							setTimeout( function() { // Delay for Mozilla
								$(document).click( function() {
									$(document).unbind('click').unbind('keypress');
									$(menu).fadeOut(o.outSpeed);
									return false;
								});
							}, 0);
						}
					});
				});
				
				// Disable text selection
				if( $.browser.mozilla ) {
					$('#' + o.menu).each( function() { $(this).css({ 'MozUserSelect' : 'none' }); });
				} else if( $.browser.msie ) {
					$('#' + o.menu).each( function() { $(this).bind('selectstart.disableTextSelect', function() { return false; }); });
				} else {
					$('#' + o.menu).each(function() { $(this).bind('mousedown.disableTextSelect', function() { return false; }); });
				}
				// Disable browser context menu (requires both selectors to work in IE/Safari + FF/Chrome)
				$(el).add($('ul.contextMenu')).bind('contextmenu', function() { return false; });
				
			});
			return $(this);
		},
		
		// Disable context menu items on the fly
		disableContextMenuItems: function(o) {
			if( o == undefined ) {
				// Disable all
				$(this).find('li').addClass('disabled');
				return( $(this) );
			}
			$(this).each( function() {
				if( o != undefined ) {
					var d = o.split(',');
					for( var i = 0; i < d.length; i++ ) {
						$(this).find('A[href="' + d[i] + '"]').parent().addClass('disabled');
						
					}
				}
			});
			return( $(this) );
		},
		
		// Enable context menu items on the fly
		enableContextMenuItems: function(o) {
			if( o == undefined ) {
				// Enable all
				$(this).find('li.disabled').removeClass('disabled');
				return( $(this) );
			}
			$(this).each( function() {
				if( o != undefined ) {
					var d = o.split(',');
					for( var i = 0; i < d.length; i++ ) {
						$(this).find('A[href="' + d[i] + '"]').parent().removeClass('disabled');

						
					}
				}
			});
			return( $(this) );
		},
		
		// Disable context menu(s)
		disableContextMenu: function() {
			$(this).each( function() {
				$(this).addClass('disabled');
			});
			return( $(this) );
		},
		
		// Enable context menu(s)
		enableContextMenu: function() {
			$(this).each( function() {
				$(this).removeClass('disabled');
			});
			return( $(this) );
		},
		
		// Destroy context menu(s)
		destroyContextMenu: function() {
			// Destroy specified context menus
			$(this).each( function() {
				// Disable action
				$(this).unbind('mousedown').unbind('mouseup');
			});
			return( $(this) );
		}
		
	});
})(jQuery);

function AddToFav(keyword,description)
{

	//hack pour gere le cas de la home page "a la Une"
	if (keyword == '/actualite/a-la-une') keyword = '/';
	
	var favstr = $.cookie('favtags');
	if(favstr!=null && favstr!="")
	{
		var favarr = favstr.split(',');
			if(jQuery.inArray(keyword,favarr)==-1)
			{
				if(favarr.length<=38)
				{
					var newfav = [keyword, description];
					favarr.push(newfav);
					$.cookie('favtags', favarr, { expires: 700, path: '/' });
				}
				else
				{
					alert("Vous ne pouvez ajouter plus de 30 favoris.");
				}
			}
	}
	else
	{
		var newfav = [keyword, description];
		$.cookie('favtags', newfav, { expires: 700, path: '/' });
	}
	return false;
}



function ClearFav()
{
	$.cookie('favtags', null, { expires: 700, path: '/' });
	return false;
}


function RemoveFav(keyword,description)
{
	//keyword = http://localhost/keword ... voir pkoi 
	var favstr = $.cookie('favtags');
	if(favstr!=null)
	{
		var favarr = favstr.split(',');
		
		//hack pour vire le http://nomdedomaine qui se rajoute tjrs au lien sous IE
		removeItem = keyword.replace(window.location.protocol+'//'+document.domain, '');
		
		favarr = jQuery.grep(favarr, function(value) {
			return value != removeItem;
			});
		
		removeItem = description;
		favarr = jQuery.grep(favarr, function(value) {
			return value != removeItem;
			});
		
		$.cookie('favtags', favarr, { expires: 700, path: '/' });

	}
	return false;
}

function addContextMenu() {
	$("#tagsres ul li a").contextMenu({
		menu: 'favCtxMenu'
	}, function(action, el, pos) {
		RemoveFav($(el).attr('href'),$(el).attr('title'));
		DisplayFav('#tagsres');
	});
}

$(document).ready( function() {
    var fadeTimeout;
	$(".favtags_help").mouseover(function(){
	  window.clearTimeout(fadeTimeout);
	 // $('.favtags_infos').css("display", "block");
	  $('.favtags_infos').fadeTo("normal", 0.95);
	});							
	$(".favtags_help").mouseout(function(){
		fadeTimeout = window.setTimeout( function() {
			$('.favtags_infos').fadeTo("normal", 0, function() {
				$(this).css("display", "none");						   
			});
		}, 300);
	});							
    //addContextMenu();
	DisplayFav('#tagsres');
});

// Détection habillage OAS
$(document).ready(function() {
	var hasBackground = $('body').css('background-image') != 'none';
	if(hasBackground){
		$('#wrapper').addClass('pubHabillage');
	}
});

/* Fix pour le pb de la page de recherche */
var __nonMSDOMBrowser = (window.navigator.appName.toLowerCase().indexOf('explorer') == -1);
function WebForm_FireDefaultButton(event, target) { 
	if (event.keyCode == 13) { 
		var src = event.srcElement || event.target; 
		if (!src || (src.tagName.toLowerCase() != "textarea")) { 
			var defaultButton; 
			if (__nonMSDOMBrowser) { 
				defaultButton = document.getElementById(target); 
			} 
			else { 
				defaultButton = document.all[target]; 
			} 
			if (defaultButton && typeof(defaultButton.click) != "undefined") { 
				defaultButton.click(); 
				event.cancelBubble = true; 
				if (event.stopPropagation) event.stopPropagation(); 
					return false; 
				} 
			} 
		} 
	return true; 
} 
