function AreaRestrita(){

	

	
	$('#frmAreaRestrita #txtCnpj').focus(function () 
	{
			if($(this).val() == SITE_FORM_CNPJ)
			{
				$("#frmAreaRestrita #txtCnpj").unmask();
					$(this).val('');
				$("#frmAreaRestrita #txtCnpj").mask('99.999.999/9999-99');
			
			}
			 	
	});
	
	$("#frmAreaRestrita #pswSenha").click(
		function()
		{
			if($(this).val() == SITE_FORM_SENHA)
			{
				$(this).val('');
			}
		}
	);
	

	
	$("#frmAreaRestrita").validate(
		{
			submitHandler: function() 							
			{
				$.ajax({
					cache: false,
					data: {
						txtCnpj: $("#txtCnpj", "#frmAreaRestrita").val(),
						pswSenha: $("#pswSenha", "#frmAreaRestrita").val()					
					},
					dataType: "json",
					success: function(resposta)
					{
						Contato.bloquear(false);
						
						$("#mensagemLogin").html(resposta.mensagem);
						
						if (resposta.sucesso)
						{
							$("#mensagemLogin").attr({
								"class": "sucesso"
							});
							
							Contato.limpar();
							document.location = "area-restrita/"
						}
						else
						{
							$("#mensagemLogin").attr({
								"class": "erro"
							});
						}
					},
					type: "post",
					url: $("#frmAreaRestrita").attr("action")
				})
			},
			errorClass: "erro",
			errorPlacement: function(error, element)	
			{
				$("#mensagemLogin").html(error);
			},
			rules: 
			{
				txtCnpj: 
				{
					required: true,
					cnpj:true
				},
				pswSenha: 
				{
					required: true
				}
			},
			messages:
			{
				txtCnpj: 
				{
					required: "Preencha o campo de CNPJ",
					cnpj: "Campo possui CNPJ inv&aacute;lido"
				},
				pswSenha:
				{
					required: "Campo possui Senha inv&aacute;lida"
				}
			}
		});
};