<!--
function doPost(formName, actionName)
{
    var hiddenControl = document.getElementById('action');
    var theForm = document.getElementById(formName);
    
    hiddenControl.value = actionName;
    theForm.submit();
}
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
<!--

//	USADO EM SELECTS ONCHANGE PARA IR PARA UMA PÁGINA E ENVIAR O VALOR SELECIONADO
function selGoTo(URL, OBJ)
{
	var VAL = OBJ.options[OBJ.selectedIndex].value;
	document.location = URL+'?UF='+VAL;	
}

/**********************************************************************************************************************************************************
	CADASTRO
**********************************************************************************************************************************************************/
//	FUNÇÃO QUE GERA MASCARA NOS CAMPOS
function Mascara (OBJ, EVT, VAL)
{
	var EVT		= (EVT) ? EVT : (window.event) ? window.event : "";
	var NTECLA	= (EVT.which) ? EVT.which : EVT.keyCode;
	
	if((NTECLA < 48 || NTECLA > 57) && (NTECLA != 8 && NTECLA != 9 && NTECLA !=37 && NTECLA !=39 && NTECLA !=46 && NTECLA != 48  && NTECLA !=116))
		return false;

	var MASK	= new Array();
		MASK[1] = '#####-###';		//	CEP
		MASK[2]	= '(##) ####-####';	//	FONE
		MASK[6]	= '####-####';		//	FONE SEM DDD
		MASK[3]	= '###.###.###-##';	//	CPF
		MASK[4]	= '##/##/####';		//	DATA
		MASK[5]	= '####';			//	DATA SÓ ANO
	var TIPO	= MASK[VAL]
	var FIXOS	= '().-:/ ';
	var VALOR = OBJ.value;
	
	if (EVT)
	{
		var SIZE = VALOR.length;
		if (SIZE >= TIPO.length && (NTECLA != 8 && NTECLA != 9))
			return false;

		if(NTECLA != 8 && NTECLA != 9)
		{
			var POS = TIPO.substr(SIZE, 1);
			while (FIXOS.indexOf(POS) != -1)
			{
				VALOR  += POS;
				SIZE	= VALOR.length;
				if (SIZE >= TIPO.length && (NTECLA != 8 && NTECLA != 9))
					return false;
				POS = TIPO.substr(SIZE, 1);
			}
		}
	}
	OBJ.value = VALOR;
	return true;
}

// LIMITA QUANTIDADE DE CARACTERES EM UM CAMPO
function txtCounter(OBJ, SHOW, MAX)
{
	if (OBJ.value.length > MAX)
	{
		OBJ.value = OBJ.value.substring(0, MAX);
		alert("Número máximo de caracteres alcançado");
	}
	else 
	{
		if(SHOW)
			document.getElementById(SHOW).value = MAX - OBJ.value.length;
	}
}


/* ***************************************************************************** */

//	JS QUE INSERE UM CAMPO tipo COM NOME nome E VALUE obj DENTRO DE doc	
function insField (NM_FORM, TIPO, NOME, OBJ)
{
	var DOC		= document.forms[NM_FORM];

	if(newACT 			= document.createElement("INPUT"))
	{
		newACT.type		= TIPO;
		newACT.name 	= NOME;
		newACT.value	= OBJ;
		DOC.appendChild( newACT );
		return true;
	}
};

//	JS QUE ANALISA O FORM E VERIFICA SE OS CAMPOS COM title='Obrigatório' ESTÃO PREENCHIDOS	
function chkFields (NM_FORM)
{
	var DOC		= document.forms[NM_FORM];
	var LIST	= DOC.elements;
	var NOME, ID, TITLE, VAL;

	for (i=0; i<LIST.length; i++)
	{
		VAL 	= null;
		NOME	= LIST[i].name;
		ID		= LIST[i].id;
		TITLE	= LIST[i].title;
		if (LIST[i].type=="select-one")
		{
			VAL = LIST[i].options[LIST[i].selectedIndex].value;
		}
		else if (LIST[i].type=="select-multiple")
		{
			for( var c= 0; c < LIST[i].length; c++ )
				if (LIST[i][c].selected == true)
					VAL++;
		}
		else
		{
			VAL = LIST[i].value;
		}
		

		if (TITLE=="Obrigatório" && (VAL==""|| VAL==null || VAL==" " || VAL=="0" || VAL=="Selecione uma cidade abaixo" || VAL=="Selecione um estado acima"))
		{
			alert('Preencha o campo '+ ID);
			LIST[i].focus();
			return false;
		} 
	}
};

//	VALIDAÇÃO SIMPLES, APENAS ANALISA OS CAMPOS OBRIGATÓRIOS
function cnfFormSimples (NM_FORM)
{
	var DOC		= document.forms[NM_FORM];
	var LIST	= DOC.elements;

	if(chkFields(NM_FORM) == false)
		return false;

	DOC.submit();
}

function cnfFormSimples2 (NM_FORM)
{
	var DOC		= document.forms[NM_FORM];
	var LIST	= DOC.elements;

	if(chkFields(NM_FORM) == false)
		return false;

	DOC.submit();
	// alert(' Seu orçamento foi enviado com sucesso!  Aguarde até um consultor Metalife Pilates entrar em contato com você. ');
}

function cnfFormSimples3 (NM_FORM)
{
	var DOC		= document.forms[NM_FORM];
	var LIST	= DOC.elements;

	if(chkFields(NM_FORM) == false)
		return false;

	DOC.submit();
}

function cnfFormSimples4 (NM_FORM)

{
	var DOC		= document.forms[NM_FORM];
	var LIST	= DOC.elements;

	if(chkFields(NM_FORM) == false)
		return false;
}

//-->