<!-- 
var arrForms = new Array();
arrForms['FORM_OBJECT'] = new Array();
arrForms['FORM_FIELDS'] = new Array();
arrForms['FORM_FIELDS_TYPE'] = new Array();
arrForms['FORM_ERROR_MESSAGES'] = new Array();

function checkForm(intIdForm){
	var blnFieldsChecked = true;
	var objForm = eval(arrForms['FORM_OBJECT'][intIdForm]);
	var strErrorMessage = 'Os campos deste formulário marcados com um asterisco (*) devem ser completados. Por favor complete os campos requeridos e clique novamente no botão "Enviar".\n-----------------------------------------------------------------------------------------------------------------------------------------\n';
	var arrFocus = new Array();
	for(intCheckX in arrForms['FORM_FIELDS'][intIdForm]){
		var strCurrentErrorMessage = arrForms['FORM_ERROR_MESSAGES'][intIdForm][intCheckX];

		switch(arrForms['FORM_FIELDS_TYPE'][intIdForm][intCheckX]){
			case 'text':
				var strFieldValue = eval('objForm.' + arrForms['FORM_FIELDS'][intIdForm][intCheckX]).value;
				arrFocus[intCheckX] = eval('objForm.' + arrForms['FORM_FIELDS'][intIdForm][intCheckX]);
				
				if(!isText(strFieldValue)){
					var blnFieldsChecked = false;
					arrFocus[intCheckX].style.color="#ff0000";
					arrFocus[intCheckX].value = "llene todos los campos";
					strErrorMessage+= strCurrentErrorMessage + '\n';
				}else{
					arrFocus[intCheckX].style.color="#5a4e47";
				}
			break;
			case 'number':
				var strFieldValue = eval('objForm.' + arrForms['FORM_FIELDS'][intIdForm][intCheckX]).value;
				arrFocus[intCheckX] = eval('objForm.' + arrForms['FORM_FIELDS'][intIdForm][intCheckX]);

				if(!isNumber(strFieldValue)){
					var blnFieldsChecked = false;
					arrFocus[intCheckX].style.color="#ff0000";
					arrFocus[intCheckX].value = "llene todos los campos";
					strErrorMessage+= strCurrentErrorMessage + '\n';
				}else{
					arrFocus[intCheckX].style.color="#5a4e47";
				}
			break;
			case 'email':
				var strFieldValue = eval('objForm.' + arrForms['FORM_FIELDS'][intIdForm][intCheckX]).value;
				arrFocus[intCheckX] = eval('objForm.' + arrForms['FORM_FIELDS'][intIdForm][intCheckX]);

				if(!isEmail(strFieldValue)){
					var blnFieldsChecked = false;
					arrFocus[intCheckX].style.color="#ff0000";
					arrFocus[intCheckX].value = "llene todos los campos";
					strErrorMessage+= strCurrentErrorMessage + '\n';
				}else{
					arrFocus[intCheckX].style.color="#5a4e47";
				}
			break;
			case 'cpf':
				var strFieldValue = eval('objForm.' + arrForms['FORM_FIELDS'][intIdForm][intCheckX]).value;
				arrFocus[intCheckX] = eval('objForm.' + arrForms['FORM_FIELDS'][intIdForm][intCheckX]);
				var strCampo = (document.getElementById(arrForms['FORM_FIELDS'][intIdForm][intCheckX]).parentNode.childNodes[0].name == undefined) ? document.getElementById(arrForms['FORM_FIELDS'][intIdForm][intCheckX]).parentNode.childNodes[1].name : document.getElementById(arrForms['FORM_FIELDS'][intIdForm][intCheckX]).parentNode.childNodes[0].name;
				var label = document.getElementById("lb" + strCampo);
				if(!isCPF(strFieldValue)){
					label.style.color = "#ff0000";
					var blnFieldsChecked = false;
					arrFocus[intCheckX].style.borderColor="#ff0000";
					strErrorMessage+= strCurrentErrorMessage + '\n';
				}else{
					arrFocus[intCheckX].style.borderLeftColor="#376cb1";
					arrFocus[intCheckX].style.borderTopColor="#376cb1";
					arrFocus[intCheckX].style.borderRightColor="#fff";
					arrFocus[intCheckX].style.borderBottomColor="#fff";
					label.style.color = "#376cb1";
				}
			break;
			case 'selected':
				var strFieldValue = eval('objForm.' + arrForms['FORM_FIELDS'][intIdForm][intCheckX] + '[objForm.' + arrForms['FORM_FIELDS'][intIdForm][intCheckX] + '.selectedIndex]').value;
				arrFocus[intCheckX] = eval('objForm.' + arrForms['FORM_FIELDS'][intIdForm][intCheckX]);
				
				var strCampo = (document.getElementById(arrForms['FORM_FIELDS'][intIdForm][intCheckX]).parentNode.childNodes[0].name == undefined) ? document.getElementById(arrForms['FORM_FIELDS'][intIdForm][intCheckX]).parentNode.childNodes[1].name : document.getElementById(arrForms['FORM_FIELDS'][intIdForm][intCheckX]).parentNode.childNodes[0].name;
				var label = document.getElementById("lb" + strCampo);
				if(!isSelected(strFieldValue)){
					label.style.color = "#ff0000";
					var blnFieldsChecked = false;
					arrFocus[intCheckX].style.borderColor="#ff0000";
					strErrorMessage+= strCurrentErrorMessage + '\n';
				}else{
					arrFocus[intCheckX].style.borderLeftColor="#376cb1";
					arrFocus[intCheckX].style.borderTopColor="#376cb1";
					arrFocus[intCheckX].style.borderRightColor="#fff";
					arrFocus[intCheckX].style.borderBottomColor="#fff";
					label.style.color = "#376cb1";
				}
			break;
			case 'checked':
				var strFieldValue = eval('objForm.' + arrForms['FORM_FIELDS'][intIdForm][intCheckX]);
				var strCampo = (document.getElementById(arrForms['FORM_FIELDS'][intIdForm][intCheckX]).parentNode.childNodes[0].name == undefined) ? document.getElementById(arrForms['FORM_FIELDS'][intIdForm][intCheckX]).parentNode.childNodes[1].name : document.getElementById(arrForms['FORM_FIELDS'][intIdForm][intCheckX]).parentNode.childNodes[0].name;
				var label = document.getElementById("lb" + strCampo);
				if(!isChecked(strFieldValue)){
					label.style.color = "#ff0000";
					var blnFieldsChecked = false;
					arrFocus[intCheckX] = false;
					strErrorMessage+= strCurrentErrorMessage + '\n';
				}else{
					arrFocus[intCheckX].style.borderLeftColor="#376cb1";
					arrFocus[intCheckX].style.borderTopColor="#376cb1";
					arrFocus[intCheckX].style.borderRightColor="#fff";
					arrFocus[intCheckX].style.borderBottomColor="#fff";
					label.style.color = "#376cb1";
				}
			break;
			case 'date':
				var strFieldValue = eval('objForm.' + arrForms['FORM_FIELDS'][intIdForm][intCheckX]).value;
				if(!isDate(strFieldValue)){
					var blnFieldsChecked = false;
					arrFocus[intCheckX] = eval('objForm.' + arrForms['FORM_FIELDS'][intIdForm][intCheckX]);
					strErrorMessage+= strCurrentErrorMessage + '\n';
				}
			break;
		}
	}
	
	if(!blnFieldsChecked){
		//alert(strErrorMessage);

		var intFocus;
		for(intFocusX in arrFocus){
			intFocus = intFocusX;
			break;
		}
		
		if(arrFocus[intFocus]){
			arrFocus[intFocus].focus();		
		}
		return false;
	}else{
		//objForm.submit();
		return true;
	}
}

