/* 
Derived from a script by Alejandro Gervasio. 
Modified to work in FireFox by Stefan Mischook for Killersites.com
Modified by Emmanuel Personne 11/02/2008 to work with this project

How it works: just apply the CSS class of 'column' to your pages' main columns.
*/

matchColumns=function()
{ 
 var divs,contDivs,maxHeight,divHeight,d; 
 
 // get all <div> elements in the document 
 divs=document.getElementsByTagName('div'); 
 contDivs=[]; 
 
 // initialize maximum height value 
 maxHeight=1500; 

     // iterate over all <div> elements in the document 
 for(var i=0;i<divs.length;i++)
 { 
  // make collection with <div> elements with class attribute 'container' 
  d=divs[i];
  if (/\bcolumn\b/.test(divs[i].className)) contDivs[contDivs.length]=d;
  
  // determine height for <div> element
  if (d.offsetHeight) divHeight=d.offsetHeight;
  else if (d.style.pixelHeight) divHeight=d.style.pixelHeight;
  //alert('div'+i+'='+divHeight+'px')
  
  // calculate maximum height 
  if (contDivs.length>1) maxHeight=Math.max(maxHeight,parseInt(divHeight));
 } 
  
 // assign maximum height value to all of container <div> elements
 if (maxHeight>10)
 {
  var haut_de_page=170
  contDivs[0].style.height= (parseInt(maxHeight) + haut_de_page) + "px";
  contDivs[1].style.height= (parseInt(maxHeight) + haut_de_page) + "px";
  if (contDivs.length>2) contDivs[2].style.height= (parseInt(maxHeight) + haut_de_page) + "px";
 }
} 

// Runs the script when page loads 

window.onload=function(){ if (document.getElementsByTagName) matchColumns(); } 



