
function getHTTPObject() {
	var xmlhttp;
	if (!xmlhttp && typeof XMLHttpRequest != 'undefined') {
		try {
			xmlhttp = new XMLHttpRequest();
		} 
		catch (e) {
				xmlhttp = false;
		}
	}
	return xmlhttp;
}

var http = getHTTPObject();

function submeterContraCheque(form) {
	
	for	(i = 0; i < form.length; i++) 
	if (form[i].value == "") {
		alert('É necessário o preenchimento de todos os campos.');
		return false;
	}	
	http.open("GET",'joomla_site_ins_valida_contracheque.php?cpf=' + form.cpf.value +'&matricula=' + form.matricula.value + '&identificador=' + form.identificador.value + '&consulta=OK', true);
	//document.getElementById("enviaContraCheque").innerHTML = 'Consuldando Dados...';
	http.onreadystatechange = confirmaEnvio;
	http.send(null);	
}


function confirmaEnvio()
{
	if (http.readyState == 4) 
	{
		parent.document.getElementById("enviaContraCheque").innerHTML = http.responseText;		
		parent.mostraContraCheque();
	}
}
