
$(document).ready(function(){
//events view
  $("img.eventphoto").unbind('click');
  $("img.eventphoto").bind('click' , function(event){
		var elid = $(event.currentTarget).attr('id');
		//$('#eventinfo'+i).load('/events/view/'+elid);
		//$('#eventinfo'+i).show('slow');
		$('#eventinfo').hide();
	    $('#eventinfo').load('/events/view/'+elid, '', function(){
			bindEventViewFunctions();
			$('#eventinfo').show();
			$('.events_view').show();
		});	
	});
	
	   $("#menu_events_archive").unbind('click');
	$('#menu_events_archive').bind('click' , function(event){
		$('#menu_events_archive a').attr('href', '#');
	//	$('#global_loading').show();
		//		$('#content_2').fadeOut(1000, function(){
					$('#content_2').load('/events', function(){
		//				$('#global_loading').fadeOut(400);
		//				$('#content_2').fadeIn(1000);
						return false;
					});
		//		});
	});
	
	   $("#menu_events_info").unbind('click');
	   $("#menu_events_info").bind('click' , function(event){
			$('#contactholder').load('/events/contact_events',"",function(){
				bindEventViewFunctions();
				$('#contactholder').show();
			});

		});
});
function bindEventViewFunctions(){
	$(".closeevent").unbind('click');
	$(".closeevent").bind('click',function(){
		$('.closeevent').parent().parent().hide();
	});
}

	


jQuery(function( $ ){


$('#events_box').serialScroll({
	items:'div.flyer',
	prev: '#scroll_upimg_events',
	next: '#scroll_downimg_events',
	step: 5,
	axis:'y',// The default is 'y' scroll on both ways
	duration:1000,// Length of the animation (if you scroll 2 axes and use queue, then each axis take half this time)
	force:false
});

});