
function Janela(Url, Largura, Altura) {

	window.open(Url, "", "width=" + Largura + ", height=" + Altura + ", scrollbars=yes");
	
	return false;

}

function NovaJanela(e, w, h, p) {
	try {
		param = "";
		
		if (p != null)
			param = ", " + p;
			
		window.open(e.href, '', "width=" + w + ", height=" + h + "" + param);
		
		if (window.event)
			event.returnValue = false;

		return false;
	}
	catch(e) {
		event.returnValue = true;
		return true;
	}
	return false;
}


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;
		}
	}
	
	return true;
}