/* 
 * Copyright (c) 2008 Ralph One
 * $LastChangedDate: 2008-03-26 11:01:00 $
 *
 * Version: 1.0b
 *
*/


var ag_idx = 0;

jQuery.fn.r1_artistsGrid = function(opts){

	opts = jQuery.extend({
		containerElement: '.cell',	
		containerHoverClass: 'cell-hover',
		includeOverlay: false,
		overlayAnimation: false,
		overlayElement: '.overlay'		
	},opts||{});
		
	return this.each(function() {
	
		function init(){
			
			if(opts.includeOverlay){
				$(opts.overlayElement).show();
			}
			
			$(opts.containerElement).hover(
				function () {
					
					ag_idx = $(opts.containerElement).index(this);															

					if(opts.includeOverlay && opts.overlayAnimation){
						$(opts.overlayElement).eq(ag_idx).fadeOut();
					}
					
					$(this).addClass(opts.containerHoverClass); 
				}, 
				function () {
					
					if(opts.includeOverlay && opts.overlayAnimation){
						$(opts.overlayElement).eq(ag_idx).fadeIn();
					}
					
					$(this).removeClass(opts.containerHoverClass); 	
				}
			);
			
			$(opts.containerElement).click(function () { 								
				window.location.href = $(this).find('a').attr('href');
	        });
			
		}
		
		init();								
	});

};


