//** 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()
//
function getWindowSize() {
	var winW = 0, winH = 0;
	//
	if( typeof( window.innerWidth ) == 'number' ) {
		//Non-IE
		agent = 'other';
		winW = window.innerWidth-20;
		winH = window.innerHeight-20;
	} else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
		//IE 6+ in 'standards compliant mode'
		agent = 'ie';
		winW = document.documentElement.clientWidth;
		winH = document.documentElement.clientHeight;
	}
	var array = new Array();
	array[0] = agent;
	array[1] = winW;
	array[2] = winH;
	return array;	
}
//
ddequalcolumns.setHeights = function(reset) {
	//
	tamanho = getWindowSize();
	agent = tamanho[0];
	winW = tamanho[1];
	winH = tamanho[2];
	contentH = document.getElementById('mainContent').offsetHeight;
	//
	if(contentH > winH) {
		if(agent == 'ie') {
			lateralW = winW - 700;
			lateralH = contentH;
		} else {
			lateralW = winW - 696;
			lateralH = contentH;
		}
	} else {
		if(agent == 'ie') {
			lateralW = winW - 700;
			lateralH = winH - 32;
		} else {
			lateralW = winW - 696;
			lateralH = winH - 12;
		}
	}
	//
	document.getElementById('imagemLateral').style.width = lateralW + "px";
	document.getElementById('imagemLateral').style.height = lateralH + "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(){ ddequalcolumns.setHeights() }, "resize")
