<?php session_start();
include("lib/config.php");
if ($_SESSION[cnpj]=="")
{ header("Location:gerar.php"); }

if ($_SESSION[ACAO]=="GRAVA")
{
$_SESSION[nome]="";
$_SESSION[endereco]="";
$_SESSION[numero]="";
$_SESSION[complemento]="";
$_SESSION[bairro]="";
$_SESSION[cep]="";
$_SESSION[cidade]="";
$_SESSION[telefone]="";
$_SESSION[cnae]="";
}
else
{$_SESSION[ACAO]="ALTERA";}
?>

<script src="js/MascaraValidacao.js" type="text/javascript"></script>
<SCRIPT language=JavaScript>
      window.status='SINSWeb ';

function fAjuda(){
 window.open("duvida_cnae.php","Aviso","width=500,height=495,top=30,left=190,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no,copyhistory=no");
}


</SCRIPT>

   <html>
    <head>

	<script language="javascript">
	<!--aqui começa a função para desabilitar a tecla enter
	function desabilitarenter() 
	{
		var tecla = event.keyCode;
		if ((tecla == 13)) 
			{return false;}
		return tecla;
	}
	// --> aqui termina a função para desabilitar a tecla enter.
	</script>

    <script type="text/javascript" language="JavaScript1.2">


        function sGravar()
        {
			if (sConsiste(document.fEmpresa))
			{document.fEmpresa.submit();} 
        }

		function sConsiste(df)
		
		{
		  if (df.fNome.value == "")
			{
			alert("Informe a Razão Social");
			df.fNome.focus();
			return false;
			}	
		  if (df.fCNAE.value == "")
			{
			alert("Informe o CNAE principal da Empresa");
			df.fCNAE.focus();
			return false;
			}	
		  if (df.fCNAE.value.length > 0)
		  {
			if (df.fCNAE.value == "0000000")
			{
			alert("CNAE Inválido!");
			df.fCNAE.focus();
			return false;
			}
		  }
		  return true;
		}
		
		function isNumeric(str) 
		{
			var er = /^[0-9]+$/;   
			return (er.test(str)); 
		}
			
			
        function sLimpa()
        {
         document.fEmpresa.reset();
        }

        function sMostraNumero(keypres)
        {
         var keynum = keypres.keyCode;
         alert("Número: " + keynum);
        }
    </script>
    <style type="text/css">
         input  { font-family: Verdana; font-size: 8pt }
         select { font-family: Verdana; font-size: 8pt }

    </style>
    <title>:: Cadastro de Empresa ::</title>
    <link href="css/my.css" rel="stylesheet" type="text/css">
    <style type="text/css">
         input  { font-family: Verdana; font-size: 8pt }
         select { font-family: Verdana; font-size: 8pt }

    </style>
    <style type="text/css">
