function CheckLen(smsform,limit) { // Das neue Zählen + SMS zählen
  textcount = smsform.textcount;
  smscount = smsform.smscount;
  nachricht = smsform.nachricht;
  StrLen = nachricht.value.length;
  if(StrLen<=limit){
    smscount_value=1;
    zeichen_gesamt=limit;
  } else {
    StrLen-=3;
    smscount_value=Math.ceil(StrLen/(limit-9));
    zeichen_gesamt=smscount_value*(limit-9);
  }
  CharsLeft = zeichen_gesamt - StrLen;
  smscount.value=smscount_value;
  textcount.value=CharsLeft;
  if(smscount_value>10){
    smscount.value=10;textcount.value=0;
    alert('Sie können maximal 10 SMS\nam Stück verschicken!');
  }
}

function textCount(smsform,limit) {
  textcount = smsform.textcount;
  nachricht = smsform.nachricht;

  if (nachricht.value.length > limit) {
    nachricht.value = nachricht.value.substring(0, limit);
  } else {
    textcount.value = limit - nachricht.value.length;
  }
}
function freesms(phonebook) {
    var mobile, mobile_prefix, mobile_postfix, i;
    if (phonebook.options[phonebook.selectedIndex].value != "null") {
        document.SMS.rufnummer.value = phonebook.options[phonebook.selectedIndex].value;;
    }
}

function adressbuch(phonebook) { // Für Massen-SMS (Handynummern werden einer Textarea hinzugefügt)
    var mobile, mobile_prefix, mobile_postfix, i;
    if (phonebook.options[phonebook.selectedIndex].value != "null") {
        mobile = phonebook.options[phonebook.selectedIndex].value;
        document.SMS.rufnummer.value += mobile + ";";
    }
}

