function equilibreDivs() {

	var style=(window.ie6 || window.ie7)?'height':'min-height';
 
  // On récupère les hauteurs initiales
  var menu_transparent_height = document.getElementById('menu-transparent').offsetHeight;
  var main_height = document.getElementById('main').offsetHeight;
  var content_height = document.getElementById('content').offsetHeight;
  
  var diff=0;
  var newheight=0;
  if (main_height > menu_transparent_height) {

    // Différence de hauteur entre les 2
    diff = main_height - menu_transparent_height;

    // On affiche l'équilibreur
    document.getElementById('equilibrage').style.display = "block";
    
    // Selon la difference, on ajuste les tailles
    if (diff < 65) {
      newheight = content_height + 65 - diff; 
      if(window.ie6 || window.ie7) {
        document.getElementById('content').style.height= newheight+'px'; 
      } else {
        document.getElementById('content').setStyle(style,newheight+'px'); 
      } 
    } else {
      newheight = diff - 65; 

      if(window.ie6 || window.ie7) {
        document.getElementById('equilibrage-deepest').style.height= newheight+'px'; 
      } else {
        document.getElementById('equilibrage-deepest').setStyle(style,newheight+'px'); 
      } 
    }
  } else {
    newheight = menu_transparent_height - main_height + content_height; 

    if(window.ie6 || window.ie7) {
      document.getElementById('content').style.height= newheight+'px'; 
    } else {
      document.getElementById('content').setStyle(style,newheight+'px'); 
    } 
  }
}

// Récupérer la valeur d'une propriété CSS d'un élément id
function getStyle(elt,pro) {
  var element = document.getElementById(elt);
  if (window.getComputedStyle) {
    // Mozilla Firefox & cie
    var propriete = window.getComputedStyle(element,null).getPropertyValue(pro);
  } else if (element.currentStyle) { 
    // Microsoft Internet Explorer
    var propriete = eval('element.currentStyle.'+pro);
  }
  return propriete;
}

// Classe
var YOOTemplate = {
		
	start: function() {

		/* Match height of div tags */
		YOOTemplate.matchHeights();

		/* Accordion menu */
//		new YOOAccordionMenu('div#middle ul.menu li.toggler', 'ul.accordion', { accordion: 'slide' });

		/* Dropdown menu */
		var dropdown = new YOODropdownMenu('menu', { mode: 'slide', dropdownSelector: 'div.dropdown', transition: Fx.Transitions.Expo.easeOut });
		dropdown.matchHeight();

		/* set hover color */
		var hoverColor;
		switch (YtSettings.color) {
			case 'combsblue':
			case 'waveblue':
				hoverColor = '#000099';
				break;
			case 'barblue':
				hoverColor = '#00c0ff';
				break;
			case 'barorange':
			case 'waveyellow':
				hoverColor = '#ff7800';
				break;
			case 'bargreen':
			case 'wavegreen':
				hoverColor = '#83c500';
				break;
			default:
				hoverColor = '#C8001E';
		}

		/* Morph: main menu - level2 (color) */
		var menuEnter = { 'color': hoverColor};
		var menuLeave = { 'color': '#555555'};

		new YOOMorph('div#menu a.level2 span.bg', menuEnter, menuLeave,
			{ transition: Fx.Transitions.linear, duration: 0 },
			{ transition: Fx.Transitions.sineIn, duration: 500 });

		/* Morph: mod-chrome sub menu - level1 */
		var submenuEnter = { 'color': hoverColor};
		var submenuLeave = { 'color': '#C8C8C8'};

		new YOOMorph('div.mod-chrome-white ul.menu span.bg', submenuEnter, submenuLeave,
			{ transition: Fx.Transitions.expoOut, duration: 0 },
			{ transition: Fx.Transitions.sineIn, duration: 300 });

		/* Morph: mod-chrome sub menu (color variations) - level1 */
		var submenuEnter = { 'color': hoverColor};
		var submenuLeave = { 'color': '#323232'};

		new YOOMorph('div.mod-chrome-black ul.menu span.bg, div.mod-chrome-blue ul.menu span.bg, div.mod-chrome-green ul.menu span.bg, div.mod-chrome-orange ul.menu span.bg', submenuEnter, submenuLeave,
			{ transition: Fx.Transitions.expoOut, duration: 0 },
			{ transition: Fx.Transitions.sineIn, duration: 300 });

		/* Morph: mod-line sub menu - level1 */
		var submenuEnter = { 'color': hoverColor, 'background-color': '#F5F5F5', 'padding-left': 5};
		var submenuLeave = { 'color': '#646464', 'background-color': '#ffffff', 'padding-left': 0};

		new YOOMorph('div.mod-line ul.menu span.bg', submenuEnter, submenuLeave,
			{ transition: Fx.Transitions.expoOut, duration: 100 },
			{ transition: Fx.Transitions.sineIn, duration: 300 });

		/* Smoothscroll */
		new SmoothScroll({ duration: 500, transition: Fx.Transitions.Expo.easeOut });
	},

	/* Match height of div tags */
	matchHeights: function() {
		YOOBase.matchHeight('div.headerbox div.deepest', 20);
		YOOBase.matchHeight('div.topbox div.deepest', 20);
//		YOOBase.matchHeight('div.bottombox div.deepest', 20);
		YOOBase.matchHeight('div.maintopbox div.deepest', 20);
		YOOBase.matchHeight('div.mainbottombox div.deepest', 20);
		YOOBase.matchHeight('div.contenttopbox div.deepest', 20);
		YOOBase.matchHeight('div.contentbottombox div.deepest', 20);
  }

};

/* Add functions on window load */
window.addEvent('domready', YOOTemplate.start);
window.addEvent('load', function() {equilibreDivs();});

