//############## SELECT CLUBES    
$(function () {


// ##############################
// SELECT DISTRITOS / CLUBES
// #############################
$("select[name=adesao_distrito]").change(function(){
beforeSend:$("select[name=adesao_clube]").html('<option value="0"> Aguarde, a carregar... </option>');

var adesao_distrito = $("select[name=adesao_distrito]").val();
$.post("https://localhost/fitnessup/_cdn/load_distritos.php",{adesao_distrito: adesao_distrito},function(pega_cat){
complete:$("select[name=adesao_clube]").html(pega_cat);
});

});
// ##############################
// SELECT DISTRITOS / CLUBES
// #############################







// LOADING PAGE
$(window).load(function() {
	// Animate loader off screen
	$(".se-pre-con").fadeOut("slow");;
});






// ##############################
// USER - COMPLETE DADOS
// #############################
$(document).ready(function(){
$("input[name='adesao_email']").blur(function(){
	var $adesao_name = $("input[name='adesao_name']");
	var $adesao_lastname = $("input[name='adesao_lastname']");
	var $adesao_telefone = $("input[name='adesao_telefone']");
	var $adesao_nif = $("input[name='adesao_nif']");
	$.getJSON('https://localhost/fitnessup/_cdn/load_users.php',{ 
		adesao_email: $( this ).val() 
	},function( json ){
		$adesao_name.val( json.adesao_name );
		$adesao_lastname.val( json.adesao_lastname );
		$adesao_telefone.val( json.adesao_telefone );
		$adesao_nif.val( json.adesao_nif );
	});
});
});
// ##############################
// USER - COMPLETE DADOS
// #############################



// AVISO HOME
$(".close-aviso").on("click", function(){
  $('.wc_domain_license_box').fadeOut(200);
});




// MODAL EM DIRETO
$(".open-modal-direto").on("click", function(){
  $('.wc_domain_license_box').fadeIn(200);
  $('.menu_uptv_mobile').fadeOut(200);
});

$(".close-aviso").on("click", function(){
  //$('.wc_domain_license_box').fadeOut(200);
  $('.menu_uptv_mobile').fadeIn(200);
});



// **********
// UPTV
// **********

// OPEN CADASTRO/LOGIN
$(".j_open_cadastro").on("click", function(){
  $('.modal_tv_login_box').show();
});


// FECHA MODAL
$(".close-aviso").on("click", function(){
  $('.modal_tv_login_box').hide();
});



//CADASTRO/LOGIN
$(".j_uptv_nocadastro").on("click", function(){
  $('.j_tv_form_login').hide();
  $('.j_tv_form_cadastro').show();
});


$(".j_uptv_yescadastro").on("click", function(){
  $('.j_tv_form_cadastro').hide();
  $('.j_tv_form_login').show();
});


//MENU MOBILE
$(".j_menu_open_mobile").on("click", function(){
  $('.j_menu_open_mobile').hide();
  $('.j_menu_close_mobile').show();
  $('.sub_menu_tv_mobile').show();
});

$(".j_menu_close_mobile").on("click", function(){
  $('.j_menu_close_mobile').hide();
  $('.j_menu_open_mobile').show();
  $('.sub_menu_tv_mobile').hide();
});




//MENU MOBILE LP
$(".j_menu_open_mobile_lp").on("click", function(){
  $('.j_menu_open_mobile_lp').hide();
  //$('.j_menu_close_mobile_lp').show();
  $('.sub_menu_mobile_lp').show();
});

$(".j_menu_close_mobile_lp").on("click", function(){
  $('.j_menu_close_mobile_lp').hide();
  $('.j_menu_open_mobile_lp').show();
  $('.sub_menu_mobile_lp').hide();
});



//FECHA AVISO CONTA CRIADA
$(".j_close_aviso_conta").on("click", function(){
  $('.barra_aviso_conta').hide();
});



// OPEN CHAT DA AULA
$(".j_open-chat").on("click", function(){
  $('.barra_aviso_conta').hide();
});



//if ((navigator.userAgent.match(/iPhone/)) || (navigator.userAgent.match(/iPod/))) {
//   $(".carousel-slider .slick-dots").css('top','400');
//}

// **********
// UPTV
// **********




//ABRIR/FECHAR MENU SEARCH MOBILE
$(".j_search_m").on("click", function(){
  //$(".navbar-search-m").slideUp();
  $('.navbar-search-m').fadeIn(200);
  $(this).next().slideDown();
});

$(".btn-close").on("click", function(){
  $('.navbar-search-m').fadeOut(200);
});




//ADESAO ONLINE BARRA FOOTER MOBILE
$(".j_barra_open").on("click", function(){
  $('.icon_abre').fadeOut(10);
  $('.icon_fecha').fadeIn(10);
  $('.barra_lista_open').fadeIn(50);
});

$(".j_barra_fecha").on("click", function(){
  $('.icon_fecha').fadeOut(10);
  $('.icon_abre').fadeIn(10);
  $('.barra_lista_open').fadeOut(50);
});




//ABRIR/FECHAR BREVEMENTE
$(".j_open_breve").on("click", function(){
  $('.tag_brevemente').fadeIn(200);
});

$(".j_breve_close").on("click", function(){
  $('.tag_brevemente').fadeOut(200);
});




//ABRIR FAQS E BOAS VINDAS
$(".abrir").on("click", function(){
  $(".sub-item").slideUp();
  $(this).next().slideDown();
});



//OPEN LISTA CLUBES ABERTOS
$('.j_open_select').click(function(){
//alert('TESTE');
$('.jwc_lista_modal').fadeIn(200);
});


//CLUBES ABERTOS 1
$('.j_open_clubes1').click(function(){
//alert('TESTE');
$('.modal_clubes1').fadeIn(200);
});


//CLUBES ABERTOS 2
$('.j_open_clubes2').click(function(){
//alert('TESTE');
$('.modal_clubes2').fadeIn(200);
});


//CLUBES ABERTOS 3 - RINGUE COMBATE (Junbo Maia e São João)
//$('.j_open_clubes3').click(function(){
//$('.modal_clubes3').fadeIn(200);
//});


//MAPA DE AULAS
$('.j_open_clubes4').click(function(){
//alert('TESTE');
$('.modal_clubes4').fadeIn(200);
});


//CLOSUM CLUBES ABERTOS
$('.j_open_clubes5').click(function(){
//alert('TESTE');
$('.modal_clubes5').fadeIn(200);
});




//CLOSUM PROXIMAS ABERTURAS
$('.j_open_clubes6').click(function(){
//alert('TESTE');
$('.modal_clubes6').fadeIn(200);
});




//PRE-VENDA
$('.j_open_prevenda').click(function(){
$('.modal-pre-venda').fadeIn(200);
});


// MODAL CAMPANHAS
$('.j_open_campanha').click(function(){
$('.modal_campanha').fadeIn(200);
});


//FERIAS 2019 - LP
$('.j_open_lp_ferias2019').click(function(){
//alert('TESTE');
$('.modal_clubeslp_ferias2019').fadeIn(200);
});


//VOTA PELA BOA FORMA
$('.j_open_votaboaforma').click(function(){
//alert('TESTE');
$('.modal_clubeslp_votapelaboaforma').fadeIn(200);
});




//CLOSE MODAL
$('.jwc_clubes_close').click(function () {
        $('.clubes_lista_modal').fadeOut(200);
        return false;
    });


//ABRE LISTA MAPA DE AULAS
$('.j_abre_filter_aulas').click(function(){
//alert('TESTE');
$('#timetable_filter').fadeIn(200);
});


});


