$(document).ready(function(){
    $('.En').click(function(){
        $('body').translate('en',{
            toggle:true, 
            not:'.notranslate'
        });
        $.getJSON('homes/idioma/2');
    });
    $('.Br').click(function(){
        $('body').translate('pt-br',{
            toggle:true, 
            not:'.notranslate'
        });
        $.getJSON('homes/idioma/1');
    });
    $('.Es').click(function(){
        $('body').translate('es',{
            toggle:true, 
            not:'.notranslate'
        });
        $.getJSON('homes/idioma/3');
    });
    $.getJSON('homes/idioma',function(data){
        if(data==1){
            $('.Br').click();
        }
        if(data==2){
            $('.En').click();
        }
        if(data==3){
            $('.Es').click();
        }
    });
    $.datepicker.setDefaults({
        dateFormat: 'dd/mm/yy',
        dayNames: ['Domingo','Segunda','Terça','Quarta','Quinta','Sexta','Sábado','Domingo'],
        dayNamesMin: ['D','S','T','Q','Q','S','S','D'],
        dayNamesShort: ['Dom','Seg','Ter','Qua','Qui','Sex','Sáb','Dom'],
        monthNames: ['Janeiro','Fevereiro','Março','Abril','Maio','Junho','Julho','Agosto','Setembro', 'Outubro','Novembro','Dezembro'],
        monthNamesShort: ['Jan','Fev','Mar','Abr','Mai','Jun','Jul','Ago','Set', 'Out','Nov','Dez'],
        nextText: 'Próximo',
        prevText: 'Anterior'
    });
    $('.Datepicker').datepicker();
    $('.Carousel').jcarousel();
    $('.Apagar').click(function(){
        if(this.value == this.defaultValue){
            this.value = '';
        }
    });
    $('.Apagar').blur(function(){
        if (this.value == ''){
            this.value = this.defaultValue;
        }
    }); 
    $('.Slide').cycle({
        fx:'fade',
        speed:'1000',
        timeout:'6000'
    });
    $('.Abas li').click(function(){
        $('.Abas li').removeClass('Atual');
        $(this).addClass('Atual');
        $('.Galeria').removeClass('Atual');
        $('.gal'+$(this).attr('target')).addClass('Atual');
    });
    $('.Tel').mask('(99) 9999-9999');
    $('.Data').mask('99/99/9999');
    $('.Cpf').mask('999.999.999-99');
    $('.Cep').mask('99.999-999');
    $('.FormularioTrabalhe').hide();
    $('.BtFormularioContato').click(function(){
        $('.FormularioTrabalhe').hide();
        $('.FormularioContato').show();
    });
    $('.BtFormularioTrabalhe').click(function(){
        $('.FormularioContato').hide();
        $('.FormularioTrabalhe').show();
    });
    
    $("a.group").fancybox({
        'transitionIn'	:	'elastic',
        'transitionOut'	:	'elastic',
        'speedIn'		:	400, 
        'speedOut'		:	200, 
        'overlayShow'	:	false,
        'hideOnContentClick': true
    });
    
    $(".BoxDepoimento").fancybox({
        'href'          :       'homes/depoimento',
        'type'          :       'iframe',
        'transitionIn'	:	'elastic',
        'transitionOut'	:	'elastic',
        'speedIn'	:	400, 
        'speedOut'	:	200,
        'width':280,
        'height':410,
        'overlayShow'	:	false
    });
    $("a.iframe").fancybox({
        'transitionIn'	:	'elastic',
        'transitionOut'	:	'elastic',
        'speedIn'	:	400, 
        'speedOut'	:	200,
        'width':'100%',
        'height':900,
        'overlayShow'	:	false
    });
});


WebFontConfig = {
    google: {
        families: [ 'Open+Sans+Condensed:300:latin' ]
    }
};
(function() {
    var wf = document.createElement('script');
    wf.src = ('https:' == document.location.protocol ? 'https' : 'http') +
    '://ajax.googleapis.com/ajax/libs/webfont/1/webfont.js';
    wf.type = 'text/javascript';
    wf.async = 'true';
    var s = document.getElementsByTagName('script')[0];
    s.parentNode.insertBefore(wf, s);
})();


