// JavaScript Document

function editPage(id)
{
	document.admin.pageid.value=id;
	document.admin.submit();
}

function getSourcePara()
{
	el = event.srcElement;
	while( el.tagName != "P" ) 
	{
		el = el.parentNode;
	}
	return el;
}

function selectParagraph()
{
	els = document.getElementsByTagName("P");
	for( i=0; i<els.length; i++ )
		els[i].className = els[i].className.replace('AdminBorderSelected','AdminBorder');
	
	el = getSourcePara();
	el.className = el.className.replace('AdminBorder','AdminBorderSelected');
	document.admin.paraid.value=el.id;
}

function moveLeft()
{
	document.admin.command.value="moveleft";
	document.admin.submit();
}

function moveRight()
{
	document.admin.command.value="moveright";
	document.admin.submit();
}

function moveUp()
{
	document.admin.command.value="moveup";
	document.admin.submit();
}

function moveDown()
{
	document.admin.command.value="movedown";
	document.admin.submit();
}

function addPara()
{
	
}

function editPara()
{
}

function deletePara()
{
	if( confirm("Are you sure you wish to delete this item?") )
	{
		document.admin.command.value="delete";
		document.admin.submit();
	}
}

function showAddDialog(id)
{
	el = document.getElementById(id);
	if( el ) 
	{
		el.style.display = 'block';
		document.admin.command.value = id;
		el = document.getElementById('DialogMask');
		if( el ) 
			el.style.display = 'block';
	}
}

function removePage(id)
{
	if( confirm("Are you sure you wish to delete this page?") )
	{
		document.admin.pageid.value = id;
		document.admin.command.value="removepage";
		document.admin.submit();
	}
}

function removePicture(id)
{
	if( confirm("Are you sure you wish to delete this picture?") )
	{
		document.admin.pageid.value = id;
		document.admin.command.value="removepicture";
		document.admin.submit();
	}
}

function removeEvent(id)
{
	if( confirm("Are you sure you wish to delete this event?") )
	{
		document.admin.pageid.value = id;
		document.admin.command.value="removeevent";
		document.admin.submit();
	}
}


