// JavaScript Document

// ************************************************************************************* \\

var initH = 0;
var newH = 0;
var tmpH = 0;
var tmp;
var _1ex = true;



function onResizeMenu(w, h) {
	var newW = Number(w);
	var newHH = Number(h);
	var swf_menu = window.document.getElementById("menu");
	var div_menu = window.document.getElementById("_menu");
	div_menu.style.width = String(newW + "px");
	swf_menu.width = String(newW);
	div_menu.style.height = String(newHH + "px");
	swf_menu.height = String(newHH);
	
	if (initH == 0 && _1ex == true) {
		initH = newHH;
		if (newH != 0 && _1ex == true) {
			onResizeTop(newH);
		}
		_1ex = false;
	}
}

function onResizeWidthMenuAuxiliar(w) {
	var newW = Number(w);
	var swf_menu = window.document.getElementById("menu_auxiliar");
	var div_menu = window.document.getElementById("_menu_auxiliar");
	
	//var ww = Math.ceil((screen.availWidth - 1000) / 2) + 1000 - newW;
	
	div_menu.style.width = "1000px";//String(newW + "px");
	swf_menu.width = "1000";//String(newW);
	
	//var ww = ((document.body.clientWidth - 1000) / 2) + 1000;
	//div_menu.style.left = String(ww + "px");
}
/*
onresize = coco;
function coco() {
	var swf_menu = window.document.getElementById("menu_auxiliar");
	
	var ww = Math.ceil(((screen.availWidth - 1000) / 2) + 1000) - Number(swf_menu.width);
	var div_menu = window.document.getElementById("_menu_auxiliar");
	div_menu.style.left = String(ww + "px");
}
*/
function onComboOpen(h) {
	var newH = Number(h);
	var swf_menu = window.document.getElementById("menu_auxiliar");
	var div_menu = window.document.getElementById("_menu_auxiliar");
	div_menu.style.height = String(newH + "px");
	swf_menu.height = String(newH);
}
function onComboClose() {
	var swf_menu = window.document.getElementById("menu_auxiliar");
	var div_menu = window.document.getElementById("_menu_auxiliar");
	div_menu.style.height = "60px";
	swf_menu.height = "60";
}

function onResizeTop(h) {
	//var swf_top = window.document.getElementById("topo");
	//var div_top = window.document.getElementById("_topo");
	newH = Number(h);
	//tmpH = swf_top.height;
	//var div_menu = window.document.getElementById("_menu");
	//if (initH == null) {
		//initH = div_menu.offsetHeight;
	//}
	//tmp = window.setInterval(heightTo, 60);

	heightTo2();
}
function heightTo2() {
	var swf_top = window.document.getElementById("topo");
	var div_top = window.document.getElementById("_topo");
	var div_cont = window.document.getElementById("_cont");
	
	div_top.style.height = String(newH + "px");
	div_cont.style.top = String(Number(newH - 100) + "px");
	swf_top.height = String(newH);

	var div_esquerda = window.document.getElementById("dnn_Esquerda");
	//var div_menu = window.document.getElementById("_menu");
	
	//var tamMenu = div_menu.offsetHeight + 120;
	var tamMenu = initH + 120;
	
	var diferenca = 0;
	//if (tamMenu > div_top.offsetHeight && initH != 0) {
	if (tamMenu > newH) {
		diferenca = tamMenu - div_top.offsetHeight + 15;
		//alert("menu maior " + diferenca);
	} else {
		diferenca = 11;
		//alert("topo maior " + diferenca);
	}
	
	div_esquerda.style.marginTop = String(diferenca + "px");
	//div_esquerda.style.paddingTop = String(diferenca + "px");
	
	if (initH != 0 && newH != 0) {
		_1ex = false;
	}
}

function heightTo() {
	tmpH -= Math.ceil((tmpH - newH) * 0.2);
	
	var swf_top = window.document.getElementById("topo");
	var div_top = window.document.getElementById("_topo");
	var div_cont = window.document.getElementById("_cont");
	
	div_top.style.height = String(tmpH + "px");
	div_cont.style.top = String(Number(tmpH - 50) + "px");
	swf_top.height = String(tmpH);

	if (Math.abs(tmpH - newH) < 2) {
		clearInterval(tmp);
	}
}

