function getTexts(id, belongsTo, section, number, divid, includeOwn)
{
	var theDiv = "#" + divid;
	if ($(theDiv).is(":hidden"))
	{
		$.get( "utilities/getTexts.php?id=" + id + "&belongsTo=" + belongsTo + "&section=" + section + "&number=" + number + "&includeOwn=" + includeOwn,
		function (resp)
		{
			$(theDiv).html(resp).slideDown("normal");
		});

		//document.getElementById(newDivId).style.border = 'dashed 1px #898989';
	}
	else
	{
		$(theDiv).slideUp("normal");
		//document.getElementById(newDivId).style.border = 'none';
	}
}

function getSpecificText(section, number, divid)
{
	var theDiv = "#" + divid;
	if ($(theDiv).is(":hidden"))
	{
		$.get( "utilities/getSpecificText.php?section=" + section + "&number=" + number,
		function (resp)
		{
			$(theDiv).html(resp).slideDown("normal");
		});
	}
	else
	{
		$(theDiv).slideUp("normal");
	}
}

function expandAll()
{
	var allDivs = document.getElementsByTagName("div");
	for (var i = 0; i < allDivs.length; i++)
	{
		var e = allDivs[i];
		if (e.id.indexOf('_div') != -1)
		{
			var id = e.id.substring(e.id.indexOf('_') + 1, e.id.indexOf('_div'));
			var belongsTo = e.id.substring(0, e.id.indexOf('_'));
			getTexts(id, belongsTo, '', '', e.id, true);
		}
	}
}

function getSupplementary(section)
{
	$.post( "utilities/getSupplementary.php?section=" + section,
	function (resp)
	{
		$("#supplementarysection").html(resp);
	});
}

function getConcordance(title)
{
	var theDiv = "#" + title;
	if ($(theDiv).is(":hidden"))
	{
		$.post( "utilities/getConcordance.php?title=" + title,
		function (resp)
		{
			$(theDiv).html(resp).slideDown("normal");
		});
	}
	else
	{
		$(theDiv).slideUp("normal");
	}
}