// JavaScript Document
function openAjax() {
	var ajax;
	try {
		ajax = new XMLHttpRequest();
	} catch(ee) {
		try {
			ajax = new ActiveXObject("Msxml2.XMLHTTP");
		} catch(e) {
			try {
				ajax = new ActiveXObject("Microsoft.XMLHTTP");
				alert("asa");
			} catch(E) {
				ajax = false;
				
			}
		}
	}
	return ajax;
}

function gE(ID) {
	return document.getElementById(ID);
}

function gEs(tag) {
	return document.getElementsByTagName(tag);
}

function cPost(dados){
	dados = dados.replace(/[&]/g,'%26');
	dados = escape(dados);
	return dados;
}

function remover() {
	var a = confirm("Tem certeza que deseja excluir?");
		if (a == false) {
			return false;
		} 
}

function valida_busca(){
	cor_original = "#cdcdcd";
	cor_erro = "#e57f7f";
	
	erro = 0;
	
	campos = new Array();
	formulario = "busca";
	campos[0] = "campo_busca";
	
	for(i=0;i<campos.length;i++){
		if(!document[formulario][campos[i]].value){ cor_objeto=cor_erro; erro = 1; } else { cor_objeto=cor_original; }
		document[formulario][campos[i]].style.borderColor = cor_objeto;
	}
	
	if(erro == 1){
		alert("Todos os campos em vermelhos são de preenchimento obrigatório!");
		return false;
	} else {
		return true;
	}
}
