function badBrowser(){
	if(jQuery.browser.msie && parseInt(jQuery.browser.version) <= 6){ return true;}
	
	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' ){
	jQuery(function(){
		jQuery("<div id='browserWarning'><a href='#' id='warningClose'>fermer</a>Votre navigateur est obsolète, nous vous recommandons de procéder à une mise à jour de votre navigateur ou si vous le souhaitez, vous pouvez aussi essayer d’autres navigateurs web populaires comme par exemple :<br/> <a id='browserWarningFF' href='http://getfirefox.com'>FireFox</a>, <a id='browserWarningO' href='http://www.opera.com/download/'>Opera</a>, <a id='browserWarningGC' href='http://www.google.fr/chrome'>Chrome</a>, <a id='browserWarningS' href='http://www.apple.com/safari/'>Safari</a>, <a id='browserWarningIE' href='http://www.microsoft.com/windows/downloads/ie/getitnow.mspx'>Internet Explorer</a>.<br/>Si vous utilisez un PC au travail, veuillez contacter votre service informatique.</div> ")
		/*$("<div id='browserWarning'>You are using an unsupported browser. Please switch to <a href='http://getfirefox.com'>FireFox</a>, <a href='http://www.opera.com/download/'>Opera</a>, <a href='http://www.apple.com/safari/'>Safari</a> or <a href='http://www.microsoft.com/windows/downloads/ie/getitnow.mspx'>Internet Explorer 7</a>. Thanks!&nbsp;&nbsp;&nbsp;<a href='#' id='warningClose'>close</a> </div> ")*/
			.css({
				'border-top': 'solid 1px #000',
				'border-bottom': 'solid 1px #000',
        'text-align':'center',
				padding:'5px 0px 5px 30px',
        'background' : '#fcfdde url(http://www.agencepix.com/browser.gif) no-repeat 0 -192px', 
        'color':'#000000'
			})
			.prependTo("body");
      
      jQuery('#warningClose').css({'background' : '#fcfdde url(http://www.agencepix.com/browser.gif) no-repeat -10px -166px', 'padding-left' : '15px', 'color':'#000000', 'line-height': '15px', 'height': '15px', 'float': 'right', 'padding-right' : '5px', 'display':'inline-block'})
      jQuery('#browserWarningFF').css({'background' : '#fcfdde url(http://www.agencepix.com/browser.gif) no-repeat 0 -32px', 'padding-left' : '35px', 'color':'#000000', 'line-height': '32px', 'height': '32px', 'display':'inline-block'})
      jQuery('#browserWarningO').css({'background' : '#fcfdde url(http://www.agencepix.com/browser.gif) no-repeat 0 0', 'padding-left' : '35px', 'color':'#000000', 'line-height': '32px', 'height': '32px', 'display':'inline-block'})
      jQuery('#browserWarningGC').css({'background' : '#fcfdde url(http://www.agencepix.com/browser.gif) no-repeat 0 -96px', 'padding-left' : '35px', 'color':'#000000', 'line-height': '32px', 'height': '32px', 'display':'inline-block'})
      jQuery('#browserWarningS').css({'background' : '#fcfdde url(http://www.agencepix.com/browser.gif) no-repeat 0 -128px', 'padding-left' : '35px', 'color':'#000000', 'line-height': '32px', 'height': '32px', 'display':'inline-block'})
      jQuery('#browserWarningIE').css({'background' : '#fcfdde url(http://www.agencepix.com/browser.gif) no-repeat 0 -64px', 'padding-left' : '35px', 'color':'#000000', 'line-height': '32px', 'height': '32px', 'display':'inline-block'})
		
		jQuery('#warningClose').click(function(){
			setBadBrowser('browserWarning','seen');
			jQuery('#browserWarning').slideUp('slow');
			return false;
		});
	});	
}
