// JavaScript Document
function confirmPicDelete(e)
{
	return confirm('Möchten Sie dieses Bild wirklich löschen?');
}

function confirmGalleryDelete(e)
{
	return confirm('Möchten Sie diese Galerie inklusive Ihrer Bilder wirklich löschen?');
}

function subtitleCheck(e)
{
	if (e.value == 'Bilduntertitel' || e.value == 'picture subtitle') e.value='';
}

function editPicture(e, pid)
{
	try
	{
		endPicLayer();
	}
	catch(e)
	{};
	
	div = document.createElement('div');
	div.className = 'picEditLayer';
	div.setAttribute('id', 'picEditLayer');
	
	newHTML  = '<form action="'+location.href+'" method="post" enctype="multipart/form-data">';
	newHTML += '<input type="hidden" name="pic_subtitle_change" value="'+pid+'" />';
	newHTML += '<strong>Bilduntertitel ändern:</strong><br />';
	newHTML += '<textarea id="picture_subtitle" name="picture_subtitle" cols="40" rows="3">'+e.title+'</textarea><br /><br />';
	newHTML += '<input type="submit" value="Speichern" /> <a href="javascript:endPicLayer()" class="abort">Abbrechen</a>';
	newHTML += '</form>';
	
	div.innerHTML = newHTML;
	//div.style.left = wpg_absLeft(e.parentNode)+'px';
	
	e.parentNode.insertBefore(div, e);
	
	return false;
}

function endPicLayer()
{
	piclayer = document.getElementById('picEditLayer');
	if (piclayer)
	{
		piclayer.parentNode.removeChild(piclayer);
	}
}

function wpg_absLeft(el) {
 return (el.offsetParent)? 
 el.offsetLeft+wpg_absLeft(el.offsetParent) : el.offsetLeft;
}

function wpg_absTop(el) {
 return (el.offsetParent)? 
 el.offsetTop+wpg_absTop(el.offsetParent) : el.offsetTop;
}
