polishTypes = { 'text' : 'tekst', 'question' : 'pytanie', 'event' : 'zdarzenie', 'note' : 'notatka' };

function showPostForm(type){
    hideAllPostForms();
    disableAllPostForms();
    enableSelectedPostForm(type);
    setActiveTab(type);
    $("post_form_" + type).show();
}


function setActiveTab(type){
    $$("li.active").invoke('removeClassName', 'active');
    $$("li.btn_" + polishTypes[type]).invoke('addClassName', 'active');
}


function hideAllPostForms()
{
    $$('div.post_form').invoke('hide');   
}

function disableAllPostForms(){
    $$('div.post_form').each(function(t){ t.select('input, textarea').invoke('disable')});   
}

function enableSelectedPostForm(type){
    $('post_form_'+ type).select('input, textarea').invoke('enable');   
}


function showFirstPostFormOnly(){
    if(post_form_q = $('post_form_question')) post_form_q.hide();
    if(post_form_e = $('post_form_event')) post_form_e.hide();
    if(post_form_n = $('post_form_note')) post_form_n.hide();
}


function initialize(){
    showFirstPostFormOnly();
}


document.observe('dom:loaded',initialize);
