<!--
function FormataData(campo,teclapres) {
	var tecla = teclapres.keyCode;
	vr = document.frmCreate.txtNascimento.value;
	vr = vr.replace( ".", "" );
	vr = vr.replace( "/", "" );
	vr = vr.replace( "/", "" );
	tam = vr.length + 1;

	if ( tecla != 9 && tecla != 8 ){
		if ( tam > 2 && tam < 5 )
			document.frmCreate.txtNascimento.value = vr.substr( 0, tam - 2  ) + '/' + vr.substr( tam - 2, tam );
		if ( tam >= 5 && tam <= 10 )
			document.frmCreate.txtNascimento.value = vr.substr( 0, 2 ) + '/' + vr.substr( 2, 2 ) + '/' + vr.substr( 4, 4 ); 
	}
}

//-->


<!--
function Confere(formobj){
	// campos obrigatórios
	var fieldRequired = Array("nome", "email", "dia", "mes", "ano", "ddd", "telefone");
	// descrição do campo para aparecer na caixa de diálogo
	var fieldDescription = Array("Nome completo", "Email", "Dia da data de nascimento", "Mês da data de nascimento", "Ano da data de nascimento", "DDD", "Telefone");
	// mensagem da caixa de diálogo
	var alertMsg = "Você ainda não preencheu os campos:\n";
	
	var l_Msg = alertMsg.length;
	
	for (var i = 0; i < fieldRequired.length; i++){
		var obj = formobj.elements[fieldRequired[i]];
		if (obj){
			if (obj.type == null){
				var blnchecked = false;
				for (var j = 0; j < obj.length; j++){
					if (obj[j].checked){
						blnchecked = true;
					}
				}
				if (!blnchecked){
					alertMsg += " - " + fieldDescription[i] + "\n";
				}
				continue;
			}

			switch(obj.type){
			case "select-one":
				if (obj.selectedIndex == -1 || obj.options[obj.selectedIndex].text == ""){
					alertMsg += " - " + fieldDescription[i] + "\n";
				}
				break;
			case "select-multiple":
				if (obj.selectedIndex == -1){
					alertMsg += " - " + fieldDescription[i] + "\n";
				}
				break;
			case "text":
			case "textarea":
				if (obj.value == "" || obj.value == null){
					alertMsg += " - " + fieldDescription[i] + "\n";
				}
				break;
			default:
			}
		}
	}

	if (alertMsg.length == l_Msg){
		return true;
	}else{
		alert(alertMsg);
		return false;
	}
}

//-->


<!--

function abrejanela(url, name) {
popupWin = window.open(url, name, 'scrollbars=yes,resizable,width=468,height=400')
}

//-->



<!--
function reloadFrame(number) {
    if (document.images)
        parent.frames[number-1].location.reload();
    else
        parent.frames[number-1].location.href = parent.frames[number-1].location.href
}
//-->



<!--
function fal(myform) {
 link1 = "produtos_mostra.asp?ident=";
 link2 = document.form2.link.value;
 window.location.href = link1 + link2;
}

function saude(myform) {
 link = document.form5.link.value;
 window.location.href = link;
}

function amigo(url, name) {
popupWin = window.open(url, name, 'scrollbars,resizable,width=317,height=220')
}

function imprimir(url, name) {
popupWin = window.open(url, name, 'scrollbars,resizable,width=585,height=600')
}

function midia(url, name) {
popupWin = window.open(url, name, 'scrollbars=yes,resizable,width=630,height=550')
}

//-->

<!--
function TESTA(CNUMB,CTYPE)
{
  if(Verify(CNUMB, CTYPE))
  {
    alert(CTYPE+" válido!");
  }
  else
  {
    Form.cnpj.value="";
    Form.cnpj.focus();
    alert(CTYPE+" inválido!");
  }
  return;
}

function ClearStr(str, char)
{
  while((cx=str.indexOf(char))!=-1)
  {		
    str = str.substring(0,cx)+str.substring(cx+1);
  }
  return(str);
}

function ParseNumb(c)
{
  c=ClearStr(c,'-');
  c=ClearStr(c,'/');
  c=ClearStr(c,',');
  c=ClearStr(c,'.');
  c=ClearStr(c,'(');
  c=ClearStr(c,')');
  c=ClearStr(c,' ');
  if((parseFloat(c) / c != 1))
  {
    if(parseFloat(c) * c == 0)
    {
      return(c);
    }
    else
    {
      return(0);
    }
  }
  else
  {
    return(c);
  }
}

function Verify(CNUMB,CTYPE)
{
  CNUMB=ParseNumb(CNUMB)
  if(CNUMB == 0)
  {
    return(false);
  }
  else
  {
    g=CNUMB.length-2;
    if(TestDigit(CNUMB,CTYPE,g))
    {
      g=CNUMB.length-1;
      if(TestDigit(CNUMB,CTYPE,g))
      {	
        return(true);
      }
      else
      {
        return(false);
      }
    }
    else
    {
      return(false);
    }
  }
}

function TestDigit(CNUMB,CTYPE,g)
{
  var dig=0;
  var ind=2;
  for(f=g;f>0;f--)
  {
    dig+=parseInt(CNUMB.charAt(f-1))*ind;
    if (CTYPE=='CNPJ')
    { if(ind>8) {ind=2} else {ind++} }
    else
    { ind++ }
  }
  dig%=11;
  if(dig<2)
  {
    dig=0;
  }
  else
  {
    dig=11-dig;
  }
  if(dig!=parseInt(CNUMB.charAt(g)))
  {
    return(false);
  }
  else
  {
    return(true);
  }
}
//-->
