(function($){
	$.Revenda = {
		__constructor : function(){
			var me = this;
			me.initConfig();

			// targets (bind em elementos passando o evento)
			$('.revenda_enviar').click(function(e){
				me.validarForm(e);
				return false;
			});

		},

		msg : "",

		validarForm : function(e){
			var me = this;
			me.msg = "";
			if($("#razaosocial").val()!=""){
				if($("#nomefantasia").val() != ""){
					if(validaCNPJ($("#cnpj").val())){
						if($("#cep").val().length == 9){
							if(validarEmail($("#m1").val())){
								if($("#aceito:checked").val() == "1"){
									me.msg = "";
								} else me.emitirAlerta("Você deve marcar que declara serem exatas as informações descritas no formulário",$("#aceito"));
							} else me.emitirAlerta("Preencha o seu email corretamente",$("#m1"));
						} else me.emitirAlerta("Preencha os seu CEP corretamente",$("#cep"));
					} else me.emitirAlerta("Preencha o CNPJ corretamente",$("#cnpj"));
				} else me.emitirAlerta("Preencha o Nome Fantasia da sua empresa",$("#nomefantasia"));
			} else me.emitirAlerta("Preecha a Razão Social da sua empresa",$("#razaosocial"));

			if(me.msg == ""){
				$.boxAdd.criarCamposSubmit(e.target);
			}
		},

		emitirAlerta : function(msg, ele){
			var me = this;
			me.msg = msg;
			alert(msg);
			ele.focus();
		},

		initConfig: function() {
			
		}

	}
})(jQuery);

$(function(){
	$.Revenda.__constructor();
})