﻿//check if is member
function eval_Member(member){
if(member[0].checked){
return true;
}
if(!member[0].checked){
return false;
 }
}//end function

//check firstname,lastname
function eval_Name(last,first){

if(last == ""){
alert("Please enter your Lastname.");
return false;
 }
 if(first == ""){
alert("Please enter your Firstname.");
return false;
 }
return true;
}//end function

//check Address
function eval_Address(street,no,city,zip){
if(street == ""){
alert("Please enter Street.");
return false;
 }
if(no == ""){
alert("Please enter Housenumber.");
return false;
 }
if(city == ""){
alert("Please enter City.");
return false;
 }
if(zip == ""){
alert("Please enter ZIP code.");
return false;
}
if(isNaN(zip) == true){
alert("Please enter a valid ZIP code");
return false;
 }
return true;
}//end function

//check Address without ZIP
function eval_AdressNoZip(street,no,city){
if(street == ""){
alert("Please enter Street.");
return false;
 }
if(no == ""){
alert("Please enter Housenumber.");
return false;
 }
if(city == ""){
alert("Please enter City.");
return false;
 }
return true;
}//end function

//check phonenumber
function eval_Phone(code,phone){
if(code == ""){
alert("Please enter Area-Code.");
return false;
 }
if(phone == ""){
alert("Please enter your Phonenumber.");
return false;
 }
if(isNaN(phone) || isNaN(code) == true){
alert("please enter a valid Phonenumber");
return false;
 }
return true;
}//end function

//check country
function eval_Country(country){
if(country == ""){
alert("Please enter Country.");
return false;
 }
return true;
}//end function

// check email address
function eval_Mail(eMail){
 invalidChars="/:,;"
 if(eMail==""){
alert("Please enter your eMail - address.");
return false;
 }
for(var i=0;i<invalidChars.length;i++){
   badChar=invalidChars.charAt(i);
    if(eMail.indexOf(badChar,0)>-1){
   alert("Please enter a valid eMail - address.");
return false;
  }
 }
atPos = eMail.indexOf("@",1);
   if(atPos == -1){
   alert("Please enter a valid eMail - address.");
    return false;
 }
if(eMail.indexOf("@",atPos+1)>-1){
   alert("Please enter a valid eMail - address.");
  return false;
 }
periodPos = eMail.indexOf(".",atPos);
 if(periodPos == -1){
   alert("Please enter a valideMail - address.");
return false;
}

if(periodPos +3 > eMail.length){
alert("Please enter a valid eMail - address.");
return false;
}
return true;
}//end function

//check donation 
function eval_Donation(number){
if(number == ""){
alert("please enter Donation");
return false;
}
if(isNaN(number) == true){
alert("please valid  Donation");
return false;
}
return true;
}//end function


//check full name
function eval_Fullname(fullname){
if(fullname == ""){
alert("Please enter your full name.");
return false;
 }
 return true;
 }//end function  
 
 //check message
function eval_Message(message){
if(message == ""){
alert("Please enter your message.");
return false;
 }
 return true;
 }//end function 


//check firstname,lastname Yizobona
function eval_NameYizo(last,first){

if(last == ""){
alert("Wie heissen Ihre Begleitperson/en?");
return false;
 }
 if(first == ""){
alert("Wie heissen Ihre Begleitperson/en?");
return false;
 }
return true;
}//end function

//check number of people
function eval_Bookings(people,avPlaces){

if(people == ""){
alert("How many people would you like to book?");
return false;
 }
else{
var a = parseInt(people);
var b = parseInt(avPlaces);
if(a > b){
alert("sorry you booked too many people");
return false;
 }
}
return true;
 }//end function 
 
 //check pwd
 function eval_Pwd(pwd){
 if(pwd == ""){
 alert("please enter your password");
 return false;
 }
 
 
else{
var cExpr = new RegExp("[A-Z,a-z,1-9]");
  
  for(var i = 0; i < pwd.length; i++){
    var y = cExpr.test(pwd[i]); 
       if(!y){
       alert("Your Password contains illigal caracters!");
       return false;
       } 
      } 
     }
 
 return true;
 }//end function
 

//check for cookies
function eval_cookie(name){
var start = memCook.indexOf(name + "=");
if(start == -1){//no cookie found
return 0;
}
else{
return 1;//cookie found
 }
}//end function

function eval_blog(title,text){
if(title == ""){
alert("please enter a title");
return false;
}
if(text == ""){
alert("please enter your text");
return false;
}
return true;
}




