//*************************************************************************

//** Auteurs : Guillaume Quimper et David Boudreau - Influenza marketing **

//** Création   : Décembre 2008		      			                     **	

//*************************************************************************



// *********************
// Navigation principale
// *********************

$(function() {
	$("#mainNav li.menu").hover(function() {
		//$("em", this).text($(this).attr("title"));
		$("ul", this).stop().animate({opacity: 0.9, width: "400"}, "slow");
		$("a:first", this).stop().animate({width: "277"}, "fast");
	}, function() {
	  $("ul", this).stop().animate({opacity: 0, width: "0"}, "normal");
	  $("a:first", this).stop().animate({width: "253"}, "fast");
	});
	
	$("#mainNav li.menu ul li:last-child").addClass("last");
	
});


// ************
// FIX .png IE6
// ************

$(function() {
	jQuery.ifixpng("../images/pixel.gif");
	jQuery("#header h2, #header h3").ifixpng();
	jQuery("li.menu").ifixpng();
	jQuery("li.menu a").ifixpng().css({cursor:'pointer'});
	jQuery("#promoTag a").ifixpng();
	jQuery("#promoTag a").ifixpng().css({cursor:'pointer'});
});


// *******************
// Tabs colonne droite
// *******************
/*$(function(){
		
		$(function () {
			var tabContainers = $('div#tabs > div');
			tabContainers.hide().filter(':first').show();
			
			$('div#tabs ul.tabsNavigation li a').click(function () {
				tabContainers.hide();
				tabContainers.filter(this.hash).fadeIn("normal");
				$('div#tabs ul.tabsNavigation li a').removeClass('selected');
				$(this).addClass('selected');
				return false;
			}).filter(':first').click();
		});
});*/

// **************
// Stripes Tables
// **************

$(document).ready(function() {			   
	$("table.stripeTable tr:even").addClass("alt");	
	$("table.stripeTable tr td").attr("valign", "top");
	$("table.stripeTableVertical table:even").addClass("altVert");
	$("table.stripeTableVertical tr td").attr("valign", "top");
	$("table.activites tr:even").addClass("alt");
});


$(document).ready(function() {			   
	$("ul#mycarousel li:even").addClass("altVert");
});

$(document).ready(function() {			   
	$("div.popOpinions div:even").addClass("altPara");
});


// ************
// Form Styling
// ************

$(document).ready(function(){
	$("#contactForm input.champTexte").focus (
		function() {
			$(this).css("background-position", "left bottom");
	});
	$("#contactForm input.champTexte").blur (
		function() {
			$(this).css("background-position", "left top");
	});
});


// **********
// Accordions 
// **********

$(document).ready(function(){

	$("#accordions h3:first").addClass("active");
	$("#accordions div.details:not(:first)").hide();

	$("#accordions h3").click(function(){

	  $(this).next("div.details").slideToggle("normal")
	  .siblings("div.details:visible").slideUp("normal");
	  $(this).toggleClass("active");
	  $(this).siblings("h3").removeClass("active");
	  
	});
	
	/*$(".pavillons h4:first").addClass("active");
	$(".pavillons div.detailsPavillons:not(:first)").hide();

	$(".pavillons h4").click(function(){

	  $(this).next("div.detailsPavillons").slideToggle("normal")
	  .siblings("div.detailsPavillons:visible").slideUp("normal");
	  $(this).toggleClass("active");
	  $(this).siblings("h4").removeClass("active");
	  
	});*/

});


// *******
// Mail To
// *******

jQuery.fn.mailto = function() {
	return this.each(function(){
		var email = $(this).html().replace(/\s*\(.+\)\s*/, "@");
		$(this).before('<a href="mailto:' + email + '" rel="nofollow" title="Email ' + email + '">' + email + '</a>').remove();
	});
};

$(document).ready(function(){
	$('.email').mailto();
});




// ***********
// Add Classes
// ***********
/*
$(function () {
	//$("#contentTabs div div.nestedTab ul.nestedNav li:last-child").addClass("last");
});
*/

// ***********
// Promo Lists
// ***********
$(function() {
	
	//$("#content form table.sondagesArchives tbody tr:even").addClass('alt');
	
	$("#content div.listPromo").hover(function() {
			$(this).addClass('rowHover');
		}, function() {
			$(this).removeClass('rowHover');
	});
		
	$("#content div.listPromo:first").addClass("first");
	
	$("#content div.listPromo").click(function(){
	  window.location=jQuery(this).find("a").attr("href"); return false;
	});
	
});



