// JavaScript Document

jQuery.fn.center = function () {
    this.css("position", "fixed");
    this.css("top", ($(window).height() - this.height()) / 2 + "px");
    this.css("left", ($(window).width() - this.width()) / 2 + "px");
    return this;
}

//se tempo negativo nunca se fecha sozinha
function cria_mensagem(title, html_text, time) {
    var msg = "<div id='mensagem_box' style='display: none; position: absolute;' ><div id='msg_close_image'><img src='images/close.png' width='38' height='38' /></div>";
    msg += "<div class='msg_texto_titulo'>" + title + "</div><div class='msg_texto_descricao'>" + html_text + "</div>";

    $("#mensagem_box").jqmHide();
    $("#mensagem_box").remove();
    
    
    $("body").append(msg);

    $("#mensagem_box").show();

    $("#mensagem_box").jqm({
        modal: true
    });

    $("#mensagem_box").jqmShow();

    $("#msg_close_image").click(function () {
        $("#mensagem_box").jqmHide();
        $("#mensagem_box").remove();
    });

    if (time > 0) {
        window.setTimeout(function () {
            $("#mensagem_box").jqmHide();
            $("#mensagem_box").remove();
        }, time*1000);
    }

    $("#mensagem_box").center();
}

//se tempo negativo nunca se fecha sozinha
function cria_mensagem_normas(title, html_text)
{
    var msg = "<div id='aniversario_box' style='display: none; position: absolute;' ><div id='msg_close_image'><img src='images/close.png' width='38' height='38' /></div>";
    msg += "<div class='msg_texto_titulo'>" + title + "</div><div class='msg_texto_descricao'>" + html_text + "</div>";

    $("#aniversario_box").remove();
    $("body").append(msg);

    $("#aniversario_box").show();

    $("#aniversario_box").jqm({
        modal: true
    });

    $("#aniversario_box").jqmShow();

    $("#msg_close_image").click(function () {
        $("#aniversario_box").jqmHide();
        $("#aniversario_box").remove();
    });

    $("#aniversario_box").center();
}


function cria_mensagemAniversario(nome)
{
    var msg = "<div id='aniversario_box' style='position: absolute;'><div id='msg_close_image_ani'><img src='images/close.png' width='38' height='38' /></div>";
    msg += "<div id='aniversario_swf'></div></div>";

    $("#aniversario_box").remove();
    $("body").append(msg);
		
    var so = new SWFObject("parabens.swf", "parabens", "850", "500", "8", "#869ca7");
    so.addVariable("wmode", "transparent");
    so.addVariable("allowScriptAccess", "sameDomain");
    so.addVariable("nome", nome);
    so.addParam("wmode", "transparent");
    so.write("aniversario_swf");


    $("#aniversario_box").jqm({
        modal: true
    });

    $("#msg_close_image_ani").click(function ()
    {
        $("#aniversario_box").jqmHide();
        $("#aniversario_box").remove();
    });

    $("#aniversario_box").center();
	$('#aniversario_box').css("visibility", "visible");
	    
	$("#aniversario_box").jqmShow();
}

function cria_frame_video()
{
    var msg = "<div id='video_box' style='position: absolute;'>\n\
                <div id='msg_close_image_ani'><img src='images/close.png' width='38' height='38' /></div>";
    msg += "<div id='video_flv'>\n\
            <object classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' width='850' height='478' id='FLVPlayer'>\n\
            <param name='movie' value='FLVPlayer_Progressive.swf' /><param name='quality' value='high' />\n\
            <param name='wmode' value='opaque' /><param name='scale' value='noscale' />\n\
            <param name='salign' value='lt' />\n\
            <param name='FlashVars' value='&amp;MM_ComponentVersion=1&amp;skinName=Corona_Skin_3&amp;streamName=brinka&amp;autoPlay=true&amp;autoRewind=true' />\n\
            <param name='swfversion' value='8,0,0,0' />\n\
            <!-- This param tag prompts users with Flash Player 6.0 r65 and higher to download the latest version of Flash Player. Delete it if you don?t want users to see the prompt. -->\n\
            <param name='expressinstall' value='Scripts/expressInstall.swf' />\n\
            <!-- Next object tag is for non-IE browsers. So hide it from IE using IECC. -->\n\
            <!--[if !IE]>-->\n\
            <object type='application/x-shockwave-flash' data='FLVPlayer_Progressive.swf' width='850' height='478'>\n\
            <!--<![endif]-->\n\
            <param name='quality' value='high' /><param name='wmode' value='opaque' />\n\
            <param name='scale' value='noscale' /><param name='salign' value='lt' />\n\
            <param name='FlashVars' value='&amp;MM_ComponentVersion=1&amp;skinName=Corona_Skin_3&amp;streamName=brinka&amp;autoPlay=true&amp;autoRewind=true' />\n\
            <param name='swfversion' value='8,0,0,0' /><param name='expressinstall' value='Scripts/expressInstall.swf' />\n\
            <!-- The browser displays the following alternative content for users with Flash Player 6.0 and older. -->\n\
            <div><h4>Content on this page requires a newer version of Adobe Flash Player.</h4><p>\n\
            <a href='http://www.adobe.com/go/getflashplayer'>\n\
            <img src='http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif' alt='Get Adobe Flash player' /></a></p></div>\n\
            <!--[if !IE]>--></object><!--<![endif]--></object>\n\
            </div></div>";

    $("#video_box").remove();
    $("body").append(msg);

    $("#video_box").jqm({
        modal: true
    });

    $("#msg_close_image_ani").click(function ()
    {
        $("#video_box").jqmHide();
        $("#video_box").remove();
    });

    $("#video_box").center();
    $('#video_box').css("visibility", "visible");
    $("#video_box").jqmShow();
}
