I have a tidy bit of java script that makes div columns the same hieght as the tallest div. Great. I'm using this to make the divs in my wrapper/page container have background images on the sides so that it looks like the page has a drop shadow. Because it's an expanding, fluid layout this is the only thing I can find that works.

What I now want is to re-use this code so that I can apply the same logic to divs within the page. So the question is how can I re-use the same code but point at different divs?

example: Here is the bit that references the divs:

ddequalcolumns.columnswatch=["left-sidebar", "right-sidebar", "content",]

I have tried copying it so that i have ddequalcolumns2.columnswatch2=["new1", etc] but that doesn't seem to work.

Any ideas? Please. I am new to Javascript.

Many thanks in advance!

here's the rest of the code:

"

var ddequalcolumns=new Object()
//Input IDs (id attr) of columns to equalize. Script will check if each corresponding column actually exists:

ddequalcolumns.columnswatch=["left-sidebar", "right-sidebar", "content",]

ddequalcolumns.setHeights=function(reset){
var tallest=0
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()", 1000)}, "resize")