	$.fn.galleryHome = function(options) {
		
			var context=this;
			var currentInd=0;
			var currentImage;
			this.block=false;
			this.first=true;
			this.highlights=[];
			this.hl=132;
			this.ht=132;
			this.interval=0;
			this.canShowControls=false;
			this.images=options.images;		
			this.direction=0	
			$(this).empty();
			$('.highlight').hide();
			$('.highlight').each(function(){
				context.highlights.push(this)
			})			
			$.extend(this,{
				init:function(ind){
						context.block=true;
						var preloader='<span id="preloader">carregando próximo destaque <img style="margin-left:3px" src="img/preloader.gif" alt="preloader" /></span>';
						context.currentInd=ind;
						context.hideControls();
						$('body').append(preloader);
						$("#preloader").css({top:$(window).height() - 128, left:($(window).width()/2) - 108})
						$('<img />',{src:context.images[ind]}).addClass('optimized').css({opacity:context.first?0:1}).appendTo(context).load(function(){
							$(this).resizeImage();
							$('#preloader').delay(400).remove();
							if(context.currentImage) {
								context.currentImage.finish();
								context.currentImage=this;
								$(this).css({left:$(this).position().left+$(window).width()}).animate({left:0},2000,"easeInOutExpo",function(){
									$(currentImage).removeClass('optimized')
									
								});
							}else{
								context.currentImage=this;
								$(this).animate({opacity:1},1000,function(){
									$(this).removeClass('optimized')
								})
							}
							context.resize();
							clearInterval(context.interval);
							context.interval=setTimeout(context.nextInterval,6000);
							context.initHighlights(context.currentInd);
							context.showControls();
							context.block=true;
							$.extend(this,{
									finish:function(){
										$(window).unbind("resize",this.resize);
										$(this).wrap('<div class="wrap-image" style="z-index:2;position:absolute;height:100%;border-right:solid 3px white;overflow:hidden;width:100%" />')
										 $(this).parent().animate({width:0},1400,'easeInExpo',function(){
											 $(this).remove();
											context.block=false;
										});
									}})
							context.currentImage=this;
							});
							context.first=false;
				},
				hideControls:function(){
				
					context.block=true;
					$('#btnNext').stop().animate({left:$(window).width()+$('#btnNext').width()},400,function(){
						$('#btnNext').hide();
					});
					$('#btnPrevius').stop().animate({left:-$('#btnPrevius').width()},400,function(){
						$('#btnPrevius').hide();
					});
				
					if(context.currentHighlight){
						$(context.currentHighlight).stop().animate({left:$(context.currentHighlight).offset().left+100,opacity:0},1000,"easeInExpo",function(){
							$(this).hide();	
						});
					}
				},
				showControls:function(){
								
					$('#header').delay(2000).stop().animate({top:0},600,"easeOutQuad")
					$('#footer').delay(2000).stop().animate({top:$(window).height()-$('#footer').height()},600,"easeOutQuad")
					if(this.hasNext()==true) {
						$('#btnNext').stop().show().delay(2000).animate({left:$(window).width() - $('#btnNext').width()},400,"easeOutExpo",function(){
							context.block=false
						});
					}
				
					if(this.hasPrevius()==true){
						 $('#btnPrevius').stop().show().delay(2000).animate({left:0},400,"easeOutExpo",function(){
							context.block=false;
						});
					}
					
				},
				next:function(e){
					if(e!=null) e.preventDefault(); 
					if(!context.block){ 
						context.init(context.currentInd+1)
					}
					clearInterval(context.interval)
				},
				previus:function(e){
					if(e!=null) e.preventDefault();
					if(!context.block){
					 	context.init(context.currentInd-1);
					//	context.block=true;
					}
					clearInterval(context.interval)
				},
				nextInterval:function(){
					if(context.hasNext()==false && context.direction==0){
						context.direction=1
					}
					
					if(context.hasPrevius()==false && context.direction==1){
						context.direction=0	
					}
					
					if(context.direction==0){
						context.next();
					}else{					
						context.previus();
					}
				},
				hasNext:function(){
				
					return context.currentInd+1<context.images.length?true:false;
				},
				hasPrevius:function(){
					return context.currentInd-1>=0?true:false; 
				},
				resize:function(){
					$('#btnNext').animate({top:$(window).height()/2 - $('#btnNext').height()/2,left:$(window).width() - $('#btnNext').width()},1000);
					$('#btnPrevius').css({top:$(window).height()/2 - $('#btnPrevius').height()/2,left:0});
					
					if(context.currentHighlight){
						$(context.currentHighlight).css({opacity:1,left:$(window).width()/2 - $(context.currentHighlight).attr('pX'),top:$(context.currentHighlight).attr('pY')},1000,"easeOutExpo");
						
					}
					$("#preloader").css({top:$(window).height() - 128, left:($(window).width()/2) - 108})
				},
				initHighlights:function(ind){
					
					context.currentHighlight=context.highlights[ind];
					var pY= Math.round($(context.currentHighlight).attr('pY'));
					$(context.currentHighlight).stop().show().css({opacity:0,top:pY,left:$(context.currentHighlight).attr('pX')+100}).delay(1400).animate({opacity:1,left:$(window).width()/2 - $(context.currentHighlight).attr('pX')},1000,"easeOutExpo");
					
					// if(!jQuery.browser.msie)
					// 					$(context.currentHighlight).stop().show().css({opacity:0,left:'19%',top:$('#header').height()+132}).delay(1500).animate({opacity:1,left:'13%'},1000,"easeOutExpo");
					// 				else
					// 					$(context.currentHighlight).stop().show().css({left:'19%',top:$('#header').height()+132}).delay(1500).animate({left:'13%'},1000,"easeOutExpo");
									
				}
			});
			$.extend(this,options);
			
			$(window).bind('resize',this.resize)
			// 
 			$('<a />',{id:'btnPrevius',href:'#'}).css({left:-500,top:$(window).height()/2 - $('#btnNext').height()/2}).addClass('btnGallery').html("<img src='img/home/btn-previus.png' />").appendTo('body');
			$('<a />',{id:'btnNext',href:'#'}).css({left:$(window).width()+500,top:$(window).height()/2 - $('#btnNext').height()/2}).addClass('btnGallery').html("<img src='img/home/btn-next.png' />").appendTo('body');
			$('#btnNext').click(this.next);
			$('#btnPrevius').click(this.previus);
			this.init(0);
			return this;
		}

