
(function($){

	var $$;
  
	$$ = $.fn.fenoGalleryThumbHover = function( options ) {  
  		
  		
  		var defaults = {  
			offsetY : 177,
			offsetX : 0,
			boundY: 600,
			style: "thumbHover"
		};  
		
		var options = $.extend(defaults, options);
		
		return this.each(function() {  
			var self = $(this); 
   			$('#hovertip').remove(); 	
   			self.append('<div id="hovertip"></div>');
   			$('#hovertip').addClass(options.style);
   			  	
   			$('#thumbs ul li a', $(this) ).mouseover( function(e){
   				var gallerypos = self.offset();
   				var xpos = $(this).offset().left - gallerypos.left; 
   				var ypos = options.offsetY;
   				
   				$('#hovertip').css('display', 'block');
   				$('#hovertip').css('left', xpos);
   				$('#hovertip').css('top', ypos);
   				loadImage( $(this).attr('rev'), '#hovertip' );
   			} );
   			
   			$('#thumbs ul li a' ).mouseout( function(e) {
   				$('#hovertip').css('display', 'none');
   			} );
		});
	};
	
	  
})(jQuery); 



function loadImage( imgsrc, containerID ){
	var img = new Image();
  
  	// wrap our new image in jQuery, then:
  	$(img)
    	// once the image has loaded, execute this code
    	.load(function () {
      	// set the image hidden by default    
      	$(this).hide();
    
      	// with the holding div #loader, apply:
      	$(containerID)
      		.empty()
        	// remove the loading class (so no background spinner), 
        	.removeClass('loading')
        	// then insert our image
        	.append(this);
    
      		// fade our image in to create a nice effect
     		$(this).fadeIn();
    })
    
    // if there was an error loading the image, react accordingly
    .error(function () {
    	//alert("image not found");
    })
    .attr('src', imgsrc);
} 

$.fn.pause = function(duration) {
    $(this).animate({ dummy: 1 }, duration);
    return this;
};


function dumpObject(o){
	var res = "object:\n";
	for(p in o){
		res += p+" : "+o[p]+"\n";
	}
	alert(res);
}




