var _timer;
var _edit_path='';

function getLeft(l)
{
  if (l.offsetParent) return (l.offsetLeft + getLeft(l.offsetParent));
  else return (l.offsetLeft);
}
function getTop(l)
{
  if (l.offsetParent) return (l.offsetTop + getTop(l.offsetParent));
  else return (l.offsetTop);
}

function ccShowEditMenu(o,path,e) {
	if (_timer) window.clearTimeout(_timer);
	_edit_path=path;
	em=document.getElementById('editMenu');
	em.style.visibility='hidden';
	em.style.left=getLeft(o);
	em.style.top=getTop(o)+o.height;
	em.style.visibility='visible';
}

function ccHideEditMenu2() {
	em=document.getElementById('editMenu');
	em.style.visibility='hidden';
}

function ccMouseoverMenuItem(o) {
	if (_timer) window.clearTimeout(_timer);
	o.className='editMenuElementSelected'
}

function ccMouseoutMenuItem(o) {
	_timer=window.setTimeout("ccHideEditMenu2()",200);
	o.className='editMenuElement';
}

function ccHideEditMenu(e) {
	_timer=window.setTimeout("ccHideEditMenu2()",200);
}

function ccExecMenuItem(name) {
	var base_path=window.location.href;
	if (name=='anzeigen') {
		window.open(_edit_path,'');
	}
	if (name=='editieren') {
		window.open(_edit_path+'?cmd=edit');
	}
	if (name=='freigeben') {
		window.location.href=_edit_path+'?cmd=doedit&released=1&return_path='+escape(base_path);
	}
	if (name=='sperren') {
		window.location.href=_edit_path+'?cmd=doedit&released=0&return_path='+escape(base_path);
	}
	if (name=='loeschen') {
		if (confirm("Sind Sie sicher, dass Sie das Objekt "+_edit_path+' und alle Unterobjekte löschen wollen?')) {
			window.location.href=_edit_path+'?cmd=del&use_this_object=1&return_path='+escape(base_path);
		}
	}
}
