// Place your application-specific JavaScript functions and classes here
// This file is automatically included by javascript_include_tag :defaults

function MyBrowseServer() {
    window.open("/javascripts/fckeditor/editor/filemanager/browser/default/browser.html?Type=Image&Connector=/fckeditor/command");
} 

function ToArray(arr) {
    if (arr.length) return arr;
    return new Array(arr);
}

function center_it(obj) {
    obj.setStyle({left : (document.body.clientWidth-obj.getWidth())/2 + 'px'})
    var offset = 0
    obj.setStyle({top : (f_scrollTop() + offset) + 'px'})
}

function f_scrollTop() {
    return f_filterResults (
        window.pageYOffset ? window.pageYOffset : 0,
        document.documentElement ? document.documentElement.scrollTop : 0,
        document.body ? document.body.scrollTop : 0
    );
}
function f_filterResults(n_win, n_docel, n_body) {
    var n_result = n_win ? n_win : 0;
    if (n_docel && (!n_result || (n_result > n_docel)))
        n_result = n_docel;
    return n_body && (!n_result || (n_result > n_body)) ? n_body : n_result;
}
