function setPartnerSchool() {
var val=document.frm_register.selectPartnerSchool.options[document.frm_register.selectPartnerSchool.selectedIndex].value;

  if (val == 1){
    PartnerSchool.style.display = 'block';
    PartnerSchool2.style.display = 'none';
  }

  else if (val == 2){
    PartnerSchool2.style.display = 'block';
    PartnerSchool.style.display = 'block';
  }
  else {
    PartnerSchool.style.display = 'none';
    PartnerSchool2.style.display = 'none';
  }
}


function changeCountryCode() {
   var Wert = document.frm_register.CountryCode.value;
   document.frm_register.CountryCodeFax.value=Wert;
}


function changeAreaCode() {
   var Wert = document.frm_register.AreaCode.value;
   document.frm_register.AreaCodeFax.value=Wert;
}


function CheckLen(Target) {
 StrLen = Target.value.length
 if (StrLen == 1 && Target.value.substring(0,1) == " ") {
  Target.value = ""; StrLen = 0;
 }

 if (StrLen > 250 ) {
  Target.value = Target.value.substring(0,250);
   CharsLeft = 0;
 }
 else {
  CharsLeft = 250 - StrLen;
 }
}


function frm_register_validator(theForm)
{

  if (theForm.SchoolName.value == "")
  {
    alert("Please enter a value for field: \"School name\"");
    theForm.SchoolName.focus();
    return (false);
  }

  if (theForm.Street.value == "")
  {
    alert("Please enter a value for field: \"Street\"");
    theForm.Street.focus();
    return (false);
  }

  if (theForm.CityTown.value == "")
  {
    alert("Please enter a value for field: \"City/Town\"");
    theForm.CityTown.focus();
    return (false);
  }

  if (theForm.Country.selectedIndex < 0)
  {
    alert("Please select one of the \"Country\"-options.");
    theForm.Country.focus();
    return (false);
  }

  if (theForm.Country.selectedIndex == 0)
  {
    alert("The first \"Country\"-option is not a valid choice.\n Please select one of the other options.");
    theForm.Country.focus();
    return (false);
  }

  if (theForm.CountryCode.selectedIndex < 0)
  {
    alert("Please select one of the \"Country Code\"-options.");
    theForm.CountryCode.focus();
    return (false);
  }

  if (theForm.CountryCode.selectedIndex == 0)
  {
    alert("The first \"Country Code\"-option is not a valid choice.\n Please select one of the other options.");
    theForm.CountryCode.focus();
    return (false);
  }

  if (theForm.AreaCode.value == "")
  {
    alert("Please enter a value for field: \"Area Code\"");
    theForm.AreaCode.focus();
    return (false);
  }

  var checkOK = "0123456789-";
  var checkStr = theForm.AreaCode.value;
  var allValid = true;
  var validGroups = true;
  var decPoints = 0;
  var allNum = "";
  for (i = 0;  i < checkStr.length;  i++)
  {
    ch = checkStr.charAt(i);
    for (j = 0;  j < checkOK.length;  j++)
      if (ch == checkOK.charAt(j))
        break;
    if (j == checkOK.length)
    {
      allValid = false;
      break;
    }
    allNum += ch;
  }
  if (!allValid)
  {
    alert("Please enter only numeric characters in field \"Area Code\"");
    theForm.AreaCode.focus();
    return (false);
  }

  if (theForm.PhoneSchool.value == "")
  {
    alert("Please enter a value for field: \"Phone number / Ext.\"");
    theForm.PhoneSchool.focus();
    return (false);
  }

  var checkOK = "0123456789-";
  var checkStr = theForm.PhoneSchool.value;
  var allValid = true;
  var validGroups = true;
  var decPoints = 0;
  var allNum = "";
  for (i = 0;  i < checkStr.length;  i++)
  {
    ch = checkStr.charAt(i);
    for (j = 0;  j < checkOK.length;  j++)
      if (ch == checkOK.charAt(j))
        break;
    if (j == checkOK.length)
    {
      allValid = false;
      break;
    }
    allNum += ch;
  }
  if (!allValid)
  {
    alert("Please enter only numeric characters in field \"Phone number / Ext.\"");
    theForm.PhoneSchool.focus();
    return (false);
  }

  if (theForm.SchoolType1.selectedIndex < 0)
  {
    alert("Please select one of the \"Schooltype\"-options.");
    theForm.SchoolType1.focus();
    return (false);
  }

  if (theForm.SchoolType1.selectedIndex == 0)
  {
    alert("The first \"Schooltpye\"-option is not a valid choice.\n Please select one of the other options.");
    theForm.SchoolType1.focus();
    return (false);
  }

  if (theForm.Add.selectedIndex < 0)
  {
    alert("Please select one of the \"Form of address\"-options.");
    theForm.Add.focus();
    return (false);
  }

  if (theForm.Add.selectedIndex == 0)
  {
    alert("The first \"Form of address\"-option is not a valid choice.\n Please select one of the other options.");
    theForm.Add.focus();
    return (false);
  }

  if (theForm.FstName.value == "")
  {
    alert("Please enter a value for field: \"First name\"");
    theForm.FstName.focus();
    return (false);
  }

  if (theForm.Name.value == "")
  {
    alert("Please enter a value for field: \"Family name\"");
    theForm.Name.focus();
    return (false);
  }

  if (theForm.FunctionField.selectedIndex < 0)
  {
    alert("Please select one of the \"Function\"-options.");
    theForm.FunctionField.focus();
    return (false);
  }

  if (theForm.FunctionField.selectedIndex == 0)
  {
    alert("The first \"Function\"-option is not a valid choice.\n Please select one of the other options.");
    theForm.FunctionField.focus();
    return (false);
  }

  if (theForm.EmailContact.value == "")
  {
    alert("Please enter a value for field: \"E-mail address\"");
    theForm.EmailContact.focus();
    return (false);
  }

  if (theForm.EmailContact.value.length < 7)
  {
    alert("Enter a minimum of 7 characters in the field \"E-mail address\"");
    theForm.EmailContact.focus();
    return (false);
  }

  if (theForm.AgeOfPupils.selectedIndex < 0)
  {
    alert("Please select one of the \"Age of pupils\"-options.");
    theForm.AgeOfPupils.focus();
    return (false);
  }

  if (theForm.AgeOfPupils.selectedIndex == 0)
  {
    alert("The first \"Age of pupils\"-option is not a valid choice.\n Please select one of the other options.");
    theForm.AgeOfPupils.focus();
    return (false);
  }

  if (theForm.PartnersFound.selectedIndex < 0)
  {
    alert("Please select one of the \"Partners\"-options.");
    theForm.PartnersFound.focus();
    return (false);
  }

  if (theForm.PartnersFound.selectedIndex == 0)
  {
    alert("The first \"Partners\"-option is not a valid choice.\n Please select one of the other options.");
    theForm.PartnersFound.focus();
    return (false);
  }

  if (theForm.ThemeKeyword.value.length > 250)
  {
    alert("Enter a maximum of 250 characters in the field \"Preferences\"");
    theForm.ThemeKeyword.focus();
    return (false);
  }

  if (theForm.TimeInfo.value.length > 250)
  {
    alert("Enter a maximum of 250 characters in the field \"Communication\"");
    theForm.TimeInfo.focus();
    return (false);
  }

  if (theForm.AdditionalInformation.value.length > 250)
  {
    alert("Enter a maximum of 250 characters in the field \"Teams situation\"");
    theForm.AdditionalInformation.focus();
    return (false);
  }
  return (true);
}