function checkForm(){
var doc=document.form1;

var name=doc.username.value;
var strasse=doc.strasse.value;
var ort=doc.ort.value;
var telefon=doc.telefon.value;
var email=doc.email.value;
var paket=doc.paket.value;

if (doc.agb.checked==false)
{
	alert("Die Agb´s wurden nicht bestätigt!");
	return false;
}

var fehler=false;
var fehlerstring="Fehler bei der Eingabe!\n";

if (name=="" || strasse=="" ||ort=="" || telefon=="" || email=="" || paket=="")
{
	fehler=true;
	fehlerstring+="Es wurden nicht alle mit * gekennzeichneten\nPflichtfelder ausgefüllt.\n";
}

if (!EMail(email))
{
	fehler=true;
	fehlerstring+="Die Emailadresse ist nicht korrekt.\n";
}

if (fehler)
	{
		alert(fehlerstring)
		return false;
	}
	else
	{
		doc.submit();
	}
}



function EMail(s)
  {
  var a = false;
  var res = false;
  if(typeof(RegExp) == 'function')
    {
    var b = new RegExp('abc');
    if(b.test('abc') == true){a = true;}
    }

  if(a == true)
    {
    reg = new RegExp('^([a-zA-Z0-9\\-\\.\\_]+)'+
                     '(\\@)([a-zA-Z0-9\\-\\.]+)'+
                     '(\\.)([a-zA-Z]{2,4})$');
    res = (reg.test(s));
    }
  else
    {
    res = (s.search('@') >= 1 &&
           s.lastIndexOf('.') > s.search('@') &&
           s.lastIndexOf('.') >= s.length-5)
    }
  return(res);
  }
  
function checkNewsletter ()
{
	var fehler=false;
	var fehlerstring="Fehler bei der Eingabe!\n";
	
	if (!EMail(document.newsletter.nl.value)){
		fehlerstring+="Das ist keine gültige Emailadresse.\n";
		fehler=true;
		}
		if (document.newsletter.uname.value=="" || document.newsletter.uname.value=="dein Name"){
		fehlerstring+="Bittte geben Sie ihren Namen ein.";
		fehler=true;
		}
	
	if (fehler){
		alert(fehlerstring);
		return false;
		}
	else
	{
		document.newsletter.submit();	
		return false;
	}	
}

function browser ()
{
	if(document.ids)x='nc4';
	else if( document.all && !document.getElementById )x='ie4';
	else if( window.opera && !document.createElement )x='op5';
	else if( window.opera && window.getComputedStyle )  {
	          if(document.createRange)x='op8';
	            else if(window.navigate)x='op7.5';
	                             else x='op7.2';                   }
	else if( window.opera && document.compatMode )x='op7';
	else if( window.opera && document.releaseEvents )x='op6';
	else if( document.contains && !window.opera )x='kq3';
	else if(window.pkcs11&&window.XML)x='f15';
	else if( window.getSelection && window.atob )x='nn7';
	else if( window.getSelection && !document.compatMode )x='nn6';
	else if( window.clipboardData && document.compatMode )x='ie6';
	else if( window.clipboardData ){x='ie5';
	     if( !document.createDocumentFragment ) x+='.5';
	     if( document.doctype && !window.print ) x+='m';}
	else if( document.getElementById && !document.all ) x='op4';
	else if( document.images && !document.all ) x='nn3';
	else if(document.clientWidth&&!window.RegExp)x='kq2';
	else x='???';
	
	if (x.indexOf("nn")!=-1)
	{
		document.write("<style>.tdMainContentRechtsSpalte6{height:241px}.tdMainContentLinksSpalte4	{height:460px;}</style>");
	}
	if (screen.width <= 1024)
	{
		document.write("<style>#mainCont{margin-top:0px;}</style>");
	}
}

function popUp (con, hoehe, breite, zentrieren,resize) {
//resize yes oer no
//zentrieren false oder true
	if (zentrieren)
	{
		myLeft = (screen.width / 2) - breite/2;
		myTop = (screen.height / 2) - hoehe/2;
	}
	else
	{
		myLeft=100;
		myTop=100;
	}
	window.open(con,'','dependent=yes menubar=no,scrollbars=yes, resizable='+resize + ',left='+ myLeft+ ',top='+myTop+' status=no,width='+breite+',height='+hoehe+',');
}

function popUp2 (con, hoehe, breite, zentrieren,resize) {
//resize yes oer no
//zentrieren false oder true
	if (zentrieren)
	{
		myLeft = (screen.width / 2) - breite/2;
		myTop = (screen.height / 2) - hoehe/2;
	}
	else
	{
		myLeft=100;
		myTop=100;
	}
	window.open(con,'','dependent=yes menubar=no,scrollbars=no, resizable='+resize + ',left='+ myLeft+ ',top='+myTop+' status=no,width='+breite+',height='+hoehe+',');
}

function galOpen(id)
{
	myLeft=100;
	myTop=100;
	breite=482;
	hoehe=340;
	con="includes/galerie.php?id="+id;
	window.open(con,'','dependent=yes menubar=no,scrollbars=no, resizable=no,left='+ myLeft+ ',top='+myTop+' status=no,width='+breite+',height='+hoehe+',');
}

