// JavaScript Document
$(document).ready(function(){
	var marginStudio = 0;
	var marginArt = 0;
	
	centerKekli();
	
	$('#container-studio').hover(
		function(e){
			var i = 0;
			$('#container-gallery').find("span, h2, .arrow").each(function(){
				$(this).stop(true, false).animate({ right: 3*i }, i*15 + 200).animate({ right: 0 }, 50+i*100);
				i++;
			});
			$('#container').stop().animate({ right: -40}, 500);
			$(this).stop(true, false).animate({ left: -40 }, 500);
		},
		function(e){
			var i = 0;
			$('#container-gallery').find("span, h2").each(function(){
				$(this).stop(false, false).animate({ right: -3*i }, i*15 + 200).animate({ right: 0 }, 50+i*100);
				i++;
			});
			$('#container').stop().animate({ right: 0}, 500);
			$(this).stop(true, false).animate({ left: 0 }, 500);
		}
	);
	
	$('#container-gallery').hover(
		function(e){
			var i = 0;
			$('#container-studio').find("span, h2, .arrow").each(function(){
				$(this).stop(true, false).animate({ right: -3*i }, i*15 + 200).animate({ right: 0 }, 50+i*100);
				i++;
			});
			$('#container').stop().animate({ right: 40 }, 500);
			$(this).stop(true, false).animate({ left: 40 }, 500);
		},
		function(e){
			var i = 0;
			$('#container-studio').find("span, h2").each(function(){
				$(this).stop(false, false).animate({ right: 3*i }, i*15 + 200).animate({ right: 0 }, 50+i*100);
				i++;
			});
			$('#container').stop().animate({ right: 0}, 500);
			$(this).stop(true, false).animate({ left: 0 }, 500);
		}
	);
	
	/*
	$('#container-studio').click(function(e){
		window.location.href = ("http://studio.kekli.fr");
	});
	
	$('#container-gallery').click(function(e){
		window.location.href = ("http://art.kekli.fr");
	});
	*/
	
});

$(window).resize(function(){
	centerKekli();
});

function centerKekli() {
	$('#infos-contacts').css({ paddingLeft: ($(document).height() / 2) / (100/35) + 30 });
	$('#container-gallery').css({ top:($(document).height() - $('#container-gallery').height())/2 });
	$('#container-studio').css({ top:($(document).height() - $('#container-studio').height())/2 });
}
