/*******************/
/* déco du menu */
/*******************/
function initDecoMenu()
{
	if($('#nav').length) {
		$('#nav li').each(function(){
			var elemWidth = ($(this).width() / 2) - 10;
			$(this).find('.arrow').css('left', elemWidth+'px');
			$(this).find('.child').css('width', ($(this).width()-15)+'px');
			$(this).find('.child').css('border-radius','5px');
		})
		$('#nav li').hover(
			function(){
				$(this).addClass('active');
			},
			function(){
				if(!$(this).hasClass('current')) {
				$(this).removeClass('active');
				}
			}
		)
		
	}
}

/*******************/
/* bords arrondis IE */
/*******************/
 function msieBorder()
 {
	 if ( $.browser.msie && $.browser.version < 9) {
		$('#nav li .child').corner("5px");
	}
}
/*******************/
/* menu suckerfish */
/*******************/
sfHover = function() {
	var sfEls = document.getElementById("nav").getElementsByTagName("LI");
	for (var i=0; i<sfEls.length; i++) {
		sfEls[i].onmouseover=function() {
			this.className+=" sfhover";
		}
		sfEls[i].onmouseout=function() {
			this.className=this.className.replace(new RegExp(" sfhover\\b"), "");
		}
	}
}
if (window.attachEvent) window.attachEvent("onload", sfHover);

/*******************/
/* groupe de hauteur égale */
/*******************/
function equalHeight(group) {
	var tallest = 0;
	group.each(function() {
		var thisHeight = $(this).height();
		if(thisHeight > tallest) {
			tallest = thisHeight;
		}
	});
	group.height(tallest);
}
/* lancement du script après le chargement de la page*/
$(window).load(function() {
	equalHeight($('#wrap-boxes .box'));
	equalHeight($('#wrap-boxes .box h3'));
	equalHeight($('#wrap-boxes .box .text'));
});

/*******************/
/* Function image hover */
/*******************/
function imageRollHover() {
	$("input.confirm-btn").mouseover(function(){
		imgsrc = $(this).attr("src");
		matches = imgsrc.match(/_o/);
		if (!matches) {
			imgsrcON = imgsrc.replace(/_n.png$/ig,"_o.png");
			$(this).attr("src", imgsrcON);
		}
	});
	$("input.confirm-btn").mouseout(function(){
		$(this).attr("src", imgsrc);
	});
}

/*******************/
/* initialisation  */
/*******************/
$(document).ready(function(){
	initDecoMenu();
	msieBorder();
	imageRollHover();
 });
