$(document).ready(function(){
	initCufon();
	initCycle();
	initLightbox();
	initMorelink();
})

function initCufon() {
	Cufon.replace('.main_body div.exhibitions h2,.main_body div.exhibition div.more a.more,.main_body div.exhibitions div.panels h3,.lesson_description h2,.individual_lesson h2', { fontFamily: "Rockwell",hover:true, hoverables:{a:true} });
}

function initCycle() {
	if($('div.exhibitions div.flip div.slider').get(0)) {
		$('div.exhibitions div.flip').prepend('<a class="next" href="#">Flip</a>');
		$('div.exhibitions div.flip div.slider').cycle({  
		    speed: 'slow',
			fx: 'cover',
		    timeout: 0,
			next: $('div.exhibitions div.flip a.next'), 
			delay: -2000,
			before: function(curr, next, opts) {
				opts.animOut.opacity = 0;
			}  		       
		});
	};
}

function initLightbox(){
	$("a.lightbox[rel=gallery]").fancybox({
		'overlayShow':true,
		'transitionIn':'elastic',
		'transitionOut':'elastic',
		'overlayOpacity':'0.9',
		'overlayColor':'#2d2d2d',
		'padding':'5px',
		'autoScale': false,
		'onComplete': function() {
			var page_height = $(document).height();
  			$('#fancybox-overlay').css('height', page_height);
		}
	}); 
}

function initMorelink(){
	$('div.exhibitions div.exhibition').click(function() {
		window.location=$(this).find("a.more").attr("href"); 
		return false;
  });

}
