/*
 * Custom jQuery Gallery Plugin
 * Version:	 1.00
 * Copyright (c) 2010 Marc Anthony Danting
 * http://www.surfingtonio.com
 */
(function($){$.fn.gallery=function(options){var opts=$.extend({},$.fn.gallery.defaults,options);var filmstrip=$('<div class="filmstrip"></div>');var nav=$('<a class="disabled nav prev">Previous</a><a class="nav next">Next</a>');var preview=$('<div class="preview"></div>');var container=$('<div id="gallery"></div>').css({'display':'none'}).append(nav).append(preview).append(filmstrip).overlay({mask:opts.mask}).appendTo('body');if(!opts.filmstrip){preview.css({'height':parseInt(preview.css('height'))+parseInt(filmstrip.css('height'))});filmstrip.remove();nav.remove();}
return this.each(function(i){$(this).data('gallery',container)
var update=function(trigger){preview.fadeOut('fast',function(){$(this).empty().append('<img src="'+trigger.attr('href')+'" alt="" />');$(this).fadeIn('fast',function(){if(trigger.attr('title')!=''){var description=$('<div class="description"></div>').append('<h3>'+trigger.attr('title')+'</h3>').append('<p>'+trigger.attr('rel')+'</p>').css({'bottom':-$(this).height(),'opacity':0}).appendTo(preview);description.animate({'bottom':0,'opacity':.8});}});});};$(this).click(function(){if(!opts.filmstrip){update($(this));}else{filmstrip.empty().append($(opts.filmstrip).eq(i).clone().css({'display':'block'})).removeData('scrollable').scrollable({size:opts.size,onSeek:function(){if(this.getIndex()>=this.getSize()-this.getConf().size){$('a.next').addClass('disabled');}else{$('a.next').removeClass('disabled');}}}).find('a').each(function(i){$(this).hover(function(){$(this).append('<span></span>');},function(){$(this).find('span').remove();}).click(function(e){filmstrip.find('a').removeClass('active');$(this).addClass('active');update($(this));e.preventDefault();});});}
container.data('overlay').load();filmstrip.find('a:eq('+opts.startAt+')').click();return false;});});};$.fn.gallery.defaults={mask:{color:'#000'},startAt:0,size:4};})(jQuery);
