

$('document').ready(function(){
	
	Cufon.replace('.cufonPalatino',{ fontFamily: "Palatino Linotype" });
	Cufon.replace(".cufon",{ fontFamily: "Helvetica Neue" });
	homepage();
	mainMenu();
	tailleColonne();
	tailleColonne1();
	tailleColonne2();
	tailleColonne3();
	map();
	$('.fancy').fancybox();
	footer();
	});
	
	
//Rends tout le éléments de la left_col cliquable par zone
function homepage(){
	$('#left_col .element').click
		(function(){
			document.location.href=$(this).find('a:first').attr('href');
			}
		);
	}

function mainMenu(){
	var largeur_li=0;
	var nbr_li=0;
	$('.sousTitre').css({width:0+"px"});
	$('.nav>li').each(function(){
		largeur_li+=$(this).width();	
		nbr_li++;
	});
	//alert(largeur_li);
	var addWidth = (680-largeur_li)/nbr_li;
	$('.nav>li').each(function(){
		var newWidth = ($(this).width()+addWidth)+"px";
		//$(this).css({width: newWidth});
		$(this).width(newWidth);
		//alert('toto');
	});
	
	$('.nav').find('.sousTitre').css({display:'none'});
		$('.nav>li').hover(function(){
			
			$(this).find('.sousTitre').show();
			
			
		},function(){
			$(this).find('.sousTitre').hide();	
			
		}
	);
	
	
if (/MSIE (\d+\.\d+);/.test(navigator.userAgent)){ //test for MSIE x.x;
 var ieversion=new Number(RegExp.$1) // capture x.x portion and store as a number
 if (ieversion>=8)
  $('.sousTitre').css({width:175+"px"})
 else if (ieversion>=7)
 $('.sousTitre').css({width:175+"px"})
 else if (ieversion>=6){
  $('.sousTitre').css({width:80+"px"});
  /*var exHeight = $('.sousTitre').parent('li').find('a').height();
  $('.sousTitre').parent('li').find('a').height(exHeight);*/
 }else if (ieversion>=5)
  $('.sousTitre').css({width:80+"px"})
  
}else {
$('.sousTitre').css({width:175+"px"});
}


	
	/*if (ie6){
	alert(Nom+'//'+Version);
		$('.sousTitre').css({width:80+"px"});	
	}else {
		$('.sousTitre').css({width:175+"px"});
	}*/

	//$('.nav>li').css({width:50+"px"});
	
}

function tailleColonne(){
	var taille=0;
	taille = $('#left_col').height();
	if(taille < $('#middle').height())
	{ 
	 taille = $('#middle').height();
		}
	if(taille < $('#col_droite').height())
	{ 
	 taille = $('#col_droite').height();
		}
		$('#middle').height(taille);
		$('#col_droite').height(taille);
		$('#left_col').height(taille);
	
	}
	
	function tailleColonne1(){
	var taille=0;
	taille = $('#left_col').height();
	if(taille < $('#middle_col').height())
	{ 
	 taille = $('#middle_col').height();
		}
	if(taille < $('#right_col').height())
	{ 
	 taille = $('#right_col').height();
		}
		$('#middle_col').height(taille);
		$('#right_col').height(taille);
		$('#left_col').height(taille);
	
	}
	
		function tailleColonne2(){
	var taille=0;
	taille = $('#gauche').height();
	$('#droite').height(taille);
	
	
	}
	
			function tailleColonne3(){
	var taille=0;
	taille = $('#centre').height();
	//alert(taille);
	if(taille < $('#contenudroite').height())
	{ 
		alert(taille);
	 taille = $('#contenudroite').height();
		}
		$('#contenudroite').height(taille);
		$('#centre').height(taille);
	
	}
	
	
	function map(){
	$('.plandroite').fancybox({frameWidth:425,frameHeight:370,hideOnOverlayClick:false,hideOnContentClick:false});
	}
	
	function footer(){
	
	if ($(document).width()>$(window).width()){
		$('.menu_contour').css({position:'relative'});
	}

}

