Shadowbox.loadSkin('cm', '/static/skins/shadowbox');
Shadowbox.loadLanguage('en', '/static/shadowbox-2.0/build/lang');
Shadowbox.loadPlayer(['html', 'iframe'], '/static/shadowbox-2.0/build/player');
$(document).ready(function() {
	Shadowbox.init({
		resizeDuration: 0.25,
		slideshowDelay: 5,
		onOpen: function(obj) {
			var opts = { };
			if(!obj.gallery) {
				$('#shadowbox_info').hide();
				opts = { continuous: false, enableKeys: false, modal: true };
			}
			else {
				//
				// We want the first right/left sides to be next/previous
				// but it also make sense for the middle-ish area (i.e.
				// a generic click) to be "next" (i.e. a sensible default
				// action). Using thirds seems reasonable.
				//
				var oneThird = $(window).width() / 3;
				$('#shadowbox_body').click(function(e) {
					if(e.pageX > oneThird)
						Shadowbox.next();
					else
						Shadowbox.previous();
				});
				opts = { continuous: true, enableKeys: true, modal: false };
			}
			Shadowbox.applyOptions(opts);
		}
	});
});

