function gtr_testaTipo(obj)  {
	if (obj.type != "hidden" || obj.name.substring(0,6)=='nn_agp' || obj.name.substring(0,6)=='nn_txt')  {
		// Descobre o label do campo
		oName	= obj.name.substring(3,200);
	//	alert(oName.substring( (oName.length)-4, oName.length ));
		
		if ( oName.substring( (oName.length)-4, oName.length ) == "_Mes" || oName.substring( (oName.length)-4, oName.length ) == "_Ano" )  {
			return true;
		}
		else  {
			oName	= oName.replace("_Dia", "");
			try  {
				label	= document.getElementById("lb_" + oName);
				label	= label.innerHTML;
			}
			catch(e)  {
				try  {
					oName	= obj.name.replace("_Dia", "");
					nomObj	= "GTR_LBL_" + oName;
					label	= obj.form.elements[nomObj].value;
					if (label == "")  {

					}
				}
				catch(e)  {
					try  {
						if (obj.name.indexOf("[") > -1)  {
							oName	= obj.name.substring(0, obj.name.indexOf("["));
							oName	= oName.substring(3, oName.length);
							nomObj	= "lb_" + oName; //lb_mtutabela1
							label	= document.getElementById("lb_" + oName);
							label	= label.innerHTML;
						}
						else  {
							label	= "";
						}
					}
					catch(e)  {
						label	= "";
					}
				}
			}

			switch (obj.name.substring(3, 6))  {
				case "des" : 
						if (Trim(obj) == "")  {
							msgErr	= GTR_TXT_OBRIGATORIO.replace("%", label);
							alert(msgErr);
							obj.focus();
							return false;
						}
						break;
				case "fon" : 
						if (Trim(obj) == "")  {
							msgErr	= GTR_TXT_OBRIGATORIO.replace("%", label);
							alert(msgErr);
							obj.focus();
							return false;
						}else{
							var tamanho = Trim(obj);
							if (tamanho.length != 13){
								msgErr = GTR_TXT_FONE_INCORRETO.replace("%", label);
								alert(msgErr);
								obj.focus();
								return false;
							}
						}
						break;
				case "cep" : 
						if (Trim(obj) == "")  {
							msgErr	= GTR_TXT_OBRIGATORIO.replace("%", label);
							alert(msgErr);
							obj.focus();
							return false;
						}else{
							var tamanho = Trim(obj);
							if (tamanho.length != 9){
								msgErr = GTR_TXT_CEP_INCORRETO.replace("%", label);
								alert(msgErr);
								obj.focus();
								return false;
							}
						}
						break;
				case "cpf" : 
						if (Trim(obj) == "")  {
							msgErr	= GTR_TXT_OBRIGATORIO.replace("%", label);
							alert(msgErr);
							obj.focus();
							return false;
						}else{
							var tamanho = Trim(obj);
							if (tamanho.length != 14){
								msgErr = GTR_TXT_CPF_INCORRETO.replace("%", label);
								alert(msgErr);
								obj.focus();
								return false;
							}else{
								if (typeof ValidaCPF == 'function' && ValidaCPF(obj.value)==false){
									msgErr = GTR_TXT_CPF_INCORRETO.replace("%", label);
									alert(msgErr);
									obj.focus();
									return false;
								}
							}
						}
						break;
				case "pwd" : 
						if (Trim(obj) == "")  {
							msgErr	= GTR_TXT_OBRIGATORIO.replace("%", label);
							alert(msgErr);
							obj.focus();
							return false;
						}
						break;
				case "txt" : 
						if ( tinyMCE.getContent(tinyMCE.getWindowArg('editor_id')) == "" )  {
							msgErr	= GTR_TXT_OBRIGATORIO.replace("%", label);
							alert(msgErr);
							return false;
						}
						break;
	/*
				case "lup" : 
						if (Trim(obj) == "")  {
							if (confirm("O campo " + label + " é um campo de preenchimento obrigatório."))  {
								abreLupa(obj.name);
							}
							return false;
						}
						break;*/
				case "tex" : 
						if ( Trim(obj) == "" )  {
							msgErr	= GTR_TXT_OBRIGATORIO.replace("%", label);
							alert(msgErr);
							obj.focus();
							return false;
						}
						break;
				case "url" : 
						if ( Trim(obj) == "" )  {
							msgErr	= GTR_TXT_OBRIGATORIO.replace("%", label);
							alert(msgErr);
							obj.focus();
							return false;
						}
						break;
				case "mtu" : 
						if ( obj.type=="checkbox" && obj.name.indexOf("[1]") >=0 )  {
							formulario	= obj.form;
							numTotalChk = formulario.elements[obj.id].length;
							if ( numTotalChk == undefined )  {
								if ( !eval("formulario." + obj.id + ".checked") )  {
									msgErr	= GTR_TXT_OBRIGATORIO.replace("%", label);
									alert(msgErr);
									return false;
								}
							}
							else  {
								numTotChekd = 0;
								for ( w=0; w<numTotalChk; w++ )  {
									if ( eval("formulario."+obj.id+"["+w+"].checked") == true )  {
										numTotChekd++;
									}
								}
								if (!numTotChekd)  {
									msgErr	= GTR_TXT_OBRIGATORIO.replace("%", label);
									alert(msgErr);
									return false;
								}
							}
						}
						break;
				case "arq" : 
						/*
						formulario	= obj.form;
						nomeRadio	= obj.name;
						obj			= formulario.elements[nomeRadio];
						if ( Trim(obj) == "" )  {
						//if ( TestaRadioSelecionado(obj) == "" )  {
							msgErr	= GTR_TXT_OBRIGATORIO.replace("%", label);
							alert(msgErr);
							return false;
						}
						break;
						*/
						if ( Trim(obj) == "" )  {
							msgErr	= GTR_TXT_OBRIGATORIO.replace("%", label);
							alert(msgErr);
							if (obj.style.display != 'none')
								obj.focus();
							return false;
						}
						break;
				case "img" : 
						/*
						formulario	= obj.form;
						nomeRadio	= obj.name;
						obj			= formulario.elements[nomeRadio];
						if ( Trim(obj) == "" )  {
						//if ( TestaRadioSelecionado(obj) == "" )  {
							msgErr	= GTR_TXT_OBRIGATORIO.replace("%", label);
							alert(msgErr);
							return false;
						}
						break;
						*/
						if ( Trim(obj) == "" )  {
							msgErr	= GTR_TXT_OBRIGATORIO.replace("%", label);
							alert(msgErr);
							if (obj.style.display != 'none')
								obj.focus();
							return false;
						}
						break;
				case "cod" : 
						if ( TestaComboSelecionado(obj) == "" )  {
							msgErr	= GTR_TXT_COMBOOBRIGATORIO.replace("%", label);
							alert(msgErr);
							obj.focus();
							return false;
						}
						break;
				case "are" : 
						formulario	= obj.form;
						obj	= formulario.elements[obj.name];
						if ( TestaRadioSelecionado(obj) == "" )  {
							msgErr	= GTR_TXT_COMBOOBRIGATORIO.replace("%", label);
							alert(msgErr);
							return false;
						}
						break;
				case "son" : 
						if ( TestaComboSelecionado(obj) == "" )  {
							msgErr	= GTR_TXT_COMBOOBRIGATORIO.replace("%", label);
							alert(msgErr);
							obj.focus();
							return false;
						}
						break;
				case "agp" : 
						if ( parseInt(obj.value) == 0 )  {
							msgErr	= GTR_TXT_OBRIGATORIO.replace("%", label);
							alert(msgErr);
							return false;
						}
						break;
				case "est" : 
						if ( TestaComboSelecionado(obj) == "" )  {
							msgErr	= GTR_TXT_AGRUPADOROBRIGATORIO;
							alert(msgErr);
							obj.focus();
							return false;
						}
						break;
				case "eml" : 
						if (Trim(obj) == "")  {
							msgErr	= GTR_TXT_OBRIGATORIO.replace("%", label);
							alert(msgErr);
							obj.focus();
							return false;
						}
						else  {
							if ( !ChecaEmail(obj.value, label) )  {
								obj.focus();
								return false;
							}
						}
						break;
				case "int" : 
						if (Trim(obj) == "")  {
							msgErr	= GTR_TXT_OBRIGATORIO.replace("%", label);
							alert(msgErr);
							obj.focus();
							return false;
						}
						else  {
							if ( isNaN(obj.value) || obj.value.indexOf(".") >= 0 )  {
								msgErr	= GTR_TXT_OBRIGATORIO.replace("%", label);
								alert(msgErr);
								obj.focus();
								return false;
							}
						}
						break;
				case "flt" : 
						if (Trim(obj) == "")  {
							msgErr	= GTR_TXT_OBRIGATORIO.replace("%", label);
							alert(msgErr);
							obj.focus();
							return false;
						}
						break;
				case "dat" : 
						if (obj.name.substring(obj.name.length-3, obj.name.length) == "Dia")  {
							nome		= obj.name.substring(0, obj.name.length-3);
							d			= obj.form.elements[nome + "Dia"];
							m			= obj.form.elements[nome + "Mes"];
							a			= obj.form.elements[nome + "Ano"];
							if ( !TestaDataDividida(d,m,a,label) )  {
								return false;
							}
						}
						break;
			}
			return true;
		}
	}
	else  {
		return true;
	}
}

function gtr_submit(frm_name, autosend)  {
	if ( (autosend == "" || autosend == undefined) && autosend!=false )  {
		autosend	= true;
	}
	else  {
		autosend	= false;
	}
	var form	= document.forms[frm_name];
	var el		= form.elements;
	var elt		= el.length;
	for ( i=0; i<elt; i++ )  {
		if(typeof el[i].type != 'undefined'){
			// não é agrupador..Fieldset
			if ( el[i].name.substring(0,3) == "nn_" || (el[i].type == "text" && el[i].value != "") )  {
				if (!gtr_testaTipo(el[i]))  {
					return false;
				}
			}
		}
	}

	if ( autosend )  {
		form.submit();
	}
	else  {
		return true;
	}
}