<?php
ini_set('display_errors', 0);
require_once './Control/ControlContato.php';
require_once './Util/formAjax/FormAjax.php';
extract($_POST);
if (!isset($lang))
{
	$lang = 'pt';
} else 
{
	if ($lang == 'undefined')
	{
		$lang = 'pt';
	}
}
$controlContato = new ControlContato();
if ($acao == 'inserir')
{
        echo 'Novo Registro...';
        $pk = '';
	$contato = new Contato();
} else
{
	$contato = $controlContato->pegarUmContato($pk);
}
$arquivoGrid = 'adm_home.php';
?>
<form name="frm" id="frm" action="adm_contatoCMD.php" method="post">
    <input id="hacao" name="acao" type="hidden" value="<?php echo $acao?>">
    <input id="lang" name="lang" type="hidden" value="<?php echo $lang?>">
    <input id="arqFrm" name="arqFrm" type="hidden" value="<?php echo end(explode("/", $_SERVER['PHP_SELF']))?>">
	<fieldset>
		<label>Informação de contato</label>
		<section><label for="pk">ID</label>
                    <div><input  readonly="true" type="text" id="pk" name="pk" value="<?php echo $contato->getContatoid(); ?>" placeholder="Este campo é gerido de forma automática."></div>
		</section>
                <section><label for="txtCep">Cep</label>
                    <div><input  title="Formato: 99999-999" type="text" id="txtCep" name="txtCep" required data-regex="^\d{5}-\d{3}$" value="<?php echo $contato->getCep(); ?>"></div>
		</section>
                <section><label for="txtRua">Rua</label>
                    <div><input type="text" id="txtRua" name="txtRua" required value="<?php echo $contato->getRua(); ?>"></div>
		</section>
                <section><label for="txtBairro">Bairro</label>
                    <div><input type="text" id="txtBairro" name="txtBairro" required value="<?php echo $contato->getBairro(); ?>"></div>
		</section>
                <section><label for="txtCidade">Cidade</label>
                    <div><input type="text" id="txtCidade" name="txtCidade" required value="<?php echo $contato->getCidade(); ?>"></div>
		</section>
                <section><label for="txtUF">UF</label>
                    <div><input type="text" id="txtUF" name="txtUF" required value="<?php echo $contato->getUF(); ?>"></div>
		</section>
                <section><label for="txtMaps">Google Maps</label>
                    <div><input type="text" id="txtMaps" name="txtMaps" value="<?php echo $contato->getGooglemaps(); ?>"></div>
		</section>
                <section><label for="txtEmail">E-mail</label>
                    <div><input type="email" id="txtEmail" name="txtEmail" required value="<?php echo $contato->getEmail(); ?>"></div>
		</section>
                <section><label for="txtMSN">MSN</label>
                    <div><input type="email" id="txtMSN" name="txtMSN" value="<?php echo $contato->getMsn(); ?>"></div>
		</section>
                <section><label for="txtSkype">Skype</label>
                    <div><input type="text" id="txtSkype" name="txtSkype" value="<?php echo $contato->getSkype(); ?>"></div>
		</section>
                <section><label for="txtTalk">Google Talk</label>
                    <div><input type="text" id="txtTalk" name="txtTalk" value="<?php echo $contato->getTalk(); ?>"></div>
		</section>
                <section><label for="txtTelefone">Telefone</label>
                    <div><input type="text" id="txtTelefone" name="txtTelefone" value="<?php echo $contato->getTelefone(); ?>"></div>
		</section>
                <section><label for="txtFax">Fax</label>
                    <div><input type="text" id="txtFax" name="txtFax" value="<?php echo $contato->getFax(); ?>"></div>
		</section>
                <section><label for="txtCelular">Celular</label>
                    <div><input type="text" id="txtCelular" name="txtCelular" value="<?php echo $contato->getCelular(); ?>"></div>
		</section>
                <section><label for="txtFacebook">Facebook</label>
                    <div><input type="text" id="txtFacebook" name="txtFacebook" value="<?php echo $contato->getFacebook(); ?>"></div>
		</section>
                <section><label for="txtGoogleMais">Google+</label>
                    <div><input type="text" id="txtGoogleMais" name="txtGoogleMais" value="<?php echo $contato->getGooglemais(); ?>"></div>
		</section>
                <section><label for="txtTwitter">Twitter</label>
                    <div><input type="text" id="txtTwitter" name="txtTwitter" value="<?php echo $contato->getTwitter(); ?>"></div>
		</section>
                <section><label for="txtLinkedin">Linkedin</label>
                    <div><input type="text" id="txtLinkedin" name="txtLinkedin" value="<?php echo $contato->getLinkedin(); ?>"></div>
		</section>
                <section>
                    <div><button onclick="mostrarArquivo('<?php echo $arquivoGrid; ?>','#dados');" >Cancelar</button><button id="salvar" class="submit" name="submitbuttonname" value="submitbuttonvalue">Salvar</button></div>
		</section>
	</fieldset>
</form>
<?php
      FormAjax::javascriptTrocarIdioma('adm_artigoTipoForm.php');
      FormAjax::PrepararFormAjax('#frm');
?>
<script>
    $('#txtCep').wl_Valid();
    $('#txtEmail').wl_Mail();
</script>
    