function popUp(loc,name,width,height,xpos,ypos,det,scrl)
{
	var x, y, w, h, moveX=0, moveY=0, features="";
	features += "toolbar="+det+",location="+det+",status="+det+",menubar="+det;
	features += ",scrollbars="+scrl+",resizable="+scrl;
	if(width) features += ",width="+width;
	if(height) features += ",height="+height;
	if(xpos && window.screen){
		w = window.screen.availWidth;
		width = parseInt(width);
		switch(xpos){
			case "left": x = 0; break;
			case "center": x = (w-width)/2; break;
			case "right": x = w-width-10; break;
			default: x = xpos;
		}
		features += ",screenX="+x+",left="+x;
		var moveX = x;
	}
	if(ypos && window.screen){
		h = window.screen.availHeight;
		height = parseInt(height);
		switch(ypos){
			case "top": y = 0; break;
			case "middle": y = (h-height)/2; break;
			case "bottom": y = h-height; break;
			default: y = ypos;
		}
		features += ",screenY="+y+",top="+y;
		var moveY = y;
	}
	openLoc = window.open(loc,name,features);
	if(moveX || moveY){
		openLoc.moveTo(moveX,moveY);
	}
	openLoc.focus();
}

function jump(menu)
{
  window.open(menu[menu.selectedIndex].value,'_self');
}


function MM_swapImgRestore()
{ //v3.0
  var i,x,a=document.MM_sr;
  
  for(i=0; a && i < a.length && (x=a[i]) && x.oSrc; i++)
  {
  	x.src=x.oSrc;
  }
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function check_data_NewAccount()
{
	var fehler = "";
	if (document.anmeldung.r_vorname.value == "")
	{
		document.anmeldung.r_vorname.focus();
		alert("Bitte geben Sie den Vornamen ein!");
		return false;
	}

	if (document.anmeldung.r_nachname.value == "")
	{
		document.anmeldung.r_nachname.focus();
		alert("Bitte geben Sie den Nachname ein!");
		return false;
	}

	if (document.anmeldung.r_strasse.value == "")
	{
		document.anmeldung.r_strasse.focus();
		alert("Bitte geben Sie die Strasse ein!");
		return false;
	}


	if (check_plz_NewAccount() == false)
	{
		return false;
	}

	if (check_email_NewAccount() == false)
	{
		return false;
	}

	if (document.anmeldung.r_nickname.value == "")
	{
		document.anmeldung.r_nickname.focus();
		alert("Bitte geben Sie den Benutzernamen ein!");
		return false;
	}

	if (document.anmeldung.r_pwd1.value == "")
	{
		document.anmeldung.r_pwd1.focus();
		alert("Bitte geben Sie in Beide Felder dasselbe Passwort ein!");
		return false;
	}

	if (document.anmeldung.r_pwd2.value == "")
	{
		document.anmeldung.r_pwd2.focus();
		alert("Bitte geben Sie in Beide Felder dasselbe Passwort ein!");
		return false;
	}

	if (document.anmeldung.r_pwd2.value == document.anmeldung.r_pwd1.value)
	{
		// Do Nothing
	}
	else
	{
		document.anmeldung.r_pwd1.focus();
		alert("Passworter nicht identisch: Bitte geben Sie in Beide Felder dasselbe Passwort ein!");
		return false;
	}
	
	
	if(document.anmeldung.agb_agreed.checked != true)
	{
		alert("Bitte akzeptieren Sie die AGB!");
		return false;	  	
	}
}

function check_plz_NewAccount()
{
	if (document.anmeldung.r_plz.value == "")
      {
        document.anmeldung.r_plz.focus();
        alert("Bitte geben Sie die PLZ ein!");
        return false;
      }

	if (! ( Math.ceil(document.anmeldung.r_plz.value)>1 && Math.ceil(document.anmeldung.r_plz.value)<999999 && document.anmeldung.r_plz.value.length>3) )
	{
		document.anmeldung.r_plz.focus();
		alert('Die angegebene PLZ ist ungültig (nicht Zahl zwischen 0001 und 999999). Bitte Korrigieren.');
		return false;
	}
}

function check_NewBookTitle()
{
	if (document.createbook.cb_titel.value == "" || document.createbook.cb_titel.value.length < 6)
      {
        document.createbook.cb_titel.focus();
        alert("Buchtitel muss mindestens 5stellig sein!");
        return false;
      }
}


function check_email_NewAccount()
{
	if (document.anmeldung.r_email.value == "")
   	{
      document.anmeldung.r_email.focus();
      alert("Bitte geben Sie die E-Mail Adresse ein!");
      return false;
   	}

   	if(document.anmeldung.r_email.value.match(/^[a-zA-Z0-9_\.-]{2,}@[a-z0-9-]{3,}\.[a-z]{2,4}|museum$/))
   	{

   	}
   	else
   	{
     	alert('E-Mailadresse ist NICHT gültig');
     	document.anmeldung.r_email.focus();
    	return false;
   }
}
