function bildpopup(bildpopp,bildpopti,bildpopte)
{
  var undefined;

  if (bildpopte==undefined)
  	bildpopte='Bild';

  if (bildpopti==undefined)
  	bildpopti='Bildergalerie';

  bildpopnw = window.open("","",'resizable=0,width=100,height=100,scroll=no,statusbar=0,adressbar=0');

  with (bildpopnw)
  {
   focus();
   document.open();
   document.write('<html><head><meta http-equiv="expires" content="0"><title>'+bildpopti+'</title>');
   document.write('<meta http-equiv=\"imagetoolbar\" content=\"no\">');
   document.write('<link href=\"/styles.css\" rel=\"stylesheet\" type=\"text/css\"></head>');
   document.write('<body bgcolor=#FFFFFF leftmargin=\"0\" topmargin=\"0\" marginwidth=\"0\" marginheight=\"0\" scroll=\"no\">')
   document.write('<table height="100%" width="100%"><tr><td align="center" valign="middle"><A HREF="javascript:onClick=self.close()">');
   document.write('<img style="border: 1px solid black" src=\"'+bildpopp+'\"  onload=\"opener.resizeWindow(document.images[0].width,document.images[0].height)\" border=\"0\" alt=\"'+bildpopte+'\"></a>')
   document.write('</td></tr></table></body></html>')
   document.close();
  }
}

function resizeWindow(x, y)
{
  var pop_left = (screen.width/2)-(x/2);
  var pop_top = (screen.height/2)-(y/2);

  // um exaktes Fitting zu ermöglichen +20/+46
  bildpopnw.resizeTo(x+60, y+86);
  bildpopnw.moveTo(pop_left, pop_top);
}

function fensterauf(seite,fenstername,eigenschaft)
{
	window.open(seite,"fenstername",eigenschaft);
}

function checkForm()
{
         	var necessary = window.document.formular.necessary.value;
                 var temp = new Array();
                 var ok = true;
                 temp = necessary.split(';');

                 for (var n = 0; n < temp.length; n++)
                 {
                         if(window.document.getElementsByName(temp[n])[0].value == "")
                         {
                         	ok = false;
        				alert("Bitte füllen Sie das Feld " + temp[n] + " aus!");
                         }
                 }

                 if(window.document.formular.AGB)
                 {
                       	if(!window.document.formular.AGB.checked)
                         {
                        		ok = false;
        				alert("Sie müssen unsere Geschäftsbedingungen akzeptieren um das Formular abzusenden");
                         }
                 }

                 if(window.document.formular.eMail.value != "")
                 {
                      var Kontrolle = /^[_\.0-9A-Za-z-]+@([0-9A-Za-z\-]+\.)+[a-z]{2,4}$/;
	             if(!Kontrolle.exec(window.document.formular.eMail.value))
                      {
                         ok = false;
                      	alert("Sie müssen eine korrekte eMail-Adresse eingeben um das Formular abzusenden");
                      }
                 }

                 if(ok)
                         window.document.formular.submit();
}
