  function CheckMailAddress(mail) {
      li_dot=mail.lastIndexOf(".");
      i_at=mail.indexOf("@");
      if(li_dot>=0 && i_at>0 && li_dot>i_at+1) return true;
      else return false;
  }

  
  function CustomerInformation(form)
  {
    if(document.getElementById('send_information').value==1)
    {
      document.getElementById('send_information').value=0;
      
      
      if(form.contact_firstname.value == "") 		{ alert("You did not complete Contact information - First Name"); return false;  }
      if(form.contact_lastname.value == "") 		{ alert("You did not complete Contact information - Last Name"); return false;  }
      if(!CheckMailAddress(form.contact_email.value)) 	{ alert("You did not complete Contact information - E-mail correctly"); return false; }
      if(form.contact_phone.value == "") 		{ alert("You did not complete Contact information - Phone"); return false;  }
      if(form.ship_firstname.value == "") 		{ alert("You did not complete Shipping information - First Name"); return false;  }
      if(form.ship_lastname.value == "") 		{ alert("You did not complete Shipping information - Last Name"); return false;  }
      if(form.ship_address1.value == "") 		{ alert("You did not complete Shipping information - Street Adress 1"); return false;  }
      if(form.ship_city.value == "") 			{ alert("You did not complete Shipping information - City"); return false;  }
      if(form.ship_zip.value == "") 			{ alert("You did not complete Shipping information - ZIP Code"); return false;  }
      if((form.bill_same.checked == "") && (form.bill_firstname.value == "")) 	{ alert("You did not complete Billing information - First Name"); return false;  }
      if((form.bill_same.checked == "") && (form.bill_lastname.value == "")) 	{ alert("You did not complete Billing information - Last Name"); return false;  }
      if((form.bill_same.checked == "") && (form.bill_address1.value == "")) 	{ alert("You did not complete Billing information - Street Adress 1"); return false;  }
      if((form.bill_same.checked == "") && (form.bill_city.value == ""))	{ alert("You did not complete Billing information - City"); return false;  }
      if((form.bill_same.checked == "") && (form.bill_zip.value == ""))		{ alert("You did not complete Billing information - ZIP Code"); return false;  }
    }
    return true; // all is OK, submit it
  }

  function AccountInformation(form)
  {
    if(document.getElementById('send_information').value==1)
    {
      document.getElementById('send_information').value=0;
      
      
      if(form.login_username.value == "") 					{ alert("You did not complete Login - Username"); return false;  }
      if(form.login_password.value == "") 					{ alert("You did not complete Login - Password"); return false;  }
      if(form.login_password.value != form.login_password_confirm.value) 	{ alert("You did not confirm your Password"); return false; } 
      
      if(form.contact_firstname.value == "") 		{ alert("You did not complete Contact information - First Name"); return false;  }
      if(form.contact_lastname.value == "") 		{ alert("You did not complete Contact information - Last Name"); return false;  }
      if(!CheckMailAddress(form.contact_email.value)) 	{ alert("You did not complete Contact information - E-mail correctly"); return false; }
      if(form.contact_phone.value == "") 		{ alert("You did not complete Contact information - Phone"); return false;  }
      if(form.ship_firstname.value == "") 		{ alert("You did not complete Shipping information - First Name"); return false;  }
      if(form.ship_lastname.value == "") 		{ alert("You did not complete Shipping information - Last Name"); return false;  }
      if(form.ship_address1.value == "") 		{ alert("You did not complete Shipping information - Street Adress 1"); return false;  }
      if(form.ship_city.value == "") 			{ alert("You did not complete Shipping information - City"); return false;  }
      if(form.ship_zip.value == "") 			{ alert("You did not complete Shipping information - ZIP Code"); return false;  }
      if((form.bill_same.checked == "") && (form.bill_firstname.value == "")) 	{ alert("You did not complete Billing information - First Name"); return false;  }
      if((form.bill_same.checked == "") && (form.bill_lastname.value == "")) 	{ alert("You did not complete Billing information - Last Name"); return false;  }
      if((form.bill_same.checked == "") && (form.bill_address1.value == "")) 	{ alert("You did not complete Billing information - Street Adress 1"); return false;  }
      if((form.bill_same.checked == "") && (form.bill_city.value == ""))	{ alert("You did not complete Billing information - City"); return false;  }
      if((form.bill_same.checked == "") && (form.bill_zip.value == ""))		{ alert("You did not complete Billing information - ZIP Code"); return false;  }
    }
    return true; // all is OK, submit it
  }
  
  function LoginInformation(form)
  {
    if(document.getElementById('send_password').value==1)
    {
      document.getElementById('send_password').value=0;
      
      if(form.login_username.value == "") 					{ alert("You did not enter Username"); return false;  }
      if(form.login_password.value == "") 					{ alert("You did not enter Password"); return false;  }
      
    }
    return true; // all is OK, submit it
  }
 
 
   function PaymentInformation(form)
  {
    if(document.getElementById('send_information').value==1)
    {
      document.getElementById('send_information').value=0;
      
      
      if((form.pay_cardnumber.value < 1000) || (form.pay_cardnumber.value > 10000000000000000)) 	{ alert("This card number is not valid"); return false;  }
      if((form.pay_verificationnumber.value < 100) || (form.pay_verificationnumber.value > 999))	{ alert("This card CVV is not valid"); return false;  }
      
    }
    return true; // all is OK, submit it
  }
