
function xxx( str )
  {
    result = true;
    firstchar = str.charAt(0);
    for ( var i=0; i < str.length; i++ )
    {
      if ( str.charAt(i) != firstchar )
        { result = false }
    }
    return result;
  }


function input_alphanum( ref, title )
{
	if ( (ref.value.length < 3) || xxx( ref.value ) )
	{
		alert("Fehlende oder ungültige Eingabe für das Feld " + title + "...Bitte korrigieren!");
		ref.focus();
		return false;
	}
	return true;
}

function input_numwo0( ref, title )
{
	var valid_num = /^([1-9])*$/
	if ( ref.value.length == 0 || valid_num.test( ref.value ) == false )
	{
		alert("Fehlende oder ungültige Eingabe für das Feld " + title + "...Bitte korrigieren!");
		ref.focus();
		return false;
	}
	return true;
}

function input_num( ref, title )
{
	var valid_num = /^([0-9])*$/
	if ( ref.value.length == 0 || valid_num.test( ref.value ) == false )
	{
		alert("Fehlende oder ungültige Eingabe für das Feld " + title + "...Bitte korrigieren!");
		ref.focus();
		return false;
	}
	return true;
}

function input_email( ref, title )
{
	if ( (ref.value.length < 6) 
	|| (ref.value.indexOf('@') < 1)
	|| (ref.value.indexOf('.') == -1 ) )
	{
		alert("Fehlende oder ungültige Eingabe für das Feld " + title + "...Bitte korrigieren!");
		ref.focus();
		return false;
	}
	return true;
}

function chkform()
{

	var sendform = document.form_buchung;	

	if ( !input_alphanum( sendform.name, "Name" )
	  || !input_alphanum( sendform.firstname, "Vorname" )
	  || !input_alphanum( sendform.address, "Adresse" )
	  || !input_alphanum( sendform.city, "Ort" )
	  || !input_num( sendform.zipcode, "Postleitzahl" )
	  || !input_alphanum( sendform.phone, "Telefon" )
	  || !input_email( sendform.email, "email" )
	    )
	return false;

   return true;
}

	
	
	var parts_sum = new Array();


function amx( ref, num, price, i )
{
	xsum = (num*price);
	ref.value = xsum;
	parts_sum[i] = xsum;

	total = 0;
	for (i in parts_sum)
 	{
  		total = total + parts_sum[i];

  	}

	document.form_buchung.summe.value = total;
	return true;
}

