(function($) {

	var defaults = {
		factor : 1.5
	};
	
	
	function setup ( o, options ){
		var data = $.extend( {}, defaults, options );

		data.width = 160;
		data.height = 160;

		 
		o.data( 'zoomieGallery_data', data );
		o.find('img').data( 'zoomieGallery_data', data );
		
		o.find('img').css({'position':'absolute','opacity':1 });
		o.find('a').css({height:data.height });
		
	   o.find('img').hover( 
			function(){ zoomin( $(this) ); },
			function(){ zoomout( $(this) ); }
		);
						
	};
	
	function zoomin( o ){
		var data = o.data( 'zoomieGallery_data' );
		o.stop().css({'z-index':100}).animate({'margin-left':'-32px','margin-top':'-32px',width:'200px', height:'200px',padding:'20px','opacity':1.0 }, 200, 'easeOutSine'  );
	}
	
	function zoomout( o ){

		var data = o.data( 'zoomieGallery_data' );
		o.stop().css({'z-index':1}).animate({'margin-left':'0px','margin-top':'0px',width:data.width, height:data.height,padding:'4px','opacity':1 }, 500, 'easeOutSine' );
	
	}

	$.fn.zoomieGallery = function( command, options ){
		if( !isset( command )) command = {}
		
		if( typeof command == 'object' ){
			return this.each(function( i, o ){
				setup( $(o), command );
			});
		} 
		else {
			return this.each(function( i, o ){
			switch( command ){
				case 'update':
						// update( $(o), options );	
				break;
			}
						
			});
		};	
	};


	
})(jQuery);
