Orphus = {
 
    processTypo: function(typo_id, type, n_row) {
        var rowToDel = $('typo_' + typo_id);
        rowToDel.className += " disabled";        
        Effect.Fade(rowToDel.id, { 
            duration: 0.2
        });

        Generic.htmlQuery(
            document.location.toString(),
            { 
                action:       "process",
                type:         type,
                typo_id:      typo_id,
                n_row:        n_row
            },
            function(js, text, html) {
                var container = rowToDel.parentNode;
                $('sidebar').innerHTML = js.sidebar;
                $A(html.getElementsByTagName('TR')).each(function(tr, i) {
                    if (!i) return; // skip header
                    container.appendChild(tr);
                });
            }
        )
    }
}



Generic = {

    /**
     * Evals all passed JS-scripts.
     */    
    runScripts: function(scripts) {
        if (!scripts) return false;
        for (var i = 0; i < scripts.length; i++) {
            var thisScript = scripts[i];   
            var text; 
            if (thisScript.src) {
                var newScript = document.createElement("script");
                newScript.type = thisScript.type;       
                newScript.language = thisScript.language;
                newScript.src = thisScript.src;             
                document.body.appendChild(newScript);   
            } else if (text = (thisScript.text || thisScript.innerHTML)) {
                var text = (""+text).replace(/^\s*<!\-\-/, '').replace(/\-\->\s*$/, '');
                eval(text);
            }
        }
    },
    
    
    /**
     * Performs AJAX query with HTMLresponce expected.
     * All JS-scripts are executed.
     */
    htmlQuery: function(url, data, callback) {
        JsHttpRequest.query(
            url,
            data,
            function(js, text) {
                var div = document.createElement('div');
                div.innerHTML = text;
                Generic.runScripts(div.getElementsByTagName('SCRIPT'));
                callback(js, text, div);
            }
        )
    }    
}


function init_ln(id)
{
	document.getElementById(id).onclick = function() {
		location = "/community/";
	}
}
