// JavaScript Document
//This script is an adaptation of Dynamic Drive's Equal Column Height script v1

var equalizeEls=new Object()
//Input IDs (id attr) of columns to equalize. Script will check if each corresponding column actually exists:
equalizeEls.checkEls=["col1", "col2", "col3"]

equalizeEls.setHeights=function(reset){
var hTall=0
var resetit=(typeof reset=="string")? true : false
for (var i=0; i<this.checkEls.length; i++){
if (document.getElementById(this.checkEls[i])!=null){
if (resetit)
document.getElementById(this.checkEls[i]).style.height="auto"
if (document.getElementById(this.checkEls[i]).offsetHeight>hTall)
hTall=document.getElementById(this.checkEls[i]).offsetHeight
}
}
if (hTall>0){
for (var i=0; i<this.checkEls.length; i++){
if (document.getElementById(this.checkEls[i])!=null)
document.getElementById(this.checkEls[i]).style.height=hTall+"px"
}
}
}

equalizeEls.resetHeights=function(){
this.setHeights("reset")
}

equalizeEls.dotask=function(target, functionref, tasktype){ //assign a function to execute to an event handler (ie: onunload)
var tasktype=(window.addEventListener)? tasktype : "on"+tasktype
if (target.addEventListener)
target.addEventListener(tasktype, functionref, false)
else if (target.attachEvent)
target.attachEvent(tasktype, functionref)
}

equalizeEls.dotask(window, function(){equalizeEls.setHeights()}, "load")
equalizeEls.dotask(window, function(){if (typeof equalizeEls.timer!="undefined") clearTimeout(equalizeEls.timer); equalizeEls.timer=setTimeout("equalizeEls.resetHeights()", 200)}, "resize")