$(document).ready(function(){
	gestionAxis();
	gestionMenu("home");
	gestionMenu("portfolio");
	gestionMenu("services");
	gestionMenu("contact");
	
	initGallery();
	$(".tweets").carousel( { autoSlide: true, direction : 'vertical',autoSlideInterval: 5000, delayAutoSlide: 2000});
});


function gestionAxis(){

	var elt = $("#axis li img.img_static");
	
	if($.browser.msie)
		$('img.img_abs').css({marginLeft: "-253px"});
	
	$(elt).hover(function(){	

		if(($.browser.msie) && ($.browser.version.substr(0,1) < 9))	
			$(this).parent().find("img.img_abs").show();		
		else
			$(this).parent().find("img.img_abs").fadeIn();		
	});
	
	$("img.img_abs").hover(function(){
	},function(){
		if(($.browser.msie) && ($.browser.version.substr(0,1) < 9))
			$(this).hide();
		else
			$(this).fadeOut();
	});
}

function gestionMenu(elt){
	
	$("#access ."+elt+" img").hover(function(){
		$(this).attr("src",$("#site-title a").attr("href")+"/wp-content/themes/twentyten/images/menu/"+elt+"_survol.png").stop(true,true).fadeIn();

	},function(){
		$(this).attr("src",$("#site-title a").attr("href")+"/wp-content/themes/twentyten/images/menu/"+elt+"_neutre.png").stop(true,true).fadeIn();			
	});
}

function initGallery(){



	$(".lavalamp").lavaLamp({ fx: "linear", speed: 300 })
	

	$(".lavalamp a."+$("#active").val()).click();

	// Looping though all the li items:



}


function initHoverCrea(){

	setTimeout(function(){
		
$(".galleryfx li").hover(function() {
	$(this).css({'z-index' : '10'});
	$(this).find('img').addClass("hover").stop()
		.animate({
			marginTop: '-75px',
			marginLeft: '-75px',
			top: '50%',
			left: '50%',
			width: '150px',
			height: '150px'
		}, 200);
} , function() {
	$(this).css({'z-index' : '0'});
	$(this).find('img').removeClass("hover").stop()
		.animate({
			marginTop: '0',
			marginLeft: '0',
			top: '0',
			left: '0',
			width: '100px',
			height: '100px',
			padding: '0'
		}, 400);
}); 
			$(".galleryfx img").fadeIn();
	},1000);
}



function getGallery(elt){
	$(".galleryfx ul").fadeOut();
	setTimeout(function(){
		$(".galleryfx").find("ul."+elt).fadeIn()
	},500);
	initHoverCrea();
}
