function OpenWindow(url, /*titel, */breite, hoehe) {
	var fenster_links = (screen.width - breite) / 2;
	var fenster_oben = (screen.height - hoehe) / 2;
	fenster = window.open(url,"lunacyPopup","width="+breite+",height="+hoehe+",scrollbars=no,resizable=no,dependent=yes,hotkeys=no,location=no,menubar=no,status=no,toolbar=no,left="+fenster_links+",top="+fenster_oben);
	fenster.focus();
	return fenster;
}

function popupFiles(popup) {
	return (OpenWindow(popup, 600, 400) == false);
}

function url() {
	var url = document.URL;
	var pos = url.lastIndexOf("/");
	if (pos < 5) {
		pos = url.lastIndexOf("\\");
	}
	return url.substring(0,pos);
}

function ask_delete() {
	return confirm('Wollen Sie diesen Eintrag wirklich l&#246;schen?')
}


function checkframe() {
  var frameset = "http://www.lunacypictures.de/frameset";
  if (frameset+".html" == top.location.href) {
	  return;
  }
  if (top.location.href.substring(0, frameset.length).toLowerCase() != frameset+".php")  {
    var newurl = top.location.href;
    newurl = newurl.substring(newurl.indexOf("/", 7)+1);
	if (newurl.indexOf("frameset.php") > -1) {
      if (newurl.indexOf("?") > -1) {
        newurl = newurl.substring(newurl.indexOf("?display=")+"?display=".length);
      } else {
        newurl = false;
      }
    }
	if (top.location.href == frameset+".php?display="+newurl) {
		return;
    } else if (newurl) {
      top.location.href = frameset+".php?display="+newurl;
    } else {
      top.location.href = frameset+".html";
    }
  }
}