$(document).ready(function(){
  // $('#jumbotron').cycle({
  //  fx: 'scrollHorz',
  //  timeout: 8000,
  //  easing: 'easeInOutCubic',
  //  pager: '#jumbotron_controller',
  //  pagerAnchorBuilder: buildCycleNav,
  //  pause: true
  // }) 
  
	$('#sidebar_nav.programs').accordion({
		autoHeight: false,
		collapsible: true,
		active: '.active',
		header: '.handle',
		icon: false,
		clearStyle:true
	});
	

 	$('a.email').colorbox();


	$('.email_form, .useful_form').live('submit', function(){
		$(this).ajaxSubmit({
			success: shareSuccess,
			error: populateMessages
		});
		return false;
	});
  
  $('#content .boards ul').columnize({
	  columns: 3, 
	  width: 136
	});
	
	$('video').mediaelementplayer({
     flashName: "flashmediaelement.swf",
     videoHeight: 295,
     videoWidth: 470
   });
	
});

	function shareSuccess(res){
		$('#messages').html(res);
		$('.email_form, .useful_form').hide();
	}

	function populateMessages(xhr){
		$('#messages').html(xhr.responseText);
	}

function buildCycleNav(i, elem){
	i++;
	return '<a href="#">'+i+'</a>'
}
