//** 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
		winW = window.innerWidth-20;
		winH = window.innerHeight-20;
	} else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
		//IE 6+ in 'standards compliant mode'
		winW = document.documentElement.clientWidth;
		winH = document.documentElement.clientHeight;
	} else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
		//IE 4 compatible
		winW = document.body.clientWidth;
		winH = document.body.clientHeight;
	}
	var array = new Array();
	array[0] = winW;
	array[1] = winH;
	return array;	
}
//
ddequalcolumns.setMenuPosition = function(reset){
	tamanho = getWindowSize();
	winW = tamanho[0];
	winH = tamanho[1];
	//
	if(winW > 996) {
		leftMenu = winW/2 - 370;
	} else {
		leftMenu = 131;
	}
	document.getElementById('menu').style.left = leftMenu + "px";
}
//
ddequalcolumns.setHeights = function(reset){
	var resetit=(typeof reset=="string")? true : false
	//
	tamanho = getWindowSize();
	winW = tamanho[0];
	winH = tamanho[1];
	//
	if(winW > 996) {
		leftMenu = winW/2 - 370;
		leftLinha = leftMenu + 720; //720 = _width.menu
		widthLinha = winW - leftMenu - 720;
	} else {
		leftMenu = 131;
		leftLinha = leftMenu + 720; //720 = _width.menu
		widthLinha = 996 - leftMenu - 720;
	}
	document.getElementById('menu').style.left = leftMenu + "px";
	document.getElementById('linhaMenu').style.left = leftLinha + "px";
	document.getElementById('linhaMenu').style.width = widthLinha + "px";
	
	if(winW > 996) {
		leftRodape = winW/2 - 490;
		leftLinRodape= leftRodape + 975; //975 = _width.rodape
		widthLinRodape = winW - leftRodape - 975;
	} else {
		leftRodape = 10;
		leftLinRodape = leftRodape + 975; //975 = _width.rodape
		widthLinRodape = 996 - leftRodape - 975;
	}
	document.getElementById('fundoRodape').style.left = leftRodape + "px";
	document.getElementById('linhaRodape').style.left = leftLinRodape + "px";
	document.getElementById('linhaRodape').style.width = widthLinRodape + "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")

