function get_title()
    {
        if ('document' in global_scope) {
            //Don't use document.title to work around an Opera/Presto bug in XHTML documents
            var title = document.getElementsByTagName("title")[0];
            if (title && title.firstChild && title.firstChild.data) {
                return title.firstChild.data;
            }
        }
        if ('META_TITLE' in global_scope && META_TITLE) {
            return META_TITLE;
        }
        if ('location' in global_scope && 'pathname' in location) {
            var filename = location.pathname.substring(location.pathname.lastIndexOf('/') + 1);
            return filename.substring(0, filename.indexOf('.'));
        }
        return "Untitled";
    }
Returns the <title> or filename or "Untitled"