/* Gallery Javascript */

function init_featured_gallery()
{
	$thumbs = $('#featured-images .featured-thumb-box');
	
	$thumbs.each(function(){
		var id = $(this).attr('rel');
		
		$small = $(this).find('.featured-thumb[rel="sm-'+id+'"]');
		
		// small thumb hover
		$small.bind('mouseover', function(){
			var id = $(this).data('id');
			var $large = $(this).parent().find('.featured-thumb-hover[rel="lg-'+id+'"]');
			
			var w = $large.width();
			var h = $large.height();
			var x = $large.css('left');
			var y = $large.css('top');
			
			var sw = $(this).width();
			var sh = $(this).height();
			
			
			$large.css({width:sw, height:sh, top:0,left:0, display:'block'});
			$large.find('img').css({width:sw, height:sh, opacity:0});
			
			$large.animate({width:w, height:h,left:x, top:y}, 'fast');
			$large.find('img').animate({width:w, height:h, opacity:1}, 'fast');
			
			$large.bind('mouseout', function(){
				$(this).css('display', 'none');
				$(this).unbind('mouseout');
			});
		});
		
	});
		
	
}
