// Place your application-specific JavaScript functions and classes here
// This file is automatically included by javascript_include_tag :defaults
function equalizeColumns() {
	$.each([$('#content'), $('#column')], function() {
		this.css({height: 'auto'});
	});
	height = Math.max($('#content').height(), $('#column').height());
	$.each([$('#content'), $('#column')], function() {
		this.css({height: height + 'px'});
	});
	$('#column').css({height: height - 6 + 'px'});
}

$(function() {

	$.easing.easeOutQuart = function (x, t, b, c, d) {
	  return -c * ((t=t/d-1)*t*t*t - 1) + b;
	};
	
	if ($("#photo-gallery").length > 0) {
	  $('#photo-gallery').serialScroll({
	    items:'.photo',
			step: 3,
	    prev:'#buttons a.prev',
	    next:'#buttons a.next',
	    axis: 'y',
	    easing:'easeOutQuart', // use this easing equation for a funny effect
			cycle: true,
			lock: true,
			exclude: 2,
	    jump: false // click on the images to scroll to them
	  });
	}
  
  if ($("#callouts").length > 0) {
  	$('#callouts').cycle({
  		fx:      'scrollDown',
  		timeout: 6000,
  		pause: 1
  	});
  }
  
	setupZoom();
  showMovie();

	// hackety hack!
	$("#callouts").css("height", "97px");
});

$(window).load(function() {
	equalizeColumns();
})


function showMovie() {
  if($("#movieContainer").length > 0) {
    swfobject.embedSWF('/flash/islanders_splash.swf', 'movieContainer', '704', '648', '8.0.0', { }, {kidslink: "welcome-kids", teacherslink: "welcome-teachers"}, {wmode: "transparent"} )
  }
}
// make respond_to work with jquery
jQuery.ajaxSetup({ beforeSend: function(xhr) { xhr.setRequestHeader("Accept", "text/javascript"); } });
