﻿function init(evt)
{    
}
Initialize.add(init);
//---------------------------

function sendMail(_this)
{
    var f = getElementFather(_this, "form");
    if(isFieldsValid(f))
    {
        if(dialog("Enviar email agora?"))
        {            
            "status_sendmail".setValue("Aguarde, enviando e-mail...");  
            StandByButton(_this);
            RemoteObject
            (
                "handlers/sendMail.ashx",
                getValuesJson(f),
                function(data)
                {
                    StandByButton(_this);
                    "status_sendmail".setValue(data.html);                
                },
                true
            ); 
        }      
    }
}

//---------------------------------------------------------------

function closeContent()
{
    $("#panel_content").fadeOut("slow");
}

//---------------------------------------

function getChannel(n)
{
    var pc = ID("panel_content");
    if(pc.style.display!="block") $(pc).fadeIn("slow");

    ID("content").innerHTML = "<div class='info-a'>Aguarde, carregando...</div>";
    ID("content").style.backgroundImage = "url(imgs/loader.gif)"; 
    
    RemoteObject
    (
        "handlers/getChannel.ashx",
        { channel:n },
        function(data)
        {
            ID("content").innerHTML = data.html; 
            ID("content").style.backgroundImage = "none"; 
            validJavaScript("content");             
        },
        true
    ); 
        
}

//---------------------------------------

function getNews(type, id)
{
    ID("content").innerHTML = "<div class='info-a'>Aguarde, carregando notícia...</div>";
    ID("content").style.backgroundImage = "url(imgs/loader.gif)"; 
    
    RemoteObject
    (
        "handlers/getNews.ashx",
        { type:type, id:id },
        function(data)
        {
            ID("content").innerHTML = data.html; 
            ID("content").style.backgroundImage = "none";  
            validJavaScript("content");            
        },
        true
    ); 
}

//---------------------------------------------------------------
