/* 
Derived from a script by Alejandro Gervasio. 
Modified to work in FireFox by Stefan Mischook for Killersites.com

How it works: just apply the CSS class of 'column' to your pages' main columns.
*/
matchColumns=function(){ 

     var divs,contDivs,maxHeight,divHeight,d,contDivs2,e,maxHeight2,divHeight2,contDivs3,f,maxHeight3,divHeight3; 
	
     // get all <div> elements in the document 

     divs=document.getElementsByTagName('div'); 

     contDivs=[]; 
	 contDivs2=[]; 
	 contDivs3=[]; 

     // initialize maximum height value 

     maxHeight=0; 
	 maxHeight2=0; 
	 maxHeight3=0; 

     // 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' 

          if(/\bcolumn\b/.test(divs[i].className)){ 

                d=divs[i]; 

                contDivs[contDivs.length]=d; 

                // determine height for <div> element 

                if(d.offsetHeight){ 

                     divHeight=d.offsetHeight; 					

                } 

                else if(d.style.pixelHeight){ 

                     divHeight=d.style.pixelHeight;					 

                } 

                // calculate maximum height 

                maxHeight=Math.max(maxHeight,divHeight); 

          } 
		  
		  if(/\bcolumn2\b/.test(divs[i].className)){ 

                e=divs[i]; 

                contDivs2[contDivs2.length]=e; 

                // determine height for <div> element 

                if(e.offsetHeight){ 

                     divHeight2=e.offsetHeight; 					

                } 

                else if(e.style.pixelHeight){ 

                     divHeight2=e.style.pixelHeight;					 

                } 

                // calculate maximum height 

                maxHeight2=Math.max(maxHeight2,divHeight2); 

          } 
		  
		  if(/\bcolumn3\b/.test(divs[i].className)){ 

                f=divs[i]; 

                contDivs3[contDivs3.length]=f; 

                // determine height for <div> element 

                if(f.offsetHeight){ 

                     divHeight3=f.offsetHeight; 					

                } 

                else if(f.style.pixelHeight){ 

                     divHeight3=f.style.pixelHeight;					 

                } 

                // calculate maximum height 

                maxHeight3=Math.max(maxHeight3,divHeight3); 

          } 

     } 

     // assign maximum height value to all of container <div> elements 

     for(var i=0;i<contDivs.length;i++){ 

          contDivs[i].style.height=maxHeight + "px"; 

     } 
	 
	 for(var y=0;y<contDivs2.length;y++){ 

          contDivs2[y].style.height=maxHeight2 + "px"; 

     } 
	 
	 for(var x=0;x<contDivs3.length;x++){ 

          contDivs3[x].style.height=maxHeight3 + "px"; 

     } 

} 

// Runs the script when page loads 

window.onload=function(){ 

     if(document.getElementsByTagName){ 

          matchColumns();			 

     } 

} 



