function Centralizar() {

	dv = document.getElementById("Geral");
		
	var h = 0, w = 0, w2 = 0;

	if( typeof( window.innerWidth ) == 'number' ) {
		//Non-IE
		w2 = window.innerWidth;
		h = window.innerHeight;
	}
	else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
		//IE 6+ in 'standards compliant mode'
		w2 = document.documentElement.clientWidth;
		h = document.documentElement.clientHeight;
	}
	else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
		//IE 4 compatible
		w2 = document.body.clientWidth;
		h = document.body.clientHeight;
	}
	
	dv.style.marginTop = ((h / 2) - (434 / 2))  + "px";

}


function Janela(Url, Largura, Altura) {
	L = Largura;
	A = Altura;
	if (navigator.appName.indexOf("Explorer") != -1) {
		L += 16;
		A += 0;
	}
	window.open(Url, "", "width = " + L + ", height = " + A + ", scrollbars=yes, resizeable=yes");
	return false;
}
function Janela_Fit(Url, Largura, Altura) {
	L = Largura;
	A = Altura;
	if (navigator.appName.indexOf("Explorer") != -1) {
		L += 0;
		A += 0;
	}
	window.open(Url, "", "width = " + L + ", height = " + A + ", scrollbars=no, resizeable=yes");
	return false;
}

function jCadastro(Url, Largura, Altura) {
	window.open(Url, "", "width = " + Largura + ", height = " + Altura + ", scrollbars=yes");
}


function ValidarFormulario(Form) {
	Campos = Form.getElementsByTagName("input");
	for (a = 0; a < Campos.length; a++) {
		if (Campos[a].type == "text" && Campos[a].getAttribute("obrigatorio") != null && Campos[a].value.length == 0) {
			alert("Campo de preenchimento obrigatório.");
			Campos[a].focus();
			return false;
		}
	}
	
	Campos = Form.getElementsByTagName("select");
	for (a = 0; a < Campos.length; a++) {
		if (Campos[a].getAttribute("obrigatorio") != null && Campos[a].options[Campos[a].selectedIndex].value.length == "") {
			alert("Campo de preenchimento obrigatório.");
			Campos[a].focus();
			return false;
		}
	}
	
	Campos = Form.getElementsByTagName("textarea");
	for (a = 0; a < Campos.length; a++) {
		if (Campos[a].getAttribute("obrigatorio") != null && Campos[a].value.length == 0) {
			alert("Campo de preenchimento obrigatório.");
			Campos[a].focus();
			return false;
		}
	}
}


function ValidarCampos(Itens) {
	for (a = 0; a < Itens.length; a++) {
		if (document.getElementById(Itens[a]).type.indexOf("select") != -1) {
			if (document.getElementById(Itens[a]).selectedIndex == 0) {
				alert("Campo de preenchimento obrigatório.");
				document.getElementById(Itens[a]).focus();
				return false;
			}
		}
		else {
			if (document.getElementById(Itens[a]).value.length == 0) {
				alert("Campo de preenchimento obrigatório.");
				document.getElementById(Itens[a]).focus();
				return false;
			}
		}
	}
	return true;
}





