

$(function($) {		
	// Scroll to top animation
	$('.scroll-top').click(function(){ 
		$('html, body').animate({scrollTop:0}, 600); return false; 
	});
	

	
	// Hide parent on click (error messages, etc...)
	$('a.hideparent').click(function(){ 
		$(this).parent().fadeOut();
		return false;
	});

	// Lightbox setup
	// Ex: open any link <a href="large.jpg" />...
	$('a[href$="jpg"], a[href$="jpeg"], a[href$="png"], a[href$="gif"]').fancybox();
	$("a[rel=gal]").fancybox({
				'titlePosition'		: 'inside',			 
				'transitionIn'		: 'none',
				'transitionOut'		: 'none',
				'overlayColor'		: '#000',
				'overlayOpacity'	: 0.9,
				'titleFormat'		: function(title, currentArray, currentIndex, currentOpts) {
					return '<span id="fancybox-title-over">' + (currentIndex + 1) + ' / ' + currentArray.length + (title.length ? ' &nbsp; ' + title : '') + '</span>';
				}
			});

	// Vimeo Popup - Large
	$(".vimeo-popup-large").click(function() {
		$.fancybox({
			'padding'		: 0,
			'autoScale'		: false,
			'transitionIn'	: 'none',
			'transitionOut'	: 'none',
			'title'			: this.title,
			'width'			: 600,
			'height'		: 340,
			'href'			: this.href.replace(new RegExp("([0-9])","i"),'moogaloop9f1a.html?clip_id=$1'),
			'type'			: 'swf'
		});
		return false;
	});
	
	// Vimeo Popup - Regula Size
	$(".vimeo-popup").click(function() {
		$.fancybox({
			'padding'		: 0,
			'autoScale'		: false,
			'transitionIn'	: 'none',
			'transitionOut'	: 'none',
			'title'			: this.title,
			'width'			: 400,
			'height'		: 225,
			'href'			: this.href.replace(new RegExp("([0-9])","i"),'moogaloop9f1a.html?clip_id=$1'),
			'type'			: 'swf'
		});
		return false;
	});

	// Default Modal box
	$(".modal-box").fancybox({
		'modal' : true
	});

    // Toggle Content!
    $(".hidden").hide();
    $("a.toggle").click(function(event){
        if( $(this).text() == 'Show More' ) {
            $(this).text("Show Less");
        }else{
            $(this).text("Show More");
        }
        $(this).parents(".toggle-container").find(".hidden").slideToggle("normal");
        return false;
    });
});