jQuery(function($){
   $("#DataAniver").mask("99/99/9999");
   //$("#phone").mask("(999) 999-9999");
});




jQuery(document).ready(function() {
//timetable
// filter items when filter link is clicked
jQuery('#timetable_filter a').on('click', function(e){
	e.preventDefault();
	var $timetable = jQuery('#timetable');
	var selector = jQuery(this).attr('data-filter');
	if ( jQuery(this).hasClass('selected') ) {
	  // return false;
	  return;
	} else {
		jQuery(this).parent().parent().find('a').removeClass('selected');
		jQuery(this).addClass('selected');
	}
	if (selector === 'all') {
		$timetable.find('a').stop().animate({opacity: 1}, {queue: false}, 50);
	} else {
		$timetable.find('a').stop().animate({opacity: 0}, {queue: false}, 50);
		$timetable.find(selector).stop().animate({opacity: 1}, {queue: false}, 50);
	}
});

});


//$(document).ready(function(){
//  $('.multiple-items').slick({
//  infinite: true,
//  slidesToShow: 4,
//  autoplay: true,
//  arrows: true,
//  dots: true,
//  slidesToScroll: 4
//});
//});




//$('document').ready(function(){
//   $('#demo').jplist({				
//      itemsBox: '.list' 
//      ,itemPath: '.list-item' 
//      ,panelPath: '.jplist-panel'	
//   });
//   
//});

//jplist.init();





/***********************************************
* COMBO SELECT DISTRITO
***********************************************/
//$(function(){
//$("select[name=uf]").change(function(){
//beforeSend:$("select[name=cidade]").html('<option value="0"> Aguarde, carregando... </option>');
//
//var uf = $("select[name=uf]").val();
//$.post("https://localhost/fitnessup/_cdn/load_estados.php",{uf: uf},function(pega_estado){
//complete:$("select[name=cidade]").html(pega_estado);
//});
//});
//});



// OPEN MENU MOBILE - NEW VERSION
function openNav() {
  document.getElementById("mySidenav").style.width = "320px";
  $('.j_logotipo_m').hide();
  $('.j_logotipo_m2').show();
}

/* Set the width of the side navigation to 0 */
function closeNav() {
  document.getElementById("mySidenav").style.width = "0";
  $('.j_menu_open_mobile_lp').show();
  $('.j_logotipo_m').show();
  $('.j_logotipo_m2').hide();
}


$('.j_mapa').click(function(){
	$('.sidenav').hide();
});








