
jQuery.extend( jQuery.easing,
{	
	easeInExpo: function (x, t, b, c, d) {
		return (t==0) ? b : c * Math.pow(2, 10 * (t/d - 1)) + b;
	},
	easeOutExpo: function (x, t, b, c, d) {
		return (t==d) ? b+c : c * (-Math.pow(2, -10 * t/d) + 1) + b;
	},
	easeInOutExpo: function (x, t, b, c, d) {
		if (t==0) return b;
		if (t==d) return b+c;
		if ((t/=d/2) < 1) return c/2 * Math.pow(2, 10 * (t - 1)) + b;
		return c/2 * (-Math.pow(2, -10 * --t) + 2) + b;
	}
});

var windowHeight = $(window).height();
var windowWidth = $(window).width();

jQuery(function(){
	$("body").addClass("js").css("overflow-x","hidden");
	
	jQuery.fx.off = true;
	
	$("#header li li").parents("li").hover(
		function() {
			$("#header li").each(function() { $(this).removeClass("hover");	});
			$(this).addClass("hover");
		},
		function() {}
	);
	$("#header li ul").mouseleave(function() {
		$("#header li").each(function() { $(this).removeClass("hover");	});
	});
	$("#header li li a").parent().parent().prev("a").click(function() {
		return false;
	})
	
	// ! Artist menu
	
	var link_arr = [];
	$(".artist_submenu a").each(function(i){
		link_arr[i] = $($(this).attr("href"));
	});
	$(".artist_submenu a").each(function(i){
		$(this).click(function(){
			for (var j=0; j< link_arr.length; j++) { 
				link_arr[j].css("display","none");
			}
			$($(this).attr("href")).css("display","block");
			if($(this).attr("href") == "#biography" || $(this).attr("href") == "#about") {
				$('#biography .scrollDiv, #about .scrollDiv').jScrollPane({showArrows:true, scrollbarWidth: 5, scrollbarMargin: 0, arrowSize: 0});
			}
			
			$(".artist_submenu a").removeClass("active");
			$(this).addClass("active");
			return false;
		});
	});
	
	// ! Image navigation
	$("#artist .navigator a.prev").click(function(){
		$(this).parents("li.image-item").css("display","none").prev().css("display","block");
	
	});
	$("#artist .navigator a.next").click(function(){
		$(this).parents("li.image-item").css("display","none").next().css("display","block");
	
	});
	
	$('a.liked-to-image').nyroModal({
		bgColor: '#ccc',
		zIndexStart: 300
	});
	$('a.liked-to-image img').attr("title","Click to enlarge");
	
	// ! correct image vertical position
	$("#artist .image img").each(function(){
		var imgHeight = $(this).attr("height");
		if( imgHeight < 350) {
			console.log(imgHeight);
				var marginTop = 350-imgHeight;
				$(this).css("margin-top",marginTop);
		}
	});
	

});

