Event.observe(window, 'load', init, false);

function init(){
    update_files();
}


function submitForm(frm)
{
    var d = document.createElement('DIV');
    d.innerHTML = '<iframe src="about:blank" height="1px" width="1px" id="ida" name="ida" onload="update_files();"></iframe>';
    d.style.visibility="hidden";
    document.body.appendChild(d);
    frm.target='ida';
    return true;
}

function update_files(){
    new Ajax.Updater('files_uploaded', 'files_uploaded', {method: 'post'});
}

function delete_box()
{
    var d = document.getElementById('ida');
    setTimeout( d.parentNode.removeChild(d), 3000 );
}

function start_check(name)
{
    /*           
             TODO:
             check compatibility with browsers other than firefox
             do fancy checking now screen
     */
    window.parent.select_tab(3);
    window.parent.check.update_check_results(name);   
};


function start_merge()
{
    //top.select_tab(4);
    window.parent.select_tab(4);
}

function get_kinetics(pos)
{
    window.parent.select_tab(2);    
    //top.sbmlfill.select_model( pos );
    // TOTO!!!!!!!!!!
    // this is pretty ugly ... find sth better
    setTimeout( 'window.parent.sbmlfill.select_model(' + pos + ')', 1000 );     
};

function annotate(name)
{
    var url='set_file_to_annotate?model_name='+name;
    new Ajax.Request(url, {method: 'get'} );
    window.parent.select_tab(4);
};


function sbmlcheck(name)
{
    var url='set_file_to_check?model_name='+name;
    new Ajax.Request(url, {method: 'get'} );
    window.parent.select_tab(3);
}

