﻿$(function () {
    $(".Telefone").mask("(99)9999-9999");

    $("#lnkHome").click(function () {
        showModalPopUp("#dialog");
        return false;
    });

    $("#txtBusca").keypress(function (e) {
        if (e.keyCode == 13) {
            var term = this.value;
            $(window.location).attr('href', '/busca.aspx?searchterm=' + term);
            return false;
        }
    });

    $(".ShowBanner").click(function () {
        var page = $("#Banners").triggerHandler("currentPage");

        if (page == 9999999) {
            $(window.location).attr('href', '/comunicados');
        }
    });
})

$("#Banners").carouFredSel({
    auto: true,
    curcular: true,
    infinite: true,
    auto: {
        fx: "crossfade",
        play: true,
        pauseDuration: null,
        duration: 800
    },
    prev: {
        button: ".ArrLeft",
        key: "left"
    },
    next: {
        button: ".ArrRight",
        key: "right"
    },
    scroll: {
        duration: 800,
        fx: "crossfade"
    }
});


//
// Exibir uma div como modal popup
//
function showModalPopUp(id) {
    var maskHeight = $(document).height();
    var maskWidth = $(window).width();

    $('#mask').css({ 'width': maskWidth, 'height': maskHeight });

    //$('#mask').fadeIn(1000);
    $('#mask').fadeTo(500, 0.3);

    var winH = $(window).height();
    var winW = $(window).width();

    $(id).css('top', winH / 2 - $(id).height() / 2);
    $(id).css('left', winW / 2 - $(id).width() / 2);

    $(id).fadeIn(500);

    $('.btClose2,.btClose, #mask').click(function (e) {
        e.preventDefault();

        $('#mask').hide();
        $(id).hide();
    });
}


function Hide() {
    document.getElementById("flashContent").style.visibility = 'hidden';
}

