/* Gallery (fade-on-click, auto-fade) */
jQuery.fn.gallFade = function(_options){
	// defaults options	
	var _options = jQuery.extend({
		duration: 700,
		autoSlide: 5000
	},_options);

	return this.each(function(){
		var _hold = $(this);
		var _speed = _options.duration;
		var _timer = _options.autoSlide;
		var _wrap = _hold.find('img');
		var _count = _wrap.index(_wrap.filter(':last'));
		var _t;
		var _active = _wrap.index(_wrap.filter('.active'));
		if (_active < 0) _active = 0;
		var _last = _active;
		_wrap.css({opacity:0}).eq(_active).css({opacity:1})
		function fadeEl(){
			_wrap.eq(_last).animate({
				opacity:0
			}, {queue:false, duration: _speed});
			_wrap.eq(_active).animate({
				opacity:1
			}, {queue:false, duration: _speed});
			_wrap.removeClass('active').eq(_active).addClass('active');
			_last = _active;
		}
		function runTimer(){
			_t = setInterval(function(){
				_active++;
				if (_active > (_count)) _active = 0;
				fadeEl();
			}, _timer);
		}
		runTimer();
	});
}
$(document).ready(function(){
	/*
$('div.gallery-fade').gallFade({
		duration: 1500,
		autoSlide: 5000
	});
*/
	$.fn.supersized.options = {  
		startwidth: 1024,  
		startheight: 768,  
		minsize: .5,  
		navigation:1,
		slideshow: 1,
		transition: 1,
		slide_counter: 1,
		slide_captions: 1,
		slideinterval: 5000  
	};
	$('#supersize').supersized();  
});
