var ie6 = false;
$(document).ready(function () {
	if(jQuery.browser.version == "6.0" && jQuery.browser.msie){
		ie6 = true;
	}
	if(ie6) {
		initNavigation();
		fixPostsHeight();
		
		
	}

	initHomeTransitions();

	initInputTextEvents("#contextuelPart");
	initInputTextEvents("#commentaires_form");
	initSlideSiteHome();
	decryptEmailAdress();

});

function fixPostsHeight(){
	var posts = $("#allposts .seePost");
	posts.each(function(){	
		var height = $(this).parent().height();
		$(this).height(height);
	});
}

function decryptEmailAdress(){
	var email_elm = $("#mailto");
	var email_adress = email_elm.text();
	email_elm.text(email_adress.replace("[AT]","@"));
	
}

function initSlideSiteHome(){

	$('#listeSitesAgenceEcommerce').jCarouselLite({
    auto: 8000,
    speed: 1000,
	easing:"backin"
	});

}

	

function initInputTextEvents(elm){
	var input = elm +" .text input";
	var textarea = elm +" .textarea textarea";
	$(input+","+textarea).each(function(){
		this.value = this.defaultValue;
	});
	$(input+","+textarea).bind("focus",function(){
		if($(this).attr("value") == this.defaultValue) this.value = ""
	});
}

function initNavigation(){
	var menu = $("#menu");
	$("#menu .cat").hover(
	function () {	
			$(this).find(".navN2").css("display","block");
		},
		function () {	
			$(this).find(".navN2").css("display","none");
		}
	);
}

function initHomeTransitions(){
				
	/*$('#accrocheHome').cycle({
		fx:   'fade',
		sync:  false,
		random:1,
		delay: 18000
	});*/
	var params = new Object();
		params.fx = 'turnDown';
		params.timeout = 8000;
		params.random = 1;
		if(!ie6)  params.easing =  'backinout';
	$('#sliderHome ul').cycle( params );
		
	
}




