function FIND(item) {
	if( window.mmIsOpera ) return(document.getElementById(item));
	if (document.all) return(document.all[item]);
	if (document.getElementById) return(document.getElementById(item));
	return(false);
}
// limpa os dados do formulario
function limpaForm(quem){
	f = FIND(quem);
				for (i=0; i<f.length; i++) {
					if (f.elements[i].type == "checkbox") {
						f.elements[i].checked = false;
					}else if (f.elements[i].type == "radio") {
						f.elements[i].checked = false;					
					}else if (f.elements[i].type == "text" || f.elements[i].type == "password"){
						f.elements[i].value = '';
					}else if (f.elements[i].type == "select-one"){
						f.elements[i].value = '';
					}
				}
				
}
function destaque(quem){
	FIND(quem).style.background = '#FFFF00';
}
// desabilita o formulario
function disabledForm(quem){
		f = FIND(quem);
				for (i=0; i<f.length; i++) {
					f.elements[i].disabled = true;
				}
}
function process(v){
	if (v == 0){
		FIND('processando').style.visibility = 'hidden';
	}else{
		FIND('processando').style.visibility = 'visible';
	}
	FIND('rodape').style.display = 'none';
	FIND('conteudo').style.height = '';
	FIND('lateraldireita').style.height = '';

}
function PopUp(theURL,winName,features,pw,ph) { //v2.0

   w = screen.availWidth;
   h = screen.availHeight;

	
	var popW = pw, popH = ph;
	
	var leftPos = (w-popW)/2, topPos = (h-popH)/2;
	
	opcoes = features+'width='+pw+',height='+ph+',left='+leftPos+',top='+topPos;
	
	  window.open(theURL,winName,opcoes);
}
// history back
function initialize() {
            dhtmlHistory.initialize();
            dhtmlHistory.addListener(historyChange);
			if (dhtmlHistory.isFirstLoad()) {
				dhtmlHistory.add('home','xajax_showNews()');
			}
}
function historico() {
	var ancora;
	var f;
	var funcao;
	var funcao_arguments=''; 
	
	a= historico.arguments;
	for(i=0;i<a.length;i++){
		if(i==0){
			ancora=a[i];
		}else if(i==1){
			f=a[i];
		}else{
			funcao_arguments += '\''+a[i]+'\'';
			if(i<a.length){
				funcao_arguments += ',';
			}
		}
	}
	funcao_arguments = funcao_arguments.substring(0,funcao_arguments.length-1);
	funcao = f+'('+funcao_arguments+')';
	dhtmlHistory.add(ancora,funcao);
	//alert (funcao);
}
         
function historyChange(newLocation, historyData) {
	process(1);
	eval(historyData);
}

// balanceamento vertical de colunas
function balenceColumn() {


		// the divs array contains references to each column's div element.  
		// Replace 'center' 'right' and 'left' with your own.  
		// Or remove the last one entirely if you've got 2 columns.  Or add another if you've got 4!
		var divs = new Array(FIND('menulateral'), FIND('conteudomoldura'), FIND('lateraldireita'));
		
		
		// Let's determine the maximum height out of all columns specified
		var maxHeight = 0;
		for (var i = 0; i < divs.length; i++) {
			if (divs[i].offsetHeight > maxHeight) maxHeight = divs[i].offsetHeight;
		}
		
		/*
		// Let's set all columns to that maximum height
		for (var i = 0; i < divs.length; i++) {
			divs[i].style.height = maxHeight + 'px';

			// Now, if the browser's in standards-compliant mode, the height property
			// sets the height excluding padding, so we figure the padding out by subtracting the
			// old maxHeight from the new offsetHeight, and compensate!  So it works in Safari AND in IE 5.x
			if (divs[i].offsetHeight > maxHeight) {
				divs[i].style.height = (maxHeight - (divs[i].offsetHeight - maxHeight)) + 'px';
			}
		} */
		
		
		FIND('rodape').style.top = (maxHeight + 136) + 'px';
		FIND('rodape').style.display = 'block';
		FIND('conteudo').style.height = (maxHeight - 54) + 'px';
		FIND('lateraldireita').style.height = maxHeight + 'px';
		
		if (FIND('lateraldireita').offsetHeight > maxHeight) {
			FIND('lateraldireita').style.height = (maxHeight - (FIND('lateraldireita').offsetHeight - maxHeight)) + 'px';
		}
		
		//teste = (maxHeight + 126);
		//alert(maxHeight );
}
