$(document).ready(function() {
	$('#inputBusca').focus(function() {
        $(this).addClass('focus');
    }).blur(function() {
        $val = $.trim($(this).val());
        if ($val == '') {
            $(this).removeClass('focus').val('');
        }
    });

    $("#flashHome").flash({ src: '/pt/swf/destaqueHome.swf', width: 672, height: 198, wmode: 'transparent', scale: 'noscale' }, { version: 8 });
    $("#flashAdvisory").flash({ src: '/pt/swf/flashAdvisory.swf', width: 640, height: 157, wmode: 'transparent', scale: 'noscale' }, { version: 8 });
    $("#flashCapital").flash({ src: '/pt/swf/flashCapital.swf', width: 640, height: 157, wmode: 'transparent', scale: 'noscale' }, { version: 8 });
    $("#flashInfra").flash({ src: '/pt/swf/flashInfra.swf', width: 640, height: 157, wmode: 'transparent', scale: 'noscale' }, { version: 8 });
    $("#flashPrivate").flash({ src: '/pt/swf/flashPrivate.swf', width: 640, height: 157, wmode: 'transparent', scale: 'noscale' }, { version: 8 });
    $("#flashReal").flash({ src: '/pt/swf/flashReal.swf', width: 640, height: 157, wmode: 'transparent', scale: 'noscale' }, { version: 8 });

    $('input#inputCurriculo').stylefile({ image: '/pt/img/bgInputFile.gif', imagewidth: 71, imageheight: 18, width: 200 });
    $('#boxCenter').jScrollPane({ scrollbarWidth: 6, scrollbarMargin: 32, showArrows: true });
    $('ul#navBusca').jcarousel({ scroll: 2 });

    $('div.accordion h4').click(function() {
        $('div.accordion h4').removeClass('hover').parent().find('div.accor').slideUp('slow');
        if ($(this).next('div.accor').is(':visible')) {
            $(this).removeClass('hover');
            $(this).next('div.accor').slideUp('slow');
        } else {
            $(this).addClass('hover');
            $(this).next('div.accor').slideDown('slow');
        }
        $scroll = setTimeout("$('#boxCenter').jScrollPane({ scrollbarWidth: 6, scrollbarMargin: 32, showArrows: true })", 800);
    });

    $('#formLogin').validate({ errorContainer: $('.msgError') });

    $('#formJornalistas').validate({ errorContainer: $('.msgError'),
        submitHandler: function() {
            $.ajax({
                data: $('#formJornalistas').serialize(),
                dataType: 'json',
                url: '/CadastroJornalista/Save.ashx',
                success: function(json) {
                    if (json.msg == "OK") {
                        tb_show('', '/pt/tb/tbConfirmaCad.aspx?keepThis=true&TB_iframe=true&width=401&height=162', false);
                        $('#formJornalistas input.form').val('');
                    }
                }
            });
        }
    });
    $('#formNewsletter').validate({ errorContainer: $('.msgError'),
        submitHandler: function() {
            $.ajax({
                data: $('#formNewsletter').serialize(),
                dataType: 'json',
                url: '/Newsletter/Save.ashx',
                success: function(json) {
                    if (json.msg == "OK") {
                        tb_show('', '/pt/tb/tbConfirmaNews.aspx?keepThis=true&TB_iframe=true&width=401&height=162', false);
                        $('#formNewsletter input.form').val('');
                    }
                }
            });
        }
    });
    $('#formTrabalhe').validate({ errorContainer: $('.msgError'),
        submitHandler: function() {
            $.ajax({
                data: $('#formTrabalhe').serialize(),
                dataType: "json",
                url: '/TrabalheConosco/Save.ashx',
                success: function(json) {
                    if (json.msg == "OK") {
                        tb_show('', '/pt/tb/tbConfirmaTrabalhe.aspx?keepThis=true&TB_iframe=true&width=401&height=162', false);
                        $('#formTrabalhe input.form').val('');
                    }
                }
            });
        }
    });
    $('#formContato').validate({ errorContainer: $('.msgError'),
        submitHandler: function() {
            $.ajax({
                data: $('#formContato').serialize(),
                dataType: "json",
                url: '/Contato/Save.ashx',
                success: function(json) {
                    if (json.msg == "OK") {
                        tb_show('', '/pt/tb/tbConfirmaContato.aspx?keepThis=true&TB_iframe=true&width=401&height=162', false);
                        $('#formContato input.form').val('');
                    }
                }
            });
        }
    });
    $("#inputCurriculo").change(function() {
        $.ajaxFileUpload({
            url: '/TrabalheConosco/GravarArquivo.ashx',
            secureuri: false,
            fileElementId: 'inputCurriculo',
            dataType: 'json',
            success: function(json) {
                if (json.msg == 'OK') {
                    $("#hiddenCurriculo").html("Upload conclu&iacute;do com sucesso!<input type=hidden name=TrabalheConosco.Curriculo value=" + json.arquivo + " />");
                } else {
                    $("#hiddenCurriculo").html("Erro no Upload! " + json.msg);
                }
            }
        });
    });

	$("ul.listaAnos li a").click(function() {
        $tab = $(this).attr("href").split("#")[1];
        $("ul.listaAnos li a").removeClass("hover");
        $(this).addClass("hover");
        $(".tab").hide();
        $("#" + $tab).fadeIn();
		$(".scrollHistorico").jScrollPane({ scrollbarWidth: 6, scrollbarMargin: 32, showArrows: true });
		return false;
    });
    $("ul.listaAnos li a.hover").trigger("click");


	$("input.data").mask("99/99/9999");
    $("input.tel").mask("99-99999999");
    $("input.cep").mask("99999-999");
    $("input.cpf").mask("999.999.999-99");
	
	
	$("#ano1988").show();
});

var posMarcador = new Array();
