jQuery(function() {
	
	Cufon.replace('#nav li a span, .pagina .header em, .inscricoes .header > span, #selec_nCampos a, #confDados li, #confirmacaoCadastro em, #valorInscricao li p', {hover: true, fontFamily: 'Maven Pro'});
	Cufon.replace('a.onView span, .pagina .header h1, .voltarHome span, .post h1, .pagina .post a, .inscrevase span, .article h2, #listaHorarios li a, #listaPalestrantes li h2, #valorInscricao li span, #valorInscricao li p var , #btn_comochegar, .radioTipo span, .inscreverse form h1, #contButton a, #confirmacaoCadastro h1', {hover: true, fontFamily: 'Maven Pro bold'});
	
	// • • • • • • • • • • • • • • • • • Start plugin slideShow • • • • •
	jQuery('#slider').nivoSlider();
	
	// • • • • • • • • • • • • • • • • • Limpa campos do contato • • • • •
	jQuery('fieldset input[type=text], fieldset input[type=email], fieldset input[type=tel], fieldset input[type=number], textarea').each(function() {
		var default_value = this.value;
		jQuery(this).focus(function() {
			if(this.value == default_value) {
				this.value = '';
			}
		});
		jQuery(this).blur(function() {
			if(this.value == '') {
				this.value = default_value;
			}
		});
	});
	
	// • • • • • • • • • • • • • • • • • Cadastro em evento • • • • •
	jQuery('.radioTipo input').click(function() {
		jQuery(this).parents('.radioTipo').addClass('radioCheck').siblings(".radioTipo").removeClass('radioCheck');
		
		jQuery('#form_inscricao').slideDown('medium');
		var id_evento=jQuery("#id_evento").val();
		
		// Cadastro simples
		if(jQuery("input#tipoInsc_0:checked").val()) {
			jQuery('#selec_nCampos, #listaInsc').slideUp('medium');
			jQuery('#selec_nCampos a').removeClass('onView');
			mostraValor(id_evento,'1');
		}
		// Cadastro lista de pessoas
		if(jQuery("input#tipoInsc_1:checked").val()) {
			jQuery('#selec_nCampos').slideDown('medium');
			jQuery("#areaValor1").html("");
			jQuery("#areaValor2").html("");
		} else {
			jQuery('#selec_nCampos, #listaInsc').slideUp('medium');
			jQuery('#selec_nCampos a').removeClass('onView');
		}
		// Cadastro lista de pessoas
		if(jQuery("input#tipoInsc_2:checked").val()) {
			jQuery('#campo_cupomPromo').slideDown('medium');
			jQuery('#selec_nCampos a').removeClass('onView');
			jQuery("#areaValor1").html("");
			jQuery("#areaValor2").html("");
		} else {
			jQuery('#campo_cupomPromo, #listaInsc').slideUp('medium');
			jQuery('#selec_nCampos a').removeClass('onView');
		}
	});
	
	// • • • • • • • • • • • • • • • • • Seleciona a quantidade de pessoas no grupo • • • • •
	jQuery('#selec_nCampos a').click(function() {
		quantidade = jQuery(this).attr('rel');
		qtd_antiga = jQuery('.onView').attr('rel');
		// condicional caso o mesmo botao seja clicado
		if(qtd_antiga == quantidade) {
			return false;
		} else {
			mostraLinhas(quantidade);
		}
		
		jQuery('#selec_nCampos a').removeClass('onView');
		jQuery(this).addClass('onView');
		document.getElementById("qtdInsc").value=quantidade;
	});
	
	// • • • • • • • • • • • • • • • • • Escreve em dois campos ao mesmo tempo • • • • •
	jQuery("input[name=nomeInsc1]").keyup(function () {
		jQuery("input[name=nome]").val(jQuery(this).val().match(/[^\s]|[ ]/gi).join(""));
	});
	jQuery("input[name=emailInsc1]").keyup(function () {
		jQuery("input[name=email]").val(jQuery(this).val().match(/[^\s]/gi).join(""));
	});
	
	// • • • • • • • • • • • • • • • • • Check sexo selecionado • • • • •
	$('#sexo input').click(function() {
		$('#sexo').children('label').removeClass('onCheck');
		$(this).parents('label').addClass('onCheck');
	});
	jQuery('#sexo input').each(function() {
		var check = jQuery(":checked").attr('value');
		
		if(check == 'F') {
			$('input[value=F]').parents('label').addClass('onCheck');
			
		} else if(check == 'M') {
			$('input[value=M]').parents('label').addClass('onCheck');
		}
	});
	
	
});

