/*
var check_a = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyzƒŠŒŽšœžŸÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõöøùúûüýþÿ0123456789-.,!? \t\r\n\f";
var check_n = "0123456789";
var check_d = "0123456789-/";
var check_e = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyzƒŠŒŽšœžŸÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõöøùúûüýþÿ0123456789-_.@";
var miss_e  = ".@";
var save_i  = 0;

function check_content( checkStr, StrOk ) {			// check the order form
  var allValid = true;
  for (i = 0;  i < checkStr.length;  i++)
  {
    ch = checkStr.charAt(i);
    for (j = 0;  j < StrOk.length;  j++)
      if (ch == StrOk.charAt(j))
        break;
    if (j == StrOk.length)
    {
      allValid = false;
      break;
    }
  }
  return( allValid );
}

function check_miss (ToCheck, CheckAgainst)
{
  x = 1;					// Eingabe ist generell erst mal ok
  for (i = 0;  i < CheckAgainst.length;  i++) {	// alle zu prüfenden Zeichen durchgehen
    ch = CheckAgainst.charAt(i);		// einzelnes Zeichen isolieren
    for (j = 0;  j < ToCheck.length;  j++)	// email-Adresse durchgehen
      if (ch == ToCheck.charAt(j))		// wenn Zeichen gefunden
        break;					// Schleife abbrechen
    if (j >= ToCheck.length)			// wenn Zeichen nicht innerhalb des zu prüfenden Strings
      x = 0;					// dann ist was falsch
  }						// Prüfungsende
  if( x == 0 ) {				// Wenn irgendwas nicht gefunden
    return false;				// Dann Fehler zurückgeben
  } else {					// ansonsten
    return true;				// alles klar
  }
}

function check_addata() 			// check the order form
{
  if( document.formaddata.agree.checked == false ) {
    alert("Sorry.\nYou have to agree to our business conditions,\notherwise we cannot accept your order.\n\nThank you");
    document.formaddata.agree.focus();
    return (false);
  }
  return true;
}
*/
function check_presentee() 			// check the order form
{

  if (document.formpresentee.to_fname.value == "")
  {
    alert("Please insert your first name into \"FirstName\" .");
    document.formpresentee.to_fname.focus();
    return (false);
  }

  if (document.formpresentee.to_fname.value.length < 2)
  {
    alert("Please insert min. two signs into \"First Name\" .");
    document.formpresentee.to_fname.focus();
    return (false);
  }

  if (! check_content(document.formpresentee.to_fname.value, check_a)) 
  {
    alert("Please insert characters, number or blanks into \"First Name\" only.");
    document.formpresentee.to_fname.focus();
    return (false);
  }

  if (document.formpresentee.to_lname.value == "")
  {
    alert("Please insert \"LastName\" ein.");
    document.formpresentee.to_lname.focus();
    return (false);
  }

  if (document.formpresentee.to_lname.value.length < 2)
  {
    alert("Please complete the question \"Last Name\" .");
    document.formpresentee.lto_name.focus();
    return (false);
  }

  if (! check_content(document.formpresentee.to_lname.value, check_a)) 
  {
    alert("Please insert characters, numbers or blanks into \"Last Name\" only.");
    document.formpresentee.to_lname.focus();
    return (false);
  }

  if (! check_content(document.formpresentee.to_age.value, check_a)) 
  {
    alert("Please insert numbers into \"Age\" only.");
    document.formpresentee.to_age.focus();
    return (false);
  }

  if (! check_content(document.formpresentee.to_sex.value, check_a)) 
  {
    alert("Please select presentees sex from the list");
    document.formpresentee.to_sex.focus();
    return (false);
  }

  if (document.formpresentee.to_email.value == "")
  {
    alert("Please insert \"Email\".");
    document.formpresentee.to_email.focus();
    return (false);
  }

  if (document.formpresentee.to_email.value.length < 4)
  {
    alert("Please complete the question \"Email\" .");
    document.formpresentee.to_email.focus();
    return (false);
  }

  if (! check_content(document.formpresentee.to_email.value, check_e)) 
  {
    alert("Please insert charcters, numbers, blanks and \"-_.@\"- signs into \"Email\" only.");
    document.formpresentee.to_email.focus();
    return (false);
  }

  if (! check_miss(document.formpresentee.to_email.value, miss_e)) 
  {
    alert("A dot or a @ is missing in your \"Email\" address.");
    document.formpresentee.to_email.focus();
    return (false);
  }

  if (document.formpresentee.val.value == "")
  {
    alert("Please insert an $ amount into \"Value\" .");
    document.formpresentee.to_val.focus();
    return (false);
  }

  if (! check_content(document.formpresentee.val.value, check_n)) 
  {
    alert("Please insert numbers into \"Value\" only.");
    document.formpresentee.val.focus();
    return (false);
  }

  if (! check_content(document.formpresentee.cardtext.value, check_a)) 
  {
    alert("Please insert characters, numbers, blanks and \"/()-\"-signs into \"Card Text\" only.");
    document.formpresentee.cardtext.focus();
    return (false);
  }

  return (true);
}

