function LoadPage(sPage, sContainer, bEdit)
{
	// Default is editable
	if(bEdit == null)
		bEdit = true;

	// Fix container
	if(!sContainer)
		sContainer = 'contentwrapper_main';

	// Fix page
	if(!sPage || sPage.length == 0)
		sPage = 'index';

	// Just load the page into the container
	$.get("page.php?container=" + sContainer + "&file=" + sPage + "&edit=" + (bEdit ? '1' : '0'), function(sData) { PutPage(sContainer, sData); });
}

function EditPage(sPage, sContainer)
{
	// Load edit page
	$.get("edit.php?container=" + sContainer + "&file=" + sPage, function(sData) { PutPage(sContainer, sData); });
}

function PutPage(sContainer, sData)
{
	// Set the data
	$('#' + sContainer).html(sData);
}

function SubmitPage(oForm)
{
	// Update FCK
	FCKeditorAPI.GetInstance('content').UpdateLinkedField();

	// Submit it, AJAX-style
	$.post("submit.php", $(oForm).serialize(), function(sData) { PutPage(oForm.container.value, sData); });

	// Don't actually submit
	return false;
}

function SubmitContact(oForm)
{
	// Submit it, AJAX-style
	$.post("contact.php", $(oForm).serialize(), function(sData) { PutPage('contentwrapper_main', sData); });

	// Don't actually submit
	return false;
}