
function log(message) {
    if (!log.window_ || log.window_.closed) {
        var win = window.open("", null, "width=400,height=200," +
                              "scrollbars=yes,resizable=yes,status=no," +
                              "location=no,menubar=no,toolbar=no");
        if (!win) return;
        var doc = win.document;
        doc.write("<html><head><title>Debug Log</title></head>" +
                  "<body></body></html>");
        doc.close();
        log.window_ = win;
    }
    var logLine = log.window_.document.createElement("div");
    logLine.appendChild(log.window_.document.createTextNode(message));
    log.window_.document.body.appendChild(logLine);
}




var ddequalcolumns=new Object()




//Input IDs (id attr) of columns to equalize. Script will check if each corresponding column actually exists:
//ddequalcolumns.columnswatch=["leftcolumn", "container_rightcontent"]


/*
ddequalcolumns.setHeights=function(reset){	
	var tallest=document.documentElement.clientHeight;
	var resetit=(typeof reset=="string")? true : false	
	
	for (var i=0; i<this.columnswatch.length; i++)
	{
		log('current element :'+this.columnswatch[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"
			}
		}
		log(tallest);
	}

*/


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)
}




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";
		}
	}

	//log('1 element :'+document.getElementById("vertical-dots").style.height);
		
	var newheight = (document.getElementById("vertical-dots").offsetHeight)+140;

	if (document.documentElement.clientHeight >= newheight)
	{
		newheight = document.documentElement.clientHeight;
	}
	

	//log('2 element :'+newheight);

	document.getElementById("leftcolumn").style.height= newheight+'px';
	document.getElementById("container_rightcontent").style.height= newheight+'px';

}



ddequalcolumns.resetHeights=function(){
	fixH2('left-content','vertical-dots','right-content')
	//this.setHeights("reset")
}

ddequalcolumns.dotask(window, function(){fixH2('left-content','vertical-dots','right-content')} , "load")


//ddequalcolumns.dotask(window, function(){ddequalcolumns.setHeights()}, "load")
ddequalcolumns.dotask(window, function(){if (typeof ddequalcolumns.timer!="undefined") clearTimeout(ddequalcolumns.timer); ddequalcolumns.timer=setTimeout("ddequalcolumns.resetHeights()", 500)}, "resize")


