/* http://bonrouge.com/~fixH */

//this does it for two
function fixH(one,two) {
if (document.getElementById(one)) {
var lh=document.getElementById(one).offsetHeight;
var rh=document.getElementById(two).offsetHeight;
var nh = Math.max(lh, rh);
document.getElementById(one).style.height=nh+"px";
document.getElementById(two).style.height=nh+"px";
}
}

//this does it for three
function sortNum(a,b) { return b-a}
function fixH2(one,two,three) {
if (document.getElementById(one)) {
var obj=new Array(3);
var option=[one,two,three];
for(var i=0; i<option.length; i++) {
document.getElementById(option[i]).style.height="auto";
obj[i]=document.getElementById(option[i]).offsetHeight;
nh=obj.sort(sortNum);
}
nh1=nh.splice(1,2);
for(var i=0; i<option.length; i++) {
document.getElementById(option[i]).style.height=nh+"px";
}
}
}

//this does it for three
function sortNum2(c,d) { return d-c}
function fixH3(four,five,six) {
if (document.getElementById(four)) {
var obj=new Array(3);
var option=[four,five,six];
for(var i=0; i<option.length; i++) {
document.getElementById(option[i]).style.height="auto";
obj[i]=document.getElementById(option[i]).offsetHeight;
nh=obj.sort(sortNum2);
}
nh1=nh.splice(1,2);
for(var i=0; i<option.length; i++) {
document.getElementById(option[i]).style.height=nh+"px";
}
}
}

//this does it for three
function sortNum3(e,f) { return f-e}
function fixH4(nine,ten,eleven) {
if (document.getElementById(nine)) {
var obj=new Array(3);
var option=[nine,ten,eleven];
for(var i=0; i<option.length; i++) {
document.getElementById(option[i]).style.height="auto";
obj[i]=document.getElementById(option[i]).offsetHeight;
nh=obj.sort(sortNum3);
}
nh1=nh.splice(1,2);
for(var i=0; i<option.length; i++) {
document.getElementById(option[i]).style.height=nh+"px";
}
}
}

window.onload=function(){
fixH('content_left','content_right');
//fixH2('main_content','left_sidebar','right_sidebar');
fixH3('main_content_sub','left_sidebar','right_sidebar');
fixH4('topic_overview_column','secondarycontent_subcolumn','relatedcontent_column');
}