function check_address() 			// check the order form
{

  if (document.formaddress.from_fname.value == "")
  {
    alert("Please insert your first name into \"FirstName\" .");
    document.formaddress.from_fname.focus();
    return (false);
  }

  if (document.formaddress.from_fname.value.length < 2)
  {
    alert("Please insert min. two signs into \"First Name\" .");
    document.formaddress.from_fname.focus();
    return (false);
  }

  if (! check_content(document.formaddress.from_fname.value, check_a)) 
  {
    alert("Please insert characters, number or blanks into \"First Name\" only.");
    document.formaddress.from_fname.focus();
    return (false);
  }

  if (document.formaddress.from_lname.value == "")
  {
    alert("Please insert \"LastName\" ein.");
    document.formaddress.from_lname.focus();
    return (false);
  }

  if (document.formaddress.from_lname.value.length < 2)
  {
    alert("Please complete the question \"Last Name\" .");
    document.formaddress.lfrom_name.focus();
    return (false);
  }

  if (! check_content(document.formaddress.from_lname.value, check_a)) 
  {
    alert("Please insert characters, numbers or blanks into \"Last Name\" only.");
    document.formaddress.from_lname.focus();
    return (false);
  }

  if (! check_content(document.formaddress.from_hphone.value, check_a)) 
  {
    alert("Please insert characters, numbers, blanks and \"()/\"-signs into \"HomePhone\" only.");
    document.formaddress.from_hphone.focus();
    return (false);
  }

  if (! check_content(document.formaddress.from_wphone.value, check_a)) 
  {
    alert("Please insert characters, numbers, blanks and \"/()-\"-signs into \"WorkPhone\" only.");
    document.formaddress.from_wphone.focus();
    return (false);
  }

  if (document.formaddress.from_state.value == "")
  {
    alert("Please select your state from the list");
    document.formaddress.from_state.focus();
    return (false);
  }

  if (document.formaddress.from_address.value == "")
  {
    alert("Please insert \"Address\" .");
    document.formaddress.from_address.focus();
    return (false);
  }

  if (document.formaddress.from_address.value.length < 5)
  {
    alert("Please insert min. five signs into \"Address\" .");
    document.formaddress.from_address.focus();
    return (false);
  }

  if (! check_content(document.formaddress.from_address.value, check_a)) 
  {
    alert("Please insert characters, numbers, blanks and \"/()-\"-signs into \"Address\" only.");
    document.formaddress.from_address.focus();
    return (false);
  }

  if (document.formaddress.from_city.value == "")
  {
    alert("Please insert \"City\" .");
    document.formaddress.from_city.focus();
    return (false);
  }

  if (document.formaddress.from_city.value.length < 2)
  {
    alert("Please complete the question \"City\" ein.");
    document.formaddress.from_city.focus();
    return (false);
  }

  if (! check_content(document.formaddress.from_city.value, check_a)) 
  {
    alert("Please insert characters, numbers, blanks and \"()/-\"- signs into \"City\" only.");
    document.formaddress.from_city.focus();
    return (false);
  }

  if (document.formaddress.from_state.selectedIndex < 0)
  {
    alert("Pleae choose one of the \"State\"- options.");
    document.formaddress.from_state.focus();
    return (false);
  }

  if (document.formaddress.from_zip.value == "")
  {
    alert("Please insert \"Zip\" .");
    document.formaddress.from_zip.focus();
    return (false);
  }

  if (document.formaddress.from_zip.value.length < 4)
  {
    alert("Please complete the question \"Zip\" .");
    document.formaddress.from_zip.focus();
    return (false);
  }

  if (document.formaddress.from_zip.value.length > 8)
  {
    alert("Please insert max 8 signs into \"zip\" only");
    document.formaddress.from_zip.focus();
    return (false);
  }

  if (! check_content(document.formaddress.from_zip.value, check_a)) 
  {
    alert("Pleae insert characters or numbers into \"Zip\" only.");
    document.formaddress.from_zip.focus();
    return (false);
  }

  if (document.formaddress.from_email.value == "")
  {
    alert("Please insert \"Email\".");
    document.formaddress.from_email.focus();
    return (false);
  }

  if (document.formaddress.from_email.value.length < 4)
  {
    alert("Please complete the question \"Email\" .");
    document.formaddress.from_email.focus();
    return (false);
  }

  if (! check_content(document.formaddress.from_email.value, check_e)) 
  {
    alert("Please insert charcters, numbers, blanks and \"-_.@\"- signs into \"Email\" only.");
    document.formaddress.from_email.focus();
    return (false);
  }

  if (! check_miss(document.formaddress.from_email.value, miss_e)) 
  {
    alert("A dot or a @ is missing in your \"Email\" address.");
    document.formaddress.from_email.focus();
    return (false);
  }

  return (true);
}

function check_4()
{
  if( document.save_gc.agree.checked == false ) {
    alert("Sorry.\nYou have to agree to our business conditions,\notherwise we cannot accept your order.\n\nThank you");
    document.save_gc.agree.focus();
    return (false);
  }
  return (true);
}


function open_repres()
{
   document.getElementById("represwin").style.display = "block";
}
function close_repres() 
{
  document.save_gc.rep_name.value = document.formrepres.zrepname.value;
  document.getElementById("represwin").style.display = "none";
}

function open_friendwin()
{
   document.getElementById("friendwin").style.display = "block";
}
function close_friendwin() 
{
  document.save_gc.friendid.value = document.formfriend.zfriendid.value;
  document.getElementById("friendwin").style.display = "none";
}

function open_twitterwin()
{
   document.getElementById("twitterwin").style.display = "block";
}
function close_twitterwin() 
{
  document.save_gc.twitterid.value = document.formtwitter.ztwitterid.value;
  document.getElementById("twitterwin").style.display = "none";
}

function open_facebookwin()
{
   document.getElementById("facebookwin").style.display = "block";
}
function close_facebookwin() 
{
  document.save_gc.facebookid.value = document.formfacebook.zfacebookid.value;
  document.getElementById("facebookwin").style.display = "none";
}

