// JavaScript Document

	function ists_email(wort,inpt)  //Prüft ob Eingabe eine Emailadresse ist und färbt übergebendes Feld bei Fehler
	{


		
		if(wort.match(/\w*@\w.*\.\w\w*/)==null)
 		{
 			alert(unescape("Keine zul%E4ssige E-Mail-Adresse%21"));
        	document.getElementById(inpt).style.backgroundColor = "#D19B6B";
        	document.getElementById(inpt).focus ();
			return false;
     		
 		}
 		else
 		{
        	document.getElementById(inpt).style.backgroundColor = "#ffffff";
			return true;
 		}  
	}


// Eingabe (Zahlen) überprüfen
function CheckZahl (wort,inpt) //Prüft ob Wert ohne Punkt und Komma eine Zahl ist und markiert übergebendes Feld bei Fehler
   { 
      document.getElementById(inpt).style.backgroundColor = "#fff";
      var ist_zahl=true;
 
      for(n=0;n<wort.length;n++)
            {if(wort.charAt(n)<"0"||wort.charAt(n)>"9")ist_zahl=false;}
      if(ist_zahl)
      {
           return TRUE;
      }
      else
      {
  		  document.getElementById(inpt).value = "";
          alert(unescape("Keine g%FCtige Zahl eingetragen%21 Es d%FCrfen nur ganze Zahlen eingegeben werden%21"));
          document.getElementById(inpt).style.backgroundColor = "#D19B6B";
          document.getElementById(inpt).focus ();


      }
   }


function karte(st)
{
	location.href= document.URL + '&stadtteil=' + st;
}

function check_upload(val,id)
{ 

	regex = /[jpg]/i;

	document.getElementById(id).style.backgroundColor="#fff";
	if(val.match(/(jpg)/i)==null)
	{
		alert("Die Datei muss ein jpg-Bild sein");
		document.getElementById(id).value='';
		document.getElementById(id).style.backgroundColor="red";
	}
}

function chk_agb()
{
	document.getElementById('agb').style.border = "1px, #000";

	if (document.getElementById('agb').checked)
	{
		return true;		
	}
	else
	{
		document.getElementById('agb').style.border = "red, 3px";
		alert('Bitte lesen und akzeptieren Sie unsere AGB!');
		return false;
	}
}

function chk_mieter_neu()
{
		if(document.getElementById("email").value.match(/\w*@\w.*\.\w\w*/)==null)
 		{
 			alert(unescape("Keine zul%E4ssige E-Mail-Adresse%21"));
        	document.getElementById("email").style.backgroundColor = "#D19B6B";
        	document.getElementById("email").focus ();
			return false;
     		
 		}
 		else
 		{
		return chk_agb();

 		}  

}
