﻿$(function () {
    $('#slides').slides({
        preload: true,
        preloadImage: '/imagens/Destaques/loading.gif',
        play: 6000,
        pause: 1500,
        hoverPause: true,
        animationStart: function () {
            $('.caption').animate({
                bottom: -400
            }, 100);
        },
        animationComplete: function (current) {
            $('.caption').animate({
                bottom: 0
            }, 200);
            if (window.console && console.log) {
                console.log(current);
            };
        }
    });
});

jQuery.fn.center = function () {
    this.css("position", "absolute");
    this.css("top", ($(window).height() - this.height()) / 2 + $(window).scrollTop() + "px");
    this.css("left", ($(window).width() - this.width()) / 2 + $(window).scrollLeft() + "px");
    return this;
}

$(document).ready(function () {
    $('.loginBtn').click(function () {
        overlay();
        $('#divLoginBorda').fadeIn('fast', function () {
        });
        $('#divLogin').fadeIn('fast', function () {
        });
        $('#divLoginBorda').center();
        $('#divLogin').center();
        $('#txtUsuario').focus();
    });
    $('#imgFecharLogin').click(function () {
        overlay();
        $('#divLoginBorda').fadeOut('fast', function () {
        });
        $('#divLogin').fadeOut('fast', function () {
        });
    });
    $('#imgFecharVideo').click(function () {
        overlay();
        document.getElementById('frmPlayerVideo').src = "";
        document.getElementById('frmLikeFace').src = "";
        $('#divPlayerVideo').fadeOut('fast', function () {
        });
    });

    //$('.tTip').betterTooltip();
});

function overlay() {
    var winH = $('body').height();
    $('#overlay').css('height', winH);

    el = document.getElementById("overlay");
    el.style.visibility = (el.style.visibility == "visible") ? "hidden" : "visible";
}
function abrirVideo(videoembed, videolink, titulo, descricao) {
    document.getElementById('frmPlayerVideo').src = videoembed;
    document.getElementById('frmLikeFace').src = "http://www.facebook.com/plugins/like.php?href=" + videolink + "&amp;layout=standard&amp;show_faces=true&amp;width=450&amp;action=like&amp;font=verdana&amp;colorscheme=dark&amp;height=80";
    document.getElementById('playerTitulo').innerHTML = titulo + ' - ' + descricao;
    overlay();
    $('#divPlayerVideo').center();
    $('#divPlayerVideo').fadeIn('fast', function () {

    });

}
