function HTMLSermonFileWriter(astrArray)
{
	this.astrArray = astrArray;
}

HTMLSermonFileWriter.prototype.Write = function(strContent)
{
	this.astrArray.push(strContent);
};


// Paragraph
HTMLSermonFileWriter.prototype.StartParagraph = function(strStyle)
{
	this.Write("<p class='Wiki" + strStyle + "Paragraph'>");
};

HTMLSermonFileWriter.prototype.EndParagraph = function()
{
	this.Write("</p>");
};

// Blockquote
HTMLSermonFileWriter.prototype.StartBlockquote = function()
{
	this.Write("<blockquote>");
};

HTMLSermonFileWriter.prototype.EndBlockquote = function()
{
	this.Write("</blockquote>");
};

// Heading
HTMLSermonFileWriter.prototype.StartHeading = function(nLevel)
{
	this.Write("<h" + nLevel + " class='WikiHeading" + nLevel + "'>");
};

HTMLSermonFileWriter.prototype.EndHeading = function(nLevel)
{
	this.Write("</h" + nLevel + ">");
};

// Text
HTMLSermonFileWriter.prototype.WriteText = function(strText)
{
	if (strText && strText.length > 0)
		this.Write(Global.HtmlEncode(strText));
};

// Line break
HTMLSermonFileWriter.prototype.WriteLineBreak = function()
{
	this.Write("<br />");
};

// Horizontal Rule
HTMLSermonFileWriter.prototype.WriteHorizontalRule = function()
{
	this.Write("<hr />");
};

// Bold
HTMLSermonFileWriter.prototype.StartBold = function()
{
	this.Write("<strong>");
};

HTMLSermonFileWriter.prototype.EndBold = function()
{
	this.Write("</strong>");
};

// Italics
HTMLSermonFileWriter.prototype.StartItalics = function()
{
	this.Write("<em>");
};

HTMLSermonFileWriter.prototype.EndItalics = function()
{
	this.Write("</em>");
};

// Segment
HTMLSermonFileWriter.prototype.StartSegment = function(strLang, strStyle)
{
	this.Write("<span xml:lang='" + strLang + "' class='Wiki" + strStyle + "Segment'>");
};

HTMLSermonFileWriter.prototype.EndSegment = function()
{
	this.Write("</span>");
};

// Unordered List
HTMLSermonFileWriter.prototype.StartUnorderedList = function()
{
	this.Write("<ul class='WikiUnorderedList'>");
};

HTMLSermonFileWriter.prototype.EndUnorderedList = function()
{
	this.Write("</ul>");
};

// Ordered List
HTMLSermonFileWriter.prototype.StartOrderedList = function()
{
	this.Write("<ol class='WikiOrderedList'>");
};

HTMLSermonFileWriter.prototype.EndOrderedList = function()
{
	this.Write("</ol>");
};

// List Item
HTMLSermonFileWriter.prototype.StartListItem = function()
{
	this.Write("<li class='WikiListItem'>");
};

HTMLSermonFileWriter.prototype.EndListItem = function()
{
	this.Write("</li>");
};

// Link
HTMLSermonFileWriter.prototype.WriteLink = function(strSurfaceText, strDataTypeReference, strDataType)
{
	if (!strSurfaceText || strSurfaceText.length == 0)
		strSurfaceText = strDataTypeReference;

	if (strDataTypeReference.substr(0, 5) == 'cmd.=')
	{
		this.Write("<a href='libronixdls:" + encodeURIComponent(strDataTypeReference) + "'>");
		this.Write(Global.HtmlEncode(strSurfaceText));
		this.Write("</a>");
	}
	else if (strDataType && strDataType.toLowerCase() == 'bible')
	{
		this.Write("<cite class='bibleref' title='" + Global.HtmlEncode(strDataTypeReference) + "'>");
		this.WriteText(Global.HtmlEncode(strSurfaceText));
		this.Write("</cite>");
	}
	else if (strDataType != null && strDataType != "" && /http/.test(strDataType) && strDataTypeReference)
	{
		var url = (strDataType != null && strDataType != "" && /http/.test(strDataType)) ? (strDataType + ":") : "";
		url += /<>/.test(strDataTypeReference) ? encodeURIComponent(strDataTypeReference) : strDataTypeReference;
		this.Write("<a href='" + url + "'>");
		this.Write(Global.HtmlEncode(strSurfaceText));
		this.Write("</a>");
	}
	else
	{
		this.Write(strSurfaceText);
	}
};

// Table
HTMLSermonFileWriter.prototype.StartTable = function()
{
	this.Write("<table class='SermonFileWikiTable'>");
};

HTMLSermonFileWriter.prototype.EndTable = function()
{
	this.Write("</table>");
};

// Table Row
HTMLSermonFileWriter.prototype.StartTableRow = function()
{
	this.Write("<tr>");
};

HTMLSermonFileWriter.prototype.EndTableRow = function()
{
	this.Write("</tr>");
};

// Table Cell
HTMLSermonFileWriter.prototype.StartTableCell = function()
{
	this.Write("<td>");
};

HTMLSermonFileWriter.prototype.EndTableCell = function()
{
	this.Write("</td>");
};