$(document).ready(function(){

    /* tamanhodafonte */ 
    $('.dimfon').click(function(){	   
        curSize = parseInt($('body').css('font-size')) - 2;
        if(curSize >= 15){
            $('body').css({ 'font-size': curSize });
        }
    });
    $('.aumfon').click(function(){	   
        curSize = parseInt($('body').css('font-size')) + 2;
        if(curSize <= 20){
            $('body').css({ 'font-size': curSize });
        }
    });

    /* contraste */ 
    $('.padcon').click(function(){
        $.ajax({
            type: 'GET',
			url: Url+'/contraste/padrao.html',
            success: function(data){
                $('body').removeAttr('class');
            }
        });
    });
    $('.altcon').click(function(){
        $.ajax({
            type: 'GET',
			url: Url+'/contraste/alto.html',
            success: function(data){
                $('body').addClass('contraste');
            }
        });
    });

    /* cabecalho */
    $('.menu ul > li.dd').click(function(e){
		if($(this).is(':visible')){
			$(this).removeClass('sel');
			$(this).parent().find('li').removeClass('sel');
            $(this).parent().find('li').children('ul.sub').hide();
            $(this).parent().find('li').children('ul.subsub').removeClass('sel');
            $('ul.subsub').hide();
		}
        $(this).addClass('sel');
        $(this).children('ul.sub').show();
        
        //subsub is visible
        if($('.ddsub.sel').is(':visible')){
            $('.menu ul > li.ddsub').removeClass('sel');
            $('ul.subsub').hide();
        }
        e.stopPropagation();
    });
    $(document).click(function(){
        if($('.dd.sel').is(':visible')){
            $('.menu ul > li.dd, .menu ul > li.ddsub').removeClass('sel');
            $('ul.sub').hide();
            $('ul.subsub').hide();
        }
    });
    $('.menu ul > li.ddsub').click(function(e){
		$(this).each(function(){
			$(this).removeClass('sel');
			$(this).parent().find('li').removeClass('sel');
            $(this).parent().find('li').children('ul.subsub').hide();
		});
        $(this).addClass('sel');
        $(this).children('ul.subsub').show();
        e.stopPropagation();
    });
    
	$('.menu > p a').click(function(e){
		if($(this).is(':visible')){
            $('.menu > ul').toggle();
            $(this).toggleClass('sel');
            $('.menu > p a i').toggleClass('ion-navicon-round ion-close-round');
            e.stopPropagation();
        }
	});
    $(document).click(function(){
        if($('.menu > p a.sel').is(':visible')){
            $('.menu > ul').toggle();
            $('.menu > p a').toggleClass('sel');
            $('.menu > p a i').toggleClass('ion-navicon-round ion-close-round');
            
            $('.menu ul > li.dd, .menu ul > li.ddsub').removeClass('sel');
            $('ul.sub').hide();
            $('ul.subsub').hide();
        }
    });
    
    /*$(window).resize(function(){
		if($(window).width() <= 980){
    
			$(window).scroll(function(){
				if($(this).scrollTop() > 0){
					$('.menu ul').fadeOut(50);
					$('.menu p a i').removeClass('fa-close').addClass('fa-navicon');
				}
			});
	
		}
    });*/
    
    /* nav 
    var ddm = $(".menu");
	var icomenu = $(".menuresp i");
	$('.menuresp a').click(function(e){
        e.stopPropagation();        
        if($(this).attr('class') != 'sel'){
            $(this).addClass('sel');
            ddm.fadeIn(500, 'easeOutExpo', function(){
                $(this).show();
            });
            icomenu.removeClass('fa-navicon');
            icomenu.addClass('fa-close');
        } else {
            $(this).removeClass('sel');
            ddm.fadeOut(500, 'easeOutExpo', function(){
                $(this).hide();
            });
            icomenu.removeClass('fa-close');
            icomenu.addClass('fa-navicon');
        }
	});
    
    function is_touch_device(){
        return (('ontouchstart' in window) || (navigator.MaxTouchPoints > 0) || (navigator.msMaxTouchPoints > 0));
    }
    
    $(window).resize(function(){
        if($(window).width() > 599){
            ddm.css({ display: 'block' });
        }
        if($(window).width() <= 599){
            if(!is_touch_device()){
                ddm.css({ display: 'none' });
            }
        }
    });
    
    $(document).keydown(function(e){
		if(e.keyCode == 27){
            if($(window).width() < 599){
                $('.menuresp a').removeClass('sel');
                icomenu.removeClass('fa-close');
                icomenu.addClass('fa-navicon');
                ddm.fadeOut(500, 'easeOutExpo', function(){
                    $(this).hide();
                });
            }
			return false;
		}
	});*/
        
    /* vagasdeemprego */
    var slidev = $('.vagasdisponiveis ul').lightSlider({
        verticalHeight: 106,
        vertical:       true,
        item:           1,
        auto:           true,
        loop:           true,
        pauseOnHover:   true
    });
    $('.vagasdeemprego .lSPrev').click(function(){
        slidev.goToPrevSlide(); 
    });
    $('.vagasdeemprego .lSNext').click(function(){
        slidev.goToNextSlide(); 
    });
    
	/* subir */
	$('.subir a, a.subir').click(function(){
		$('body, html').scrollTop(0);
		return false;
	});

});$(document).ready(function(){

    /* overlay 
	$('.enviaremail a').click(function(){ 
		$('.oveema').fadeIn('500','easeInOutExpo');
		$('body').css({ overflow: 'hidden' });
	});
    
	$('.enviarcurriculo a').click(function(){ 
		$('.ovecur').fadeIn('500','easeInOutExpo');
		$('body').css({ overflow: 'hidden' });
	});
    
	$('.fechar').click(function(){ 
		$('.overlay').fadeOut('500','easeInOutExpo');
		$('body').removeAttr('style');
	});
    
	$(document).keydown(function(e){
		if(e.keyCode == 27){
			$('.overlay').fadeOut('500','easeInOutExpo');
            $('body').removeAttr('style');
		}
	});*/
    
    /* email 
    $("#envema").click(function(){
		var atualizando = $(".atualizando");
		var atualizado  = $(".atualizado");
		var nome        = $("#nome").val();
		var email       = $("#email").val();
		var mensagem    = $("#mensagem").val();
		$.ajax({
			type: "post",
			url: Url+"/enviar-email.html",
			data: { nome: nome, email: email, mensagem: mensagem },
			beforeSend: function(data){
				atualizado.hide();
				atualizando.show();
			},
			complete: function(data){
				setTimeout(function(){
					atualizando.hide();
				}, 1000);
			},
			success: function(data){
				atualizado.html(data);
				setTimeout(function(){
					atualizado.show();
				}, 1000);
			},
			error: function(){
				atualizado.html("<span class='erro'>Ocorreu um erro!</span>");	
			}
		});
	});

	$(".atualizado").click(function(){ 
		$(this).hide(); 
	});*/
    
    /* menu 
    var ddm = $(".menu");
	var icomenu = $(".menuresp i");
	var posmenscr = 72;
    
    $('.menu ul li a').click(function(e){
        e.preventDefault();
        $('body, html').animate({
            scrollTop: $($(this).attr('href')).offset().top - posmenscr
        }, { easing: 'easeInOutExpo', duration: 500 });
        if($(window).width() <= 599){
            $('.menuresp a').removeClass('sel');
            icomenu.removeClass('fa-close');
            icomenu.addClass('fa-navicon');
            ddm.fadeOut(500, 'easeOutExpo', function(){
                $(this).hide();
            });
            $('body').css({ overflow: 'visible' });
        }
    });
    
    $(document).on('scroll', function(){
        var scrollPos = $(document).scrollTop();
        $('.menu li a').each(function(){
            var linkvis = $(this);
            var elemento = $(linkvis.attr('href'));
            if(elemento.position().top - posmenscr <= scrollPos && elemento.position().top + elemento.height() > scrollPos){
                $('.menu ul li a').removeClass('sel');
                linkvis.addClass('sel');
            } else {
                linkvis.removeAttr('class');
            }
        });
    });*/
    
    /* menu */
    $('.urlsubmenu').lightGallery({
        selector: 'this',
        counter: false,
        zoom: false,
        actualSize: false,
        getCaptionFromTitleOrAlt: false,
        hideControlOnEnd: true
    });
    
    /* destaques */
    $('.destaques ul').lightSlider({
        adaptiveHeight: true
    });
    
    /* banners */
    $('.urlbanner').lightGallery({
        selector: 'this',
        counter: false,
        zoom: false,
        actualSize: false,
        getCaptionFromTitleOrAlt: false,
        hideControlOnEnd: true
    });
    
});$(document).ready(function(){

    /* filtro */
    $('.filtro input[name=filtrar]').keyup(function(){
		var filter = $(this).val(),
            count = 0,
            filtro = $('.telefones ul li h3');
		filtro.each(function() {
            var parent = $(this).parent(),  
                length = $(this).text().length > 0;
            if(length && $(this).text().search(new RegExp(filter, 'i')) < 0) {
                parent.hide();
            } else {
                parent.removeAttr('style');
                count++;
            }
            
		});
	});

});$(document).ready(function(){

    /* ampliarurl */
    $('.relatoriocompleto a').click(function(){
        $(this).parent().toggleClass('sel');
        $('.listarelatorio').toggle();
    });
    
});$(document).ready(function(){

    /* imagens */
    if($(window).width() < 641){
        $('.conteudo.listarnoticias ul li a .infnot h2').dotdotdot();
    }

});/*! js-cookie v3.0.0-rc.1 | MIT */
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e=e||self,function(){var n=e.Cookies,r=e.Cookies=t();r.noConflict=function(){return e.Cookies=n,r}}())}(this,function(){"use strict";function e(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)e[r]=n[r]}return e}var t={read:function(e){return e.replace(/(%[\dA-F]{2})+/gi,decodeURIComponent)},write:function(e){return encodeURIComponent(e).replace(/%(2[346BF]|3[AC-F]|40|5[BDE]|60|7[BCD])/g,decodeURIComponent)}};return function n(r,o){function i(t,n,i){if("undefined"!=typeof document){"number"==typeof(i=e({},o,i)).expires&&(i.expires=new Date(Date.now()+864e5*i.expires)),i.expires&&(i.expires=i.expires.toUTCString()),t=encodeURIComponent(t).replace(/%(2[346B]|5E|60|7C)/g,decodeURIComponent).replace(/[()]/g,escape),n=r.write(n,t);var c="";for(var u in i)i[u]&&(c+="; "+u,!0!==i[u]&&(c+="="+i[u].split(";")[0]));return document.cookie=t+"="+n+c}}return Object.create({set:i,get:function(e){if("undefined"!=typeof document&&(!arguments.length||e)){for(var n=document.cookie?document.cookie.split("; "):[],o={},i=0;i<n.length;i++){var c=n[i].split("="),u=c.slice(1).join("=");'"'===u[0]&&(u=u.slice(1,-1));try{var f=t.read(c[0]);if(o[f]=r.read(u,f),e===f)break}catch(e){}}return e?o[e]:o}},remove:function(t,n){i(t,"",e({},n,{expires:-1}))},withAttributes:function(t){return n(this.converter,e({},this.attributes,t))},withConverter:function(t){return n(e({},this.converter,t),this.attributes)}},{attributes:{value:Object.freeze(o)},converter:{value:Object.freeze(r)}})}(t,{path:"/"})});
$(document).ready(function(){

    /* filtro */
    $('.filtro input[name=filtrar]').keyup(function(){
		var filter = $(this).val(),
            count = 0,
            filtro = $('.perguntasfrequentes ul li h3, .perguntasfrequentes ul li p');
		filtro.each(function() {
            var parent = $(this).closest('li').next(), 
                length = $(this).text().length > 0;
            if(length && $(this).text().search(new RegExp(filter, 'i')) < 0) {
                parent.hide();
            } else {
                parent.removeAttr('style');
                count++;
            }
            
		});
	});

});$(document).ready(function(){

    /* imagens */
    $(".imagens ul").lightGallery();

});$(document).ready(function(){

    /* campos */
    $('.pfpj input[type=radio]#pf').click(function(){
        $('.pf').show();
        $('.pj').hide();
        $('.pf input[type=text]:first-child').focus().val('');
        $('.pf input[type=text]').val('');
    });
    
    if($('input[type=radio]#pf').is(':checked')){
        $('.pf').show();
        $('.pj').hide();
    }
    
    $('.pfpj input[type=radio]#pj').click(function(){
        $('.pf').hide();
        $('.pj').show().val("");
        $('.pj input[type=text]').focus().val('');
    });
    
    if($('input[type=radio]#pj').is(':checked')){
        $('.pf').hide();
        $('.pj').show();
    }
    
//    $('#click').click(function(){
//        $('#ts').click();
//    });
    
    $('input[type=text], textarea').placeholder({ customClass: 'placeholder' });
    
    /* mask */
    $('input:text').setMask();
    $('input[data-mask]').each(function() {
          $(this).setMask($(this).data('mask'));
    });
    
});$(document).ready(function(){

    /* ampliarjanela */
    $('.ampliarjanela a').lightGallery({
        selector: 'this',
        counter: false,
        zoom: false,
        actualSize: false,
        getCaptionFromTitleOrAlt: false,
        hideControlOnEnd: true
    });
    
});