// JavaScript Document
function formvalidation(theform)
{

var ok=0;

if (theform.Absender.value.search(/^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/) == -1)
{
theform.Absender.style.backgroundColor = "#FF9999";
ok=1;
}
else
theform.Absender.style.backgroundColor = "white";

if (theform.Name.value.length<3)
{
theform.Name.style.backgroundColor = "#FF9999";
ok=1;
}
else
theform.Name.style.backgroundColor = "white";

if (ok == 0)
{
hideform();
sendmail(theform,datumid);
//theform.los.disabled=false;
}
}


function hideform()
{
window.clearInterval(trans);	
n=document.getElementById('dimmer');
n.style.MozOpacity=0; 
n.style.filter="Alpha(opacity=0)";
n.style.visibility = "hidden";
document.getElementById('err').innerHTML = "&nbsp;";
document.getElementById('vorbestellung').style.visibility = 'hidden';
return false;
}


function sendmail(theform,theid) {
	
paramstring='Name=' + theform.Name.value + '&Absender=' + theform.Absender.value + '&DatumID=' + theid+ '&code=' + theform.code.value+ '&los=1&aj=1&Karten=' + theform.Karten.value;
//alert(paramstring);
var url = "checkvb.php" ;
request.open("POST", url, true);
request.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
request.setRequestHeader("Content-length", paramstring.length);
request.setRequestHeader("Connection", "close");

request.onreadystatechange = vbresult;
request.send(paramstring);

return false;
   } 
   
function vbresult() {
	
	//document.getElementById('vorbestellung').style.cursor='standard'
	
     if (request.readyState == 4) {
		//location.replace("index.php?film=" +filmid );
       if (request.status == 200) {
         var response = request.responseText;
		 if (response.length>0)
		 {
			//document.getElementById('err').innerHTML = response;
			//setTimeout("hideform()",1000);
			
		 }
		else
		{
			hideform();
		}
			
			
       } else
         alert("status is " + request.status);
     }
	}