﻿// JScript File
var topicControlsWait;
window.onload = function()
{
    //
    setSendButton();

}

function updateStats(topic_id,okHref){
    $Ajax(basepath + "controllers/Forums/Topics.aspx?method=updateStats", 
            {metodo: $metodo.POST,            
            parametros: {"topic_id":topic_id},
            onfinish: function(result){
                window.location = okHref;
            },
            cache: false});

}

function setSendButton()
{
    var EsperandoAlWindow;
    if($("txtTopicPost") != null)
    {
        $("txtTopicPost").onkeypress = function(){$("btnNewTopic").className = "input_botons"; $("btnNewTopic").disabled = false;};
        if(EsperandoAlWindow != null)
        {
            clearTimeout(EsperandoAlWindow);
        }
    }
    else
    {
        EsperandoAlWindow = setTimeout(setSendButton, 500);
    }
}

function loginTo()
{  
    Effect.Fade('divControlsContainer', { duration: 0.5 });
    showAddNewTopic();    
}

function showAddNewTopic()
{
    //----->
    if($('divControlsContainer').style.display == "none")
    {
        //-----> 
        __doPostBack('linkLogin','');
        Effect.Appear('divControlsContainer', { duration: 2.0 });        
    }
    else
    {
        topicControlsWait = setTimeout(showAddNewTopic, 1000);
    }
}

function goToNewTopic()
{
    //Llama a la funcion que está en SendMessage.js
    SendNewTopic();
} 

//Creo los Tips
function showTipAbuse(id)
{
    Tip('Let us know if you believe <br />this content is not appropiate', STICKY, false,FADEIN, 500,CLICKCLOSE, false, SHADOW, true, TITLE, 'Report Abuse', PADDING, 1);
}

function goToProfile(user, this_href){
    if((user_id > 0) && (user != 'anonymouse')){ window.location = this_href; }
    else{return false;}
}

var SendNewTopicResponseWait;
//----->
function TopicResponse()
{
    Effect.BlindUp('divNewTopicResponse', { duration: 0.5 });
    clearTimeout(SendNewTopicResponseWait);
    $("btnNewTopic").className = "input_botons_off";
    $("btnNewTopic").disabled = true; 
}