// Easing equation, borrowed from jQuery easing plugin
// http://gsgd.co.uk/sandbox/jquery/easing/

jQuery.easing.easeOutQuart = function (x, t, b, c, d) {
	return -c * ((t=t/d-1)*t*t*t - 1) + b;
};

jQuery(function( $ ){
	
	$("#upcomming_events .mu_nav").hide();
	$("#featured_events .mu_nav").hide();
	
	if( jQuery(".ue_col").length > 2 ){
		$("#upcomming_events .mu_nav").show();

	}
	
	if( jQuery(".fe_col").length > 2 ){
		$("#featured_events .mu_nav").show();
	}	
	
	$(".ue_col").click(function(){
		if ($(this).find("h2 a").attr("href")){
		document.location.href = $(this).find("a").attr("href");
		}
	});	
	$(".ue_col").mouseover(function(){
		if ($(this).find("h2 a").attr("href")){
		$(this).find("img").css("background", '#000000');
		$(this).css("cursor", 'pointer');
		$(this).find("h2").css("text-decoration", 'underline');	
		}
	});
	$(".ue_col").mouseout(function(){
		if ($(this).find("a").attr("href")){
		$(this).find("img").css("background", '#ffffff');
		$(this).find("h2").css("text-decoration", 'none');	
		}
	});	
	
	$(".fe_col").click(function(){
		if ($(this).find("h2 a").attr("href")){
		document.location.href = $(this).find("a").attr("href");
		}
	});	
	$(".fe_col").mouseover(function(){
		if ($(this).find("h2 a").attr("href")){
		$(this).find("img").css("background", '#000000');
		$(this).css("cursor", 'pointer');
		$(this).find("h2").css("text-decoration", 'underline');	
		}
	});
	$(".fe_col").mouseout(function(){
		if ($(this).find("a").attr("href")){
		$(this).find("img").css("background", '#ffffff');
		$(this).find("h2").css("text-decoration", 'none');	
		}
	});	
	
	
	$(".pe_col_item").mouseover(function(){
		if ($(this).find("a").attr("href")){
		$(this).find("span").css("color", '#000000');
		$(this).css("cursor", 'pointer');
		$(this).find("span b").css("text-decoration", 'underline');	
		}
	});
	$(".pe_col_item").mouseout(function(){
		if ($(this).find("a").attr("href")){
		$(this).find("span").css("color", '#878787');
		$(this).find("span b").css("text-decoration", 'none');	
		}
	});	
	


	$('#featured_events').serialScroll({
		target:'#fe_line',items:'li', prev:'a.lnk_back',next:'a.lnk_right',axis:'x',
		navigation:'#fe_links',duration:700,force:true,onBefore:function( e, elem, $pane, $items, pos ){
			console.log($items);
			e.preventDefault();
			if( this.blur )
				this.blur();
		},onAfter:function( elem ){
		}
	});
	
	$('#upcomming_events').serialScroll({
		target:'#ue_line',items:'li', prev:'a.lnk_back',next:'a.lnk_right',axis:'x',
		navigation:'#mu_links',duration:700,force:true,onBefore:function( e, elem, $pane, $items, pos ){
			e.preventDefault();
			if( this.blur )
				this.blur();
		},onAfter:function( elem ){
		}
	});
	$('#personal_events').serialScroll({
		target:'#pe_line',items:'li', prev:'a.lnk_back',next:'a.lnk_right',axis:'x',
		navigation:'#pu_links',duration:700,force:true,onBefore:function( e, elem, $pane, $items, pos ){
			e.preventDefault();
			if( this.blur )
				this.blur();
		},onAfter:function( elem ){
		}
	});
	
	$('#past_events').serialScroll({
		target:'#fe_line',items:'li', prev:'a.lnk_back',next:'a.lnk_right',axis:'x',
		navigation:'#fu_links',duration:700,force:true,onBefore:function( e, elem, $pane, $items, pos ){
			e.preventDefault();
			if( this.blur )
				this.blur();
		},onAfter:function( elem ){
		}
	});
	
	
	

});