<!--
.style3 {
	font-size: 9px;
	font-weight: bold;
}
.style6 {font-size: 11px}
body {
	background-color: #FFFFFF;
}
.style7 {color: #CC0000}
.style8 {color: #000000}
.style9 {
	font-family: Verdana, Arial, Helvetica, sans-serif;
	color: #990000;
	font-weight: bold;
}
-->
    </style>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <script language="JavaScript" type="text/JavaScript">
<!--
function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);
//-->
    </script>
    </head>
    <body leftmargin="5" topmargin="0" onLoad="fEmpresa.fNome.focus();">
<table width="865" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td height="19" >&nbsp;</td>
  </tr>
  <tr>
    <td class=titulo_topo width="766" height="19" >Agendamento Homologa&ccedil;&atilde;o OnLine</td>
  </tr>
  <tr>
    <td>&nbsp;</td>
  </tr>
  <tr>
    <td class=titulo height="19" >&nbsp;</td>
  </tr>
  <tr> 
    <td class=titulo_topo width="766" height="19" >CADASTRO 
      DE EMPRESA</td>
  </tr>
  <tr> 
    <td> <div align="center">
      <table width="450" border="0" align="center" cellpadding="10" cellspacing="0">
          <tr> 
            <td width="10"> <form ACTION="acoes.php" METHOD=POST name="fEmpresa" target="dentro" onKeyPress="return desabilitarenter();" FORM>
                <table border="0" cellpadding="0" cellspacing="0" width="100%">
                  <tr> 
                    <td valign="top"> <div align="left"> 
                        <table width="414" border="0" align="center">
                          <tr> 
                            <td colspan="5" align="right" valign="middle">&nbsp;</td>
                          </tr>
                          <tr> 
                            <td width="88"><div align="right" valign="middle"><font face="Verdana" size="1"> <strong><?=$_SESSION[tipo];?>:</strong> </font></div></td>
                            <td colspan="4"><input type="text" name="fCnpj" size="22" maxlength="14" value=<?=$_SESSION[cnpj];?> readonly="true"></td>
                          </tr>
                          <tr> 
                            <td>&nbsp;</td>
                            <td colspan="4">&nbsp;</td>
                          </tr>
                          <tr> 
                            <td><div align="right"><font face="Verdana" size="1"> <strong>Raz&atilde;o 
                                Social :</strong> </font></div></td>
                            <td colspan="4"><input name="fNome" type="text" id="fNome3" size="55" maxlength="50" onBlur="javascript:document.forms[0].fNome.value=document.forms[0].fNome.value.toUpperCase()" value="<?=$_SESSION[nome];?>"> 
                            </td>
                          </tr>
                          <tr> 
                            <td><div align="right"><font face="Verdana" size="1"> <strong>Endere&ccedil;o 
                                :</strong></font></div></td>
                            <td colspan="4"><input name="fEndereco" type="text" id="fEndereco3"
			onBlur="javascript:document.forms[0].fEndereco.value=document.forms[0].fEndereco.value.toUpperCase()" value="<?=$_SESSION[endereco];?>" size="55" maxlength="50"></td>
                          </tr>
                          <tr> 
                            <td><div align="right"><font face="Verdana" size="1"><strong>N&uacute;mero 
                                :</strong></font></div></td>
                            <td width="84"><input name="fNumero" type="text" id="fNumero3"
			onBlur="javascript:document.forms[0].fNumero.value=document.forms[0].fNumero.value.toUpperCase()" value="<?=$_SESSION[numero];?>" size="15" maxlength="10"></td>
                            <td colspan="2"><div align="right"><font face="Verdana" size="1"><strong>Complemento 
                                :</strong></font> </div></td>
                            <td width="144"> <div align="left"> 
                                <input name="fComplemento" type="text" id="fComplemento3"
  			onBlur="javascript:document.forms[0].fComplemento.value=document.forms[0].fComplemento.value.toUpperCase()" value="<?=$_SESSION[complemento];?>" size="22" maxlength="30">
                              </div></td>
                          </tr>
                          <tr> 
                            <td><div align="right"><font face="Verdana" size="1"><strong>CEP 
                                :</strong></font></div></td>
                            <td><input name="fCEP" type="text" id="fCEP3" 
					onKeyPress="mascara(this,cep)" value="<?=$_SESSION[cep];?>" size="15" maxlength="10">
                            <td colspan="2"><div align="right"><font face="Verdana" size="1"><strong>Bairro 
                                :</strong></font></div></td>
                            <td><input name="fBairro" type="text" id="fBairro3"
  			onBlur="javascript:document.forms[0].fBairro.value=document.forms[0].fBairro.value.toUpperCase()" value="<?=$_SESSION[bairro];?>" size="22" maxlength="30"> 
                            </td>
                          </tr>
                          <tr> 
                            <td><div align="right"><font face="Verdana" size="1"><strong>Cidade 
                                :</strong></font></div></td>
                            <td colspan="4"> <div align="left"> 
                                <input name="fCidade" type="text" id="fCidade3"
  			onBlur="javascript:document.forms[0].fCidade.value=document.forms[0].fCidade.value.toUpperCase()" value="<?=$_SESSION[cidade];?>" size="43" maxlength="50">
                                <font face="Verdana" size="1"><strong> UF:</strong></font>
                                <select name="fUF" id="fUF">
                                  <option value="AC" <? if ($_SESSION[uf]=='AC') {print('selected');} ?>>AC</option>
                                  <option value="AL" <? if ($_SESSION[uf]=='AL') {print('selected');} ?>>AL</option>
                                  <option value="AP" <? if ($_SESSION[uf]=='AP') {print('selected');} ?>>AP</option>
                                  <option value="AM" <? if ($_SESSION[uf]=='AM') {print('selected');} ?>>AM</option>
                                  <option value="BA" <? if ($_SESSION[uf]=='BA') {print('selected');} ?>>BA</option>
                                  <option value="CE" <? if ($_SESSION[uf]=='CE') {print('selected');} ?>>CE</option>
                                  <option value="DF" <? if ($_SESSION[uf]=='DF') {print('selected');} ?>>DF</option>
                                  <option value="ES" <? if ($_SESSION[uf]=='ES') {print('selected');} ?>>ES</option>
                                  <option value="GO" <? if ($_SESSION[uf]=='GO') {print('selected');} ?>>GO</option>
                                  <option value="MA" <? if ($_SESSION[uf]=='MA') {print('selected');} ?>>MA</option>
                                  <option value="MT" <? if ($_SESSION[uf]=='MT') {print('selected');} ?>>MT</option>
                                  <option value="MS" <? if ($_SESSION[uf]=='MS') {print('selected');} ?>>MS</option>
                                  <option value="MG" selected>MG</option>
                                  <option value="PA" <? if ($_SESSION[uf]=='PA') {print('selected');} ?>>PA</option>
                                  <option value="PB" <? if ($_SESSION[uf]=='PB') {print('selected');} ?>>PB</option>
                                  <option value="PR" <? if ($_SESSION[uf]=='PR') {print('selected');} ?>>PR</option>
                                  <option value="PE" <? if ($_SESSION[uf]=='PE') {print('selected');} ?>>PE</option>
                                  <option value="PI" <? if ($_SESSION[uf]=='PI') {print('selected');} ?>>PI</option>
                                  <option value="RJ" <? if ($_SESSION[uf]=='RJ') {print('selected');} ?>>RJ</option>
                                  <option value="RN" <? if ($_SESSION[uf]=='RN') {print('selected');} ?>>RN</option>
                                  <option value="RS" <? if ($_SESSION[uf]=='RS') {print('selected');} ?>>RS</option>
                                  <option value="RO" <? if ($_SESSION[uf]=='RO') {print('selected');} ?>>RO</option>
                                  <option value="RR" <? if ($_SESSION[uf]=='RR') {print('selected');} ?>>RR</option>
                                  <option value="SC" <? if ($_SESSION[uf]=='SC') {print('selected');} ?>>SC</option>
                                  <option value="SP" <? if ($_SESSION[uf]=='SP') {print('selected');} ?>>SP</option>
                                  <option value="SE" <? if ($_SESSION[uf]=='SE') {print('selected');} ?>>SE</option>
                                  <option value="TO" <? if ($_SESSION[uf]=='TO') {print('selected');} ?>>TO</option>
                                </select>
                            </div></td>
                          </tr>
                          <tr> 
                            <td><div align="right"><font face="Verdana" size="1"><strong>Telefone 
                                : </strong></font></div></td>
                            <td><input name="fTelefone" type="text" id="fTelefone3"
                    onKeyPress="mascara(this,telefone);" value="<?=$_SESSION[telefone];?>" size="14" maxlength="14"></td>
                            <td width="62">&nbsp;</td>
                            <td width="14">&nbsp;</td>
                            <td>&nbsp;</td>
                          </tr>
                          <tr>
                            <td><div align="right"><font face="Verdana" size="1"><strong>CNAE Principal:</strong></font></div></td>
                            <td colspan="4"><table width="100%" border="0" cellspacing="0" cellpadding="0">
                              <tr>
                                <td width="7%"><font face="Verdana" size="1"><strong><img src="img/help.gif" alt="Ajuda" width="13" height="18" border="0" onClick="fAjuda();"></strong></font></td>
                                <td width="93%"><input name="fCNAE" type="text" id="fCNAE" value="<?=$_SESSION[cnae];?>" size="22" maxlength="22"  >
                                (informe o CNAE principal)</td>
                              </tr>
                            </table>
                            <p>&nbsp;</p></td>
                          </tr>
                        </table>
                      </div>
                      <div align="center"></div>
                      <div align="left"> 
                        <table border="0" cellspacing="0" cellpadding="0" width="100%">
                          <tr> 
                            <td>&nbsp;</td>
                          </tr>
                          <tr> 
                            <td valign="top"> <div align="center"> 
                                <input name="Button" type="button" style="font-family: Tahoma; font-size: 8 pt; color: #FF0000" 
						onClick="sGravar(); " value="Gravar">
                                <input name="Button" type="button" style=
    "font-family: Tahoma; font-size: 8 pt; color: #000" onClick="sLimpa();" value="Limpar">
                                <input name="button" type="button" value="Voltar" onClick=history.back() 
						style="font-family: Tahoma; font-size: 8 pt; color: #000" >
                              </div></td>
                            <td> <p align="right"> </p></td>
                          </tr>
                        </table>
                      </div></td>
                  </tr>
                </table>
              </form></td>
          </tr>
        </table>
        <p align="right">&nbsp; <br>
        </p>
      </div></td>
  </tr>
</table>
<br>
<style type="text/css">
<!--
.style2 {font-size: 11px; font-family: Geneva, Arial, Helvetica, sans-serif;}
.style4 {
	font-size: 12;
	font-weight: bold;
}
-->
</style>
</body>
</html>
    </body>
</html>
