$(document).ready(function(){
	// fancybox settings  elastic
	$("a[rel=fancygroup]").fancybox({
		//'titleShow'	: false,
		'transitionIn'	: 'elastic',
		'transitionOut'	: 'elastic',
		'titlePosition' 	: 'over',
		'titleFormat'	: function(title, currentArray, currentIndex, currentOpts) {
			return '<span id="fancybox-title-over">Image ' + (currentIndex + 1) + ' / ' + currentArray.length + (title.length ? ' &nbsp; ' + title : '') + '</span>';
		}
	});
		
	// Hide element on click where it contains: class="clickhide"
	$('.clickhide').click(function() { $(this).fadeOut(600); });
	
	
	// Scroll to top animation
	$('.scroll-top').click(function(){ 
		$('html, body').animate({scrollTop:0}, 'slow'); return false; 
	});
	
	// tweetScroll settings
	//$('#tweets').tweetScroll({
	//	speed:2000,
	//	delay:5000
	//});

});

(function($){

    	/* Equal Heights */
	$.fn.setAllToMaxHeight = function(){
		return this.height( Math.max.apply(this, $.map( this , function(e){ return $(e).height() }) ) );
	}

	/* twitter scroller */
	$.fn.tweetScroll = function(options) {
		
		return this.each(function() {	
		
			var
			$this = $(this), 
		
			defaults = {
			speed: 400, 
			delay: 3000, 
			list_item_height: $this.children('li').outerHeight() 
		},
		
		settings = $.extend({}, defaults, options); 
		
			setInterval(function() {
				$this.children('li:first')
				.animate({ 
					marginTop : '-' + settings.list_item_height, 
					opacity: 'hide' },
		
					settings.speed,
		
					function() {
						$this
						.children('li:first')
						.appendTo($this)
						.css('marginTop', 0) 
						.fadeIn(300); 
					}
				); // end animate
			}, settings.delay); // end setInterval
		});
	}

})(jQuery);