function checkForm2(intIdForm,messageError){
	var blnFieldsChecked = true;
	var objForm = eval(arrForms['FORM_OBJECT'][intIdForm]);
	var strErrorMessage = messageError;
	var arrFocus = new Array();
	for(intCheckX in arrForms['FORM_FIELDS'][intIdForm]){
		var strCurrentErrorMessage = arrForms['FORM_ERROR_MESSAGES'][intIdForm][intCheckX];

		switch(arrForms['FORM_FIELDS_TYPE'][intIdForm][intCheckX]){
			case 'text':
				var strFieldValue = eval('objForm.' + arrForms['FORM_FIELDS'][intIdForm][intCheckX]).value;
				if(!isText(strFieldValue)){
					var blnFieldsChecked = false;
					arrFocus[intCheckX] = eval('objForm.' + arrForms['FORM_FIELDS'][intIdForm][intCheckX]);
					strErrorMessage+= strCurrentErrorMessage + '\n';
				}
			break;
			case 'number':
				var strFieldValue = eval('objForm.' + arrForms['FORM_FIELDS'][intIdForm][intCheckX]).value;
				if(!isNumber(strFieldValue)){
					var blnFieldsChecked = false;
					arrFocus[intCheckX] = eval('objForm.' + arrForms['FORM_FIELDS'][intIdForm][intCheckX]);
					strErrorMessage+= strCurrentErrorMessage + '\n';
				}
			break;
			case 'email':
				var strFieldValue = eval('objForm.' + arrForms['FORM_FIELDS'][intIdForm][intCheckX]).value;
				if(!isEmail(strFieldValue)){
					var blnFieldsChecked = false;
					arrFocus[intCheckX] = eval('objForm.' + arrForms['FORM_FIELDS'][intIdForm][intCheckX]);
					strErrorMessage+= strCurrentErrorMessage + '\n';
				}
			break;
			case 'cpf':
				var strFieldValue = eval('objForm.' + arrForms['FORM_FIELDS'][intIdForm][intCheckX]).value;
				if(!isCPF(strFieldValue)){
					var blnFieldsChecked = false;
					arrFocus[intCheckX] = eval('objForm.' + arrForms['FORM_FIELDS'][intIdForm][intCheckX]);
					strErrorMessage+= strCurrentErrorMessage + '\n';
				}
			break;
			case 'selected':
				var strFieldValue = eval('objForm.' + arrForms['FORM_FIELDS'][intIdForm][intCheckX] + '[objForm.' + arrForms['FORM_FIELDS'][intIdForm][intCheckX] + '.selectedIndex]').value;
				if(!isSelected(strFieldValue)){
					var blnFieldsChecked = false;
					arrFocus[intCheckX] = eval('objForm.' + arrForms['FORM_FIELDS'][intIdForm][intCheckX]);
					strErrorMessage+= strCurrentErrorMessage + '\n';
				}
			break;
			case 'checked':
				var strFieldValue = eval('objForm.' + arrForms['FORM_FIELDS'][intIdForm][intCheckX]);
				if(!isChecked(strFieldValue)){
					var blnFieldsChecked = false;
					arrFocus[intCheckX] = false;
					strErrorMessage+= strCurrentErrorMessage + '\n';
				}
			break;
			case 'date':
				var strFieldValue = eval('objForm.' + arrForms['FORM_FIELDS'][intIdForm][intCheckX]).value;
				if(!isDate(strFieldValue)){
					var blnFieldsChecked = false;
					arrFocus[intCheckX] = eval('objForm.' + arrForms['FORM_FIELDS'][intIdForm][intCheckX]);
					strErrorMessage+= strCurrentErrorMessage + '\n';
				}
			break;
		}
	}
	
	if(!blnFieldsChecked){
		//alert(strErrorMessage);

		var intFocus;
		for(intFocusX in arrFocus){
			intFocus = intFocusX;
			break;
		}
		
		if(arrFocus[intFocus]){
			arrFocus[intFocus].focus();		
		}

	}else{
		objForm.submit();
	}
}
//-->

