
function BxBlgEntry ()
{
	this._form = 'new_entry_form';
}


BxBlgEntry.prototype.del = function (id)
{
	if (!this._confirm()) return false;

	var h = function (r)
	{		
		var o = new BxXmlRequest('','','');			
		var ret = o.getRetNodeValue (r, 'ret');
		if ('1' == ret)
		{
			alert ('Entry deleted with its comments.');			
            $('sys_main_cont').innerHTML = 'Deleted Entry';
			return false;
		}

		alert ('Delete failed');
		return false;
	}	
	
	new BxXmlRequest (aBxConfig['urlRoot'] + "/blog/xml_delete/?id=" + id, h, true);
  
    return false;
}

BxBlgEntry.prototype.reportOne = function (id, type)
{
	if (!this._confirm()) return false;
		
    this.sendReport (id, type);
  
    return false;
}


BxBlgEntry.prototype.sendReport = function (ids, type)
{
	var $this = this;

	var h = function (r)
	{		
		var o = new BxXmlRequest('','','');			
		var ret = o.getRetNodeValue (r, 'ret');
		if ('1' == ret)
		{
			alert ('Thank you! Message(s) reported.');
			$this.reload ();
			return false;
		}

		alert ('Report error');
		return false;
	}	
	
	new BxXmlRequest (aBxConfig['urlRoot'] + "/blog/xml_report/" + ids + '/?type='+type, h, true);

	return false;
}

BxBlgEntry.prototype.send = function (sDefText)
{			
	var f = document.forms[this._form].elements;
	sText = f['entry_text'].value;
	if (sText && sText.length && sText != sDefText)	
		return true;
		
	return false;
}

       
BxBlgEntry.prototype.showReportWndOne = function (iId)
{	
	var w = new BxWnd (aBxConfig['urlRoot'] + 'mail/xml_report_one/?id='+iId, aBxConfig['urlModuleXsl'] + 'report_one_wnd.xsl');

	w.setSize(250,250);
	w.show ('Report');
	
	return false;
}

BxBlgEntry.prototype._confirm = function ()
{
	return window.confirm ('Are you sure?');
}

