(function($) {
	$.extend({
		infoBulle: new function() {
			
			function getInfoBulle(element) {		
				_texte = config._texte;

				_width = config._width;
				_height = config._height;
				
				_top = config._top.substring(0,config._top.length-2);
				_left = config._left.substring(0,config._left.length-2);
				
				_fontSize = config._fontSize;
				_padding = config._padding;
				_fontColor = config._fontColor;
				
				_backgroundImage = config._backgroundImage;
				if($.browser.msie) {
					_backgroundImage = config._backgroundImage.substring(0,config._backgroundImage.length-3)+"gif";
				}
				
				var offset = element.offset();
				_left = offset.left+parseInt(_left);
				_top = offset.top+parseInt(_top);

				
					$("<div class='infoBulle'>"+_texte+"</div>")
					.css({
						'position': 'absolute',
						'text-align': 'center',
						'color' : _fontColor,
						'font-size': _fontSize,
						'padding' : _padding,
						'top': _top+'px',
						'left': _left+'px',
						'background-image' : 'url("'+_backgroundImage+'")',
						'background-repeat' : 'no-repeat',
						'width': _width,
						'height': _height,
						'cursor': 'pointer',
						'z-index': '10000'
					})
					.fadeIn("slow")
					.prependTo($("body"))
					.click(function() {
						$(this).fadeOut("slow").remove();
					});
			}

			
			this.defaults = {
				_texte: "Erreur",
				_width: "112px",
				_height: "37px",
				_top: "17px",
				_padding: "8px 5px 0px 5px",
				_fontColor: "#ffffff",
				_fontSize: "11px",
				_left: "20px",
				_backgroundImage: 'fileadmin/templates/medias/infoBulleR.png'
			};
			
			this.construct = function(settings) {

				$(".infoBulle").fadeOut("slow").remove();
				
				return this.each(function() {	
					config = $.extend(this.config, $.infoBulle.defaults, settings);
					$this = $(this);
					getInfoBulle($this);
					
					$(window).resize( function() { $(".infoBulle").fadeOut("slow").remove(); } );

				});
				
				
			};
		
		}
	});
	
	// extend plugin scope
	$.fn.extend({
		infoBulle: $.infoBulle.construct
	});
	
	
	
})(jQuery);				
