/*######################################################################################################*/
function paginaAnterior () {
	history.go(-1);
}
/* ###################################################################################################### */
function localizacao (prPagina) {
	document.location.href = prPagina;
}
/* ###################################################################################################### */
function removeMensagem (prInputId) {
	jQuery('#'+prInputId).find('.hint').remove();
}
/* ###################################################################################################### */
function retornaMensagem (prInputId,prMensagem,prClasse) {
	jQuery('#'+prInputId).parent().find('.hint').remove();
	jQuery('#'+prInputId).parent().append('<div class="hint erro">'+prMensagem+'</div>').show();
}
/* ###################################################################################################### */
function checaForm (prFormId, prDarSubmit){
	var temErro = false;

	jQuery('#'+prFormId+' .campo').each (function () {
		jQuery(this).find('input[type=text],input[type=password],select,textarea').each (function () {
			if (jQuery(this).attr('lang') != '' && jQuery(this).val() == '') {
				retornaMensagem (jQuery(this).attr('id'),jQuery(this).attr('lang'),'erro');
				
				if (!temErro) {
					jQuery(this).focus();
					temErro = true;
				}
			}
		});
	});
	
	if (prDarSubmit && !temErro) {
		document.getElementById(prFormId).submit();
	}
	
	if (temErro) {
		return false;
	} else {
		return true;
	}
}
/*#######################################################################################*/
function iniciaAjax() {
	try {
 		ajax = new ActiveXObject("Microsoft.XMLHTTP");
  	} catch(e) {
		try {
    		ajax = new ActiveXObject("Msxml2.XMLHTTP");
 		} catch(ex) {
    		try {
      			ajax = new XMLHttpRequest();
	   		} catch(exc) {
				alert('Esse browser não tem recursos para uso do Ajax');
   				ajax = null;
    		}
 		}
	}
  	return ajax;
}
