//** Dynamic Drive Equal Columns Height script v1.01 (Nov 2nd, 06)
//** http://www.dynamicdrive.com/style/blog/entry/css-equal-columns-height-script/

var ddequalcolumns=new Object()
//Input IDs (id attr) of columns to equalize. Script will check if each corresponding column actually exists:
ddequalcolumns.columnswatch=["left_menu", "outerDiv"]

//Input IDs of Top and Bottom rows (Header and Footer)
ddequalcolumns.rowswatch=["header", "footer"]


ddequalcolumns.setHeights=function(reset){

//Calculate total height of header and footer save in variable t, why t?. Good Question.
t=0;
for (var j=0; j<this.rowswatch.length; j++){
if (document.getElementById(this.rowswatch[j])!=null){
var ptop = document.getElementById(this.rowswatch[j]).offsetHeight;
var t = t + ptop;
}
}

//Get padding (top and bottom) set for the body in stylesheet
pad=0
var RefDiv = document.body;
if( window.getComputedStyle ) {
var tpad = getComputedStyle(RefDiv,null).getPropertyValue("padding-top");
var bpad = getComputedStyle(RefDiv,null).getPropertyValue("padding-bottom");
} else if( RefDiv.currentStyle ) {
var tpad = RefDiv.currentStyle.paddingTop;
var bpad = RefDiv.currentStyle.paddingBottom;
}
bpad=parseInt(bpad);
tpad=parseInt(tpad);
pad = bpad+tpad;

//Set tallest to screen height minus header, footer, and any body padding (top and bottom)


var tallest=document.body.clientHeight-t-pad;
var resetit=(typeof reset=="string")? true : false
for (var i=0; i<this.columnswatch.length; i++){
if (document.getElementById(this.columnswatch[i])!=null){
if (resetit)
document.getElementById(this.columnswatch[i]).style.height="auto"
if (document.getElementById(this.columnswatch[i]).offsetHeight>tallest)
tallest=document.getElementById(this.columnswatch[i]).offsetHeight
}
}
if (tallest>0){
for (var i=0; i<this.columnswatch.length; i++){
if (document.getElementById(this.columnswatch[i])!=null)
document.getElementById(this.columnswatch[i]).style.height=tallest+"px"
}
}
}

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

ddequalcolumns.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)
}

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

