//** 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=["main_content", "enquires"]


//Find height of main_content column

//Set height of enquires to main_content height - 110px for the sidebar_top image - height of sidebar h3

ddequalcolumns.setHeights=function(reset){
  var main_col_height = document.getElementById("main_content").offsetHeight
  var enquires_col_height = document.getElementById("enquires").offsetHeight
  var sidebar_background_height = 26
  
  if (main_col_height >= enquires_col_height) {
    document.getElementById("enquires").style.height = main_col_height - sidebar_background_height +"px";    
  } else {
    document.getElementById("main_content").style.height = enquires_col_height + sidebar_background_height +"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")

