﻿$(document).ready(function () {

    // Sets the width of the content column by checking if the secondary sidebar exists
    if ($('#secondary_sidebar').length === 0) {
        $('#content').addClass('two_columns');
    }
    else {
        $('#content').addClass('three_columns');
    }

    // Initiates the Jquery Tools Overlay
	$('.overlayed[rel]').each(function(i) {
		var gallery = $($(this).attr('rel'));
		$(this).overlay({
			onLoad: function() {
				var first = gallery.find('.items').find('div:eq(0)');
				first.addClass('current');
				gallery.find('.scrollable').animate({
					'width' : first.find('img').width(),
					'height' : first.find('img').height()
				});
			},

			loadspeed: 'fast',

			mask: {
	            color: '#000',
	            loadSpeed: 50,
	            opacity: 0.8
	        }
		});
	});
});
