(function($) {
        $.fn.wow = function(params) {
                defaultParams = {
					effect:'out',
					scale:2,
					time:300,
					extraCss:{},
					easing :'easeOutBack'
				}
				params = $.extend( defaultParams, params);
				obj=this;
                obj.each(function(i) {
					var orig=$(this);
				
					var scale = params.scale;
					
                    var originalSize = parseInt(orig.css("font-size"));
					var targetSize = originalSize*scale;
					
					var paddingLeft = parseInt(orig.css("padding-left"));
					var paddingTop = parseInt(orig.css("padding-top"));
					
					var offset = orig.offset();
					var left = offset.left+paddingLeft;
					var top = offset.top+paddingTop;
					
					
					var height = orig.height();
					var width = orig.width();
					
					if (orig.css('display')=='block' || orig.css('display')=='list-item'){
						orig.css({'display':'inline'});
						width=orig.width();
						orig.css({'display':'block'});
					}
					
					width *= scale; 
					height *= scale; 
					
					var textAlign = orig.css("text-align");
					var fontFamily = orig.css('font-family');
					var color = orig.css('color');
					var fontWeight = orig.css('font-weight');
					var textTransform = orig.css('text-transform');
					var textDecoration = orig.css('text-decoration');
					
					var content = orig.html();
					
					var newDate = new Date;
					var id='l'+ newDate.getTime();
					
					var tag = orig[0].tagName
					if (tag=='A'){
						content='<a href="'+$(this).attr('href')+'">'+content+'</a>';
						$('body').append('<div id="'+id+'">'+content+'</div>');
						if (orig.find('img').length){
							orig.find('img').load(function(){
								var disp = orig.css('display');
								if (disp=="inline"){
									orig.css({'display':'block'});
								}
								top=orig.offset().top;
								height = orig.height();
								if (disp=="inline"){
									orig.css({'display':'inline'});
								}
								width = orig.width();
								
								width *= scale; 
								height *= scale; 
								$('#'+id+" img, #"+id).css({
									'width':width+'px',
									'height':height+'px'
								});
								$('#'+id).css({
										'left':left-(width/(params.scale*2))+'px',
										'top':top-(height/(params.scale*2))+'px'
									});
								
								
							});
						}
					}else if (tag=="IMG"){
						content='<img id="'+id+'" src="'+$(this).attr('src')+'" alt="'+$(this).attr('alt')+'" />';
						$('body').append(content);
						if (height==0 || width==0){
							$(this).load(function(){
								
								height = $(this).height();
								width = $(this).width();
								width *= scale; 
								height *= scale; 
								$('#'+id).css({
									'width':width+'px',
									'height':height+'px'
								});
							});
						}
					}else{
						$('body').append('<div id="'+id+'">'+content+'</div>');
					}
					
					$('#'+id).css({
						'display':'none', 
						'width':width+'px',
						'height':height+'px',
						'padding':paddingTop*scale+'px 0 0 '+paddingLeft*scale+'px',
						'text-align':textAlign,
						'font-size':targetSize+'px',
						'position':'absolute',
						'z-index':'10',
						'left':left-(width/4)+'px',
						'top':top-(height/4)+'px',
						'font-family':fontFamily,
						'color':color,
						'font-weight':fontWeight,
						'text-transform':textTransform,
						'text-decoration':textDecoration,
						'overflow':'hidden'
					});
					
					$('#'+id).css(params.extraCss);
					
					orig.hover(function(){
							$('#'+id).show();
							orig.css({opacity:0});
							 if (params.effect=='inOut'){
								$('#'+id).css({
												'font-Size':parseInt(orig.css('font-size'))+'px',
												'left':left,
												'top':top,
												'width':parseInt(width)/params.scale+"px",
												'height':parseInt(height)/params.scale+"px"
											});
								if ($('#'+id).find('img').length){
									$('#'+id).find('img').css({
																'width':parseInt(width)/params.scale+"px",
																'height':parseInt(height)/params.scale+"px"
																});
									$('#'+id).find('img').animate(
																	{
																		'width':width+"px",
																		'height':height+"px"
																	}
																	,params.time
																	,params.easing
																);
								}
								$('#'+id).animate(
												{
													'font-size':parseInt(orig.css('font-size'))*params.scale+"px",
													'left':left-(width/(params.scale*2))+'px',
													'top':top-(height/(params.scale*2))+'px',
													'width':width,
													'height':height
												}
												,params.time
												,params.easing
												);
							} 
						});
						
					$('#'+id).mouseout(function(){
						$(this).animate(
										{
											'font-Size':parseInt(orig.css('font-size'))+'px',
											'left':left,
											'top':top,
											'width':parseInt(width)/params.scale+"px",
											'height':parseInt(height)/params.scale+"px"
										}
										,params.time
										,params.easing
										, function(){
											$('#'+id)
												.hide()
												.css({
													'font-size':parseInt(orig.css('font-size'))*params.scale+"px",
													'left':left-(width/4)+'px',
													'top':top-(height/4)+'px',
													'width':width,
													'height':height
													});
											orig.css({opacity:1});
										});
						if ($(this).find('img').length){
							$(this).find('img').animate(
														{
															'width':parseInt(width)/params.scale+"px",
															'height':parseInt(height)/params.scale+"px"
														}
														,params.time
														,params.easing
														,function(){
															$('#'+id+' img').css({
																			'width':width+"px",
																			'height':height+"px"
																		});
														}
														);
						}
					});
					
					
					$(window).resize(function(){
						offset = orig.offset();
						left = offset.left+paddingLeft;
						if (inline(orig)){
							var disp = orig.css('display');
							orig.css({'display':'block'});
						}
						top = orig.offset().top+paddingTop;
						if (disp=="inline"){
							orig.css({'display':'inline'});
						}
						
						$('#'+id).css({
							'left':left-(width/4)+'px',
							'top':top-(height/4)+'px'
						});
					
					});
					
					
					
					
					
					
					
					
					
					
					
					function inline(obj){
						return obj.css('display')=="inline";
					};
					
                });
        // Permettre le chaînage par jQuery
        return this;
        };
})(jQuery);
