/*--------------------------------------------\\
||  D22-Shoutbox :: JavaScript Library        ||
||  Written By:  Dean                         ||
||  Website:  http://www.dscripting.com       ||
||  Date:  December 3, 2006                   ||
||  Updated:  January 6, 2007                 ||
||  Copyright (c) 2007 - All Rights Reserved  ||
\\--------------------------------------------*/

var shoutbox_loaded = false;
function shoutbox()
{
	this.base_url = ipb_var_base_url+'autocom=shoutbox&';

	this.members_refresh  = 10;
	this.shouts_refresh   = 10;
	this.editor_height    = '125px';
	this.history_size     = 10;
	this.encode_num       = 5;
	this.flood_limit      = 0;
	this.bypass_flood     = 0;
	this.total_shouts     = 0;
	this._refreshes       = 0;
	this._shout_skips     = 0;
	this.inactive_timeout = 10;

	this.ajax_objs     = new Array();
	this.objs          = new Array();
	this.errors        = new Array();
	this.langs         = new Array();
	this.shout_history = new Array();
	this.shout_data    = new Array();

	this.month_days = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
	this.keys       = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';

	this.global_on     = false;
	this.enable_cmds   = true;
	this.skip_fade     = false;
	this.debug         = false;
	this.debug_obj     = null;
	this.shout_obj     = null;
	this._scrolled     = false;
	this.loaded        = false;
	this.mod_loading   = false;
	this.mod_in_action = false;
	this.moderator     = false;
	this._moderator    = false;
	this.copyrighted   = false;
	this._inactive     = false;
	this.iprompt_lded  = false;
	this.my_last_shout = null;
	this.popup_open    = false;
	this.view_archive  = true;

	this.mod_command     = '';
	this.mod_shout_id    = 0;
	this.this_load_time  = 0;
	this.shout_load_time = -1;
	this.force_update    = 0;

	this.time_second = 1000;
	this.time_minute = 60*this.time_second;
	this.time_hour   = 60*this.time_minute;
	this.time_day    = 24*this.time_hour;

	this.temp_shout = '';

	this.events_load_max_tries = 10;
	this.events_load_tries     = 0;
	this.events_loaded         = false;
	this.events_rte_loaded     = false;
}

shoutbox.prototype.debug_it = function(m)
{
	if (shoutbox.debug)
	{
		if (shoutbox.global_on)
		{
			alert(m);
		}
		else
		{
			try
			{
				shoutbox.debug_obj.innerHTML += m+'<br />';
			}

			catch(e){}
		}
	}
}

shoutbox.prototype.submit_shout = function()
{
	if (!shoutbox_loaded)
	{
		return false;
	}

	if (this.blur)
	{
		this.blur();
	}

	if (!shoutbox.global_on)
	{
		shoutbox.editor_rte = IPS_editor[shoutbox.editor_id].is_rte;
	}

	var p = new Array();
	var s = shoutbox.get_shouts_ids();

	if (!s.length)
	{
		s = new Array();
	}

	p['autocom']  = 'shoutbox';
	p['code']     = 'shout';
	p['md5check'] = ipb_md5_check;
	p['shout']    = shoutbox.get_shout();
	p['ajaxkey']  = 'submit-shout';
	p['ids']      = (s != '' && s.length > 0) ? s.join(',') : '';
	p['global']   = (shoutbox.global_on) ? 1 : 0;
	p['time']     = shoutbox.get_timestamp();

	//alert(p['shout']);
	if (p['shout'] == '')
	{
		shoutbox.shout_error(shoutbox.errors['blank_shout']);
		return;
	}

	if (p['shout'].length * 1024 > shoutbox.max_length)
	{
		shoutbox.shout_error(sh
