stp = {
    author : {
        init : function() {
            $(this).hover(stp.utils.hoverOver, stp.utils.hoverOut).click(stp.utils.gotoInnerLink);
        }
    },
    utils : {
        hoverOver : function() {
            $(this).addClass('hover');
        },
        hoverOut : function() {
            $(this).removeClass('hover');
        },
        gotoInnerLink : function() {
            document.location = $('a', this).attr('href');
        },
        selectAll : function() {
            $('input[type=checkbox]').attr('checked', true);
        },
        selectNone : function() {
            $('input[type=checkbox]').attr('checked', false);
        }
    },
    init : function() {
        $('.authorlist div').each(stp.author.init);
        $('.comment-parent').click(stp.utils.gotoInnerLink);
        $('div.latest, div.thread-listing-row').click(stp.utils.gotoInnerLink);
        $('ul.forums li').click(stp.utils.gotoInnerLink); 
        $('ul.search-result li').click(stp.utils.gotoInnerLink);
        $('.forum-thread-list tr:odd').addClass('odd');
        $('.profile tr:odd').addClass('odd');
        $('div.like div').html('&nbsp;');
        $('form.notifications').prepend('<div><a href="javascript:stp.utils.selectAll();" class="button">Select All</a> <a href="javascript:stp.utils.selectNone()" class="button">Select None</a>');
    }
}
function finishedLoading() {
    $("#loading").hide();
}
function initMCE() {
    tinyMCE.init({
        mode : "none",
		theme: "advanced",
        theme_advanced_buttons1:"bold,italic,bullist,numlist,indent,outdent,hr,code,judtifyleft,justifyright,justifycenter,anchor,strikethrough,link,unlink,removeFormat,sub,sup,xImage",
		theme_advanced_buttons2: "cut,copy,paste,pastetext,pasteword,cleanup,formatselect,emotions,tablecontrols",
		theme_advanced_buttons3: "",
        theme_advanced_toolbar_location : "top",
		plugins : 'paste,table,emotions',
		paste_remove_styles : true,
		paste_strip_class_attributes : "all",
		paste_remove_spans : true,
		content_css: "/xca/basic2.css,/css/basic.css",
		valid_elements: "h1,h2,h3,h4,h5,h6,a[href|target],ul,li,ol,strong,b,br,p[style],em,div[style],pre[style],img[src|align|style],table[cellspacing|cellpadding],tr,td[rowspan|colspan]",
		theme_advanced_blockformats: "p,h1,h2,h3,blockquote",
		theme_advanced_source_editor_height: 400,
        
        convert_urls:false,
        setup : function(ed) { 
            ed.onSaveContent.add(function(ed, o) {
                o.content = o.content.replace(/<p>&nbsp;<\/p>/g, '');
            });
            ed.addButton('xImage', {
                title : 'Insert Image',
                image : '/xca/icns/image.gif',
                onclick : function() { 
                    inlineMediaManager(ed) 
                }
            });

        },
        file_browser_callback : 'inlineMediaManager'
    });
    markupChanged();
}
$(document).ready(stp.init);