//  Farsi
//  Transscription von HoWa-Umschrift nach Unicode-HTML
//  Aufruf-Beispiel:  (folgt noch)

     var wordy = false;
//  var inRec = "";


  /************************************************************************/
  /*Stand : 20.01.1986                                                    */
  /************************************************************************
   *                                                                      *
   *     Auswahl der kontextabhängigen Buchstabenform für die             *
   *     in eigener Umschrift als ein Satz übergebenen Persischen         *
   *     Zeichen und deren Umwandlung in Symbol - Kennziffern.            *
   *                                                                      *
   ************************************************************************
   ***********************************************************************
     No.  Letter     Transcription     Entry in
                                    SubSymbol table
   ***********************************************************************
      1  alef           A+              1
      2  be             B               5
      3  pe             P               9
      4   te            T              13
      5   se            S-             17
      6   jim           J              21
      7   cim           C              25
      8   hhe           H+             29
      9   xe            X              33
     10   daal          D              37
     11   zaal          Z+             41
     12   dje           J+             45
     13   re            R              49
     14   ze            Z              53
     15   ssin          S              57
     16   schin         S/             61
     17   saad          S+             65
     18   zaad          Z-             69
     19   tejn          T/             73
     20   zejn          Z/             77
     21   ejn           !+             81
     22   ghein         G+             85
     23   fe            F              89
     24   ghaaf         Q              93
     25   kaaf          K              97
     26   gaaf          G             101
     27   laam          L             105
     28   mim           M             109
     29   nun           N             113
     30   waaw          U             121
     31   he            H             117
     32   ja            I             125
     33   fathe         A             129
     34   kasre         E             133
     35  zamme          O             137
     36  sokun          Y             145
     37  hamze          !             141
     38  Tajdid         V             153
     39  Punkt          .             158
     40  Komma          ,             157
     41  FrageSymbol    ?             159
     42  KlammerAuf     )             163
     43  KlammerZu      (             162
     44  DoppelPunkt    :             161
     45  Ampersand      &             165
     46  Star           *             164
     47  Zero           0             166
     48  One            1             167
     49  Two            2             168
     50  Three          3             169
     51  Four           4             170
     52  Five           5             171
     53  Six            6             172
     54  Seven          7             173
     55  Eight          8             174
     56  Nine           9             175
     57  nuuaan         N+            149
     58  heaat          H/            177
     59  jaaat          I+            181
     60  Blank          _             160
     61  Plus           +             190
     62  Slash          /             189
     63  Minus          -             191
     64  newline        nl            192
     65  carrage return cr            193
   *********************************************************************/

  var
      alef = 0,
      be = 1,
      pe = 2,
      te = 3,
      se = 4,
      jim = 5,
      cim = 6,
      hhe = 7,
      xe = 8,
      daal = 9,
      zaal = 10,
      dje = 11,
      re = 12,
      ze = 13,
      ssin = 14,
      schin = 15,
      saad = 16,
      zaad = 17,
      tejn = 18,
      zejn = 19,
      ejn = 20,
      ghein = 21,
      fe = 22,
      ghaaf = 23,
      kaaf = 24,
      gaaf = 25,
      laam = 26,
      mim = 27,
      nun = 28,
      waaw = 29,
      he = 30,
      ja = 31,
      fathe = 32,
      kasre = 33,
      zamme = 34,
      sokun = 35,
      hamze = 36,
      Tajdid = 37,
      Punkt = 38,
      Komma = 39,
      FrageSymbol = 40,
      KlammerAuf = 41,
      KlammerZu = 42,
      DoppelPunkt = 43,
      Ampersand = 44,
      Star = 45,
      Zero = 46,
      One = 47,
      Two = 48,
      Three = 49,
      Four = 50,
      Five = 51,
      Six = 52,
      Seven = 53,
      Eight = 54,
      Nine = 55,
      nuuaan = 56,
      heaat = 57,
      jaaat = 58,
      Blank = 59,
      Plus = 60,
      Slash = 61,
      Minus = 62,
      nl    = 63,
      cr    = 64;

  var Transcript = new Array (
      "A+", "B",  "P",  "T",  "S-", "J",  "C",  "H+", "X",  "D" ,
      "Z+", "J+", "R",  "Z",  "S",  "S/", "S+", "Z-", "T/", "Z/",
      "!+", "G+", "F",  "Q",  "K",  "G",  "L",  "M",  "N",  "U" ,
      "H",  "I",  "O",  "A",  "E",  "V",  "!",  "Y",  ".",  "," ,
      "?",  ")",  "(",  ":",  "&",  "*",  "0",  "1",  "2",  "3" ,
      "4",  "5",  "6",  "7",  "8",  "9",  "N+", "H/", "I+", " " ,
      "+",  "/",  "-",  "\n", "\r");

  var HTML = new Array (
  "1575", "1576", "1662", "1578", "1579", "1580", "1670", "1581", "1582", "1583",
  "1584", "1688", "1585", "1586", "1587", "1588", "1589", "1590", "1591", "1592",
  "1593", "1594", "1601", "1602", "1705", "1711", "1604", "1605", "1606", "1608",
  "1607", "1740", "1615", "1614", "1616", "1618", "1612", "1617", "0046", "1548",
  "1567", "0041", "0040", "0058", "1563", "1645", "1632", "1633", "1634", "1635",
  "1636", "1637", "1638", "1639", "1640", "1641", "0000", "1577", "1610", "0160",
  "0043", "0047", "1600", "<br>", "<br>");

  var maxOutSentLen = 512;
  var outRec = new Array (maxOutSentLen);
  var PreLinked  = new Array (maxOutSentLen);
  var PostLinked  = new Array (maxOutSentLen);


  var Normal =
      "@BPT@JC@XD@@RZS@@@@@@@FQKGLMNUHIOAEV!Y.,?)(:&*0123456789@@_ +/-\n\r";
  var PrePlus = "AHZJS!GNI";
  var PreMinus = "SZ";
  var PreSlash = "STZH";
  var AuxVoc = "OAE";
  var PrePlusSubst = new Array (
      alef, hhe, zaal, dje, saad, ejn, ghein, nuuaan, jaaat);
  var PreMinusSubst = new Array (
      se, zaad);
  var PreSlashSubst = new Array (
      schin, tejn, zejn, heaat);
  var NormalSubst = new Array (
      alef, be, pe, te, se, jim, cim, hhe, xe, daal, zaal, dje, re, ze,
      ssin, schin, saad, zaad, tejn, zejn, ejn, ghein, fe, ghaaf, kaaf,
      gaaf, laam, mim, nun, waaw, he, ja, fathe, kasre, zamme, sokun,
      hamze, Tajdid,
      Punkt, Komma, FrageSymbol, KlammerAuf, KlammerZu, DoppelPunkt,
      Ampersand, Star,
      Zero, One, Two, Three, Four, Five, Six, Seven, Eight, Nine,
      nuuaan, heaat, jaaat,
      Blank, Plus, Slash, Minus, nl, cr);
  var AuxVocals = new Array (
      fathe, kasre, zamme, sokun, hamze, Tajdid);
  var Connectabels = new Array (
      be, pe, te, se, jim, cim, hhe, xe, ssin, schin, saad, zaad, tejn, zejn,
      ejn, ghein, fe, ghaaf, kaaf, gaaf, laam, mim, nun, he, ja);
  var NonConnectabels = new Array (
      alef, daal, zaal, dje, re, ze, waaw, nuuaan, heaat, jaaat, fathe, kasre,
      zamme, sokun, hamze, Tajdid);
  var Separators = new Array (
      Punkt, Komma, FrageSymbol, KlammerAuf, KlammerZu, DoppelPunkt,
      Ampersand, Star, Blank, Plus, Slash, Minus, nl, cr);
  var Digits = new Array (
      Zero, One, Two, Three, Four, Five, Six, Seven, Eight, Nine);

  var iIn = 0;
  var iOut = 0;

  var input = ""; // internal input buffer

  var htmlFlag = false;

//  ----------------------------------------------------------------------------
  function In (c,s) {
    var i = 0;
    for (i = 0; i < s.length; i++) {
      if (c == s.charAt(i))
        return true;
    }
    return false;
  }

//  ----------------------------------------------------------------------------
  function In2(l, js) {
    var i = 0;
    for (i = 0; i < js.length; i++) {
      if (l == js[i])
        return true;
    }
    return false;
  }

//  ----------------------------------------------------------------------------
  function toString () {
    s = "";
    var i = 0;
    if (iOut > 0) {
      for (i = 0; i < iOut; i++) {
        s = s + Transcript [outRec[i]];
      }
    }
    return s;
  }

//  ----------------------------------------------------------------------------
  function toHTML () {
    var wordy = false;
    var s = "";
	var c = "", tc ="";
    var i = 0;
    if (iOut > 0) {
        for (i = 0; i < iOut; i++) {
			c = HTML[outRec[i]];
			if (c.charAt(0) == "<") 
			  s +=c;
			else
			  s += "&#" + c + ";";
      }
    }
    if (wordy) alert ("toHTML (): s="+s);
    return s;
  }

//  ----------------------------------------------------------------------------
  function toHTMLCode () {
    var wordy = false;
    var s = "";
	var c = "", tc ="";
    var i = 0;
    if (iOut > 0) {
        for (i = 0; i < iOut; i++) {
			c = HTML[outRec[i]];
			if (c.charAt(0) == "<") 
			  s +=c;
			else
			  s += "&amp;#" + c + ";";
      }
    }
    if (wordy) alert ("toHTML (): s="+s);
    return s;
  }

//  ----------------------------------------------------------------------------
  function toCharCode () {
    var wordy = false;
    var s = "";
	var c = "", tc ="";
    var i = 0;
    if (iOut > 0) {
        for (i = 0; i < iOut; i++) {
			c = HTML[outRec[i]];
			if (c.charAt(0) =="<") 
			  s +=Transcript [outRec[i]];
			else
              s += String.fromCharCode(c);
      }
    }
    if (wordy) alert ("toCharCode (): s="+s);
    return s;
  }

//  ----------------------------------------------------------------------------
  function InvertDigitStrings(inRec) {
    var wordy = false;
    var 
        alpha = 0,
        digit = 1,
        i = 0,
        LetterType = alpha,//  LetterTypeType = (Alpha,Digit);
        sTmp = "",
        sDigit = "";
        
    while (i < String(inRec).length) {
      if (!In(inRec.charAt(i), "0123456789")) { // alpha-chars found
        if (LetterType == digit) {
          LetterType = alpha;
          sTmp = sTmp + sDigit;
          sDigit = "";
        }
        sTmp += inRec.charAt(i);
      }
      else { // digits found
        if (LetterType == alpha) {
          LetterType = digit;
        }
        sDigit = inRec.charAt(i) + sDigit;
      }
      i++;
    }
    if (LetterType == digit) {
      LetterType = alpha;
      sTmp = sTmp + sDigit;
      sDigit = "";
    }

    if (wordy) alert("### InvertDigitStrings: "+inRec+"  -->  "+sTmp);
    return sTmp;
  }

//  ----------------------------------------------------------------------------
  function GetSimpleSymbol (c) {
    return ((Normal.indexOf(c) >= 0) ? NormalSubst[Normal.indexOf(c)] : Blank);
  }

//  ----------------------------------------------------------------------------
  function OneLetterSymbol(inRec) {
    var wordy = false;
    var c = GetSimpleSymbol (inRec.charAt(iIn++));
    if (In2(c, AuxVocals)) {
      if (iOut==0) {
        if (wordy) alert (0+" = "+Transcript[0]+", "+c+" = "+Transcript[c]+" ...");
        outRec[iOut++] = 0;}
      else {
        if (In2 (outRec [iOut-1], Separators)) {
          if (wordy) alert (outRec [iOut-1]+" = "+Transcript[outRec [iOut-1]]+", "+0+" = "+Transcript[0]+", "+c+" = "+Transcript[c]+" ...");
          outRec[iOut++] = 0;
        }
      }
    }
    outRec[iOut++] = c;
    if (wordy) alert("OneLetterSymbol: '"+outRec[iOut-1]+" = "+Transcript [outRec[iOut-1]]+"'");
  }

//  ----------------------------------------------------------------------------
  function PutSymbols(c1, c2, set, subst) {
    var wordy = false;
    var iFound = set.indexOf(c1);
    if (iFound >= 0) {
      outRec[iOut++] = subst[iFound];
      if (wordy)
        alert(Transcript["PutSymbols :"+outRec[iOut - 1]]);
    }
    else {
      outRec[iOut++] = GetSimpleSymbol(c1);
      if (wordy)
        alert("PutSymbols :"+Transcript[outRec[iOut - 1]]);
      outRec[iOut++] = GetSimpleSymbol(c2);
      if (wordy)
        alert("PutSymbols :"+Transcript[outRec[iOut - 1]]);
    }
  }

//  ----------------------------------------------------------------------------
  function TwoLetterSymbol(inRec) {
    var wordy = false;
    var c1 = inRec.charAt(iIn++);
    var c2 = inRec.charAt(iIn++);
    if (wordy) alert("TwoLetterSymbol() "+c1+c2);
    switch (c2) {
      case '+': PutSymbols (c1, c2, PrePlus, PrePlusSubst); break;
      case '-': PutSymbols (c1, c2, PreMinus, PreMinusSubst); break;
      case '/': PutSymbols (c1, c2, PreSlash, PreSlashSubst); break;
      default: {
        alert("### Error: TwoLetterSymbol ()= "+c1+c2);
      }
    }
  }

//  ----------------------------------------------------------------------------
  function DubbleToTajdid() {
    var wordy = false;
    var i = 0;
    if (wordy) alert("DubbleToTajdid () iOut = "+iOut);
    if (iOut > 0) {
      for (i = 1; i < iOut; i++) {
        if (outRec[i]== outRec[i-1]) {
          outRec[i]= Tajdid;
          if (wordy) System.out.print(">");
        }
        if (wordy) alert(i+": "+outRec[i]);
      }
    }
  }

//  ----------------------------------------------------------------------------
  function RecognizeSymbols(inRec ) {
    var wordy = false;
    if (wordy)
      alert("RecognizeSymbol(" + inRec + ") ...");
    iIn = 0;
    iOut = 0;
    while (iIn < inRec.length) {
      if (iIn == inRec.length-1) {
        OneLetterSymbol(inRec);
      }
      else {
        if (In(inRec.charAt(iIn + 1), "+" + "-" + "/")) {
          TwoLetterSymbol(inRec);
        }
        else {
          OneLetterSymbol(inRec);
        }
      }
    }
    if (wordy) alert();
//    DubbleToTajdid();
    if (wordy) {
      for (i = 0; i < iOut; i++) {
//        alert(i + ": " + Transcript[outRec[i]]);
        alert(i + ": " + outRec[i]);
      }
    }
    if (wordy) alert();
 }

//  ----------------------------------------------------------------------------
 function ConnectedToFront(i) {
    var wordy = false;
    if (wordy)
      alert("ConnectedToFront(" + i + ") ...");
    if (i < 1) {
      return false;
    }
    else {
      if ((In2(outRec[i], Separators)) ||
          (In2(outRec[i], Digits))) {
        return false;
      }
      else {
        if (In2(outRec[i-1], AuxVocals)) {
          return ConnectedToFront(i-1);
        }
        else {
          if (In2(outRec[i-1], Connectabels)) {
            return true;
          }
          else {
            return false;
          }
        }
      }
    }
  }

//  ----------------------------------------------------------------------------
  function ConnectedAuxVocalForm(i) {
    var wordy = false;
    if (wordy) alert("ConnectedAuxVocalForm("+i+") ...");
    if (i < 1) {
      return false;
    }
    else {
      if (In2(outRec[i], AuxVocals)) {
        if ((In2(outRec[i-1], Connectabels)) ||
            (In2(outRec[i-1], NonConnectabels))) {
          return true;
        }
        else {
          return false;
        }
      }
      else {
        return false;
      }
    }
  }

//  ----------------------------------------------------------------------------
  function ConnectedToBack(i, m) {
    var wordy = false;
    if (wordy)
      alert("ConnectedToBack(" + i + ", " + m + ") ...");
    if (i == m) {
      return false;
    }
    else {
      if (In2(outRec[i], Connectabels) ||
          In2(outRec[i], AuxVocals)) {
        if (In2(outRec[i + 1], Digits) ||
            In2(outRec[i + 1], Separators)) {
          return false;
        }
        else {
          if (In2(outRec[i + 1], AuxVocals)) {
            return ConnectedToBack(i + 1, m);
          }
          else {
            return true;
          }
        }
      }
      else {
        return false;
      }
    }
  }

 //  ---------------------------------------------------------------------------
 function RecognizeKontext() {
    var wordy = false;
    if (wordy) alert("RecognizeKontext() ...");
    for (i = 0; i < iOut; i++) {
      PreLinked [i] = (ConnectedToFront(i) || (ConnectedAuxVocalForm(i)));
      PostLinked [i] = ConnectedToBack(i, iOut-1);
    }
    if (wordy) {
      for (i = 0; i < iOut; i++) {
        alert(i+": "+Transcript [outRec[i]]+(PreLinked [i]? " < ": "   ")+(PostLinked [i]? " > ": "   "));
      }
    }
  }

//  ------------------------------------------------------------

function writeText (text) {
  parent.frames[1].document.open();
  parent.frames[1].document.writeln('<!doctype html public "-//w3c//dtd html 4.0 transitional//en">');
  parent.frames[1].document.writeln('<HTML>');
  parent.frames[1].document.writeln('<head>');
  parent.frames[1].document.writeln('  <meta name="GENERATOR" content="hand coded by Horst Walther">');
  parent.frames[1].document.writeln('  <title>Horst Walther -  Farsi-Text</title>');
  parent.frames[1].document.writeln('  <link rel="stylesheet" href="http://www.horst-walther.de/style/privat.css"  type="text/css">');
  parent.frames[1].document.writeln('  <link rev="OWNER" href="mailto:mail@Horst-Walther.de">');
  parent.frames[1].document.writeln('</head>');
  parent.frames[1].document.writeln('<body LANG="DE">');
  parent.frames[1].document.writeln('<h2 align="center">'+text+'</h2>');
  parent.frames[1].document.writeln('</body>');
  parent.frames[1].document.writeln('</HTML>');
  parent.frames[1].document.close();
}

//  ------------------------------------------------------------

function setFarsi(inText, outElement) {
    var wordy = false;
  document.getElementById(outElement).innerHTML += inText;
  if (wordy) alert ("setFarsi ("+inText+", "+outElement+")");
}

//  ------------------------------------------------------------
 function transcribe (inRec) {
    var wordy = false;
//    if (wordy) alert("PersEval("+inRec+") ...");
    RecognizeSymbols(InvertDigitStrings(String(inRec).toUpperCase()));
//    if (wordy) alert("PersEval("+inRec+") --> "+toHTML());
    return (toHTML());
//    RecognizeKontext();
  }; // transcribe

//  ------------------------------------------------------------

function transcribiere (inRec, outElement) {
  var wordy = false;
  if (wordy) alert("PersEval("+inRec+") ...");
  RecognizeSymbols(InvertDigitStrings(String(inRec).toUpperCase()));
  if (wordy) alert("PersEval("+inRec+") --> "+toHTML());
//  setFarsi(toCharCode(), outElement);
//  setFarsi(toHTML(), outElement);
  if (htmlFlag) 
    document.getElementById(outElement).innerHTML += toHTMLCode();
  else
    document.getElementById(outElement).innerHTML += toHTML();
//  RecognizeKontext();
}

//  ------------------------------------------------------------

function setWindowName (n) {
//  if (wordy) alert ("parent.name.length="+parent.name.length+", parent.name="+parent.name);
//  if (parent.name.length == 0) {
    window.name = parent.name;
//    if (wordy) alert ("in setWindowName gesetzt:"+parent.name);
//  }
  return window.name;
}


//  ------------------------------------------------------------
function makeWindow (title, wWidth, wHeight) {
  var xPos = 0.5*screen.availWidth-0.5*wWidth;
  var yPos = 0.5*screen.availHeight-0.5*wHeight;
  var features = "width="+wWidth+", height="+wHeight+", left="+xPos+", top="+yPos+", resizable=1";
  /*alert ('wWidth = '+wWidth);
  alert ('wHeight = '+wHeight);
  alert ('xPos = '+xPos);
  alert ('yPos = '+yPos);
  alert ('title = '+title);
  alert ('features = '+features);*/
  return window.open("", "", features);
}

//  ------------------------------------------------------------
function makeMaxWindow(title) {
  return makeWindow(title, screen.availWidth, screen.availHeight)
}

//  ------------------------------------------------------------
function makeHalfWindow(title) {
  return makeWindow(title, screen.availWidth*0.5, screen.availHeight*0.5)
}

//  ------------------------------------------------------------
function printFarsi(persText) {
  var w = makeHalfWindow("HoWa");
  var d = w.document; // Hole das Document-Objekt des neuen Fensters
  d.writeln('<!DOCTYPE HTML PUBLIC "-//w3c//dtd html 4.01 transitional//en">');
  d.writeln('');
  d.writeln('<html>');
  d.writeln('<head>');
  d.writeln('  <META NAME="Generator" CONTENT="hand coded by Horst Walther">');
  d.writeln('  <meta name="Author" content="Dr. Horst Walther">');
  d.writeln('  <meta name="Publisher" content="Dr. Horst Walther">');
  d.writeln('  <meta name="Copyright" content="2007, Dr.Horst Walther">');
  d.writeln('  <meta name="Page-topic" content="private life">');
  d.writeln('  <meta name="Audience" content="All">');
  d.writeln('  <meta name="Content-language" content="DE">');
  d.writeln('  <meta name="Page-type" content="personal stories">');
  d.writeln('  <meta name="description" content="Farsi text created with the help of http://www.horst-walther.de/">');
  d.writeln('  <meta name="keywords" content="Farsi, Persian, Persisch, Orientalistik, Deutsch-Persisch, Persisch-Deutsch, Iran">');
  d.writeln('  <meta name="robots" content="INDEX,FOLLOW">');
  d.writeln('  <meta name="revisit-after" content="7 days">');
  d.writeln('  <meta name="distribution" content="global">');
  d.writeln('  <title>Horst Walthers Farsi-print</title>');
  d.writeln('  <link rel="stylesheet" href="http://www.horst-walther.de/style/privat.css"  type="text/css">');
  d.writeln('</head>');
  d.writeln('');
  d.writeln('<body lang="de">');
  d.writeln('  <hr />');
  d.writeln('  <p  style="{margin-right:10px; text-align: right; direction:rtl;font-size:16pt;}">'+persText+'</p>');
  d.writeln('  <hr />');
  d.writeln('  <p align="right" style="font-size:8pt">Horst Walther, Hamburg, '+makeTime()+'</p>');
  d.writeln('');
  d.writeln('</body>');
  d.writeln('</html>');
  d.close ();
  w.print(); 
}

//  ------------------------------------------------------------
function sendFarsi(persText) {
  var w = makeHalfWindow("Farsi send");
  var d = w.document; // get the Document-Object of the new window
  var email = "name@domain.tld";
  d.writeln('<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">');
  d.writeln('<html>');
  d.writeln('<head>');
  d.writeln('  <meta name="generator" content="hand coded by Horst Walther">');
  d.writeln('  <title>Horst Walther - send Farsi page</title>');
  d.writeln('  <link rel="stylesheet" href="http://www.horst-walther.de/style/privat.css" type="text/css">');  
  d.writeln('  <link rev="owner" href="mailto:mail@horst-walther.de">');
  d.writeln('</head>');
  d.writeln('<body>');
  d.writeln('  <h3 align="center">send the results to a friend (or yourself)</h3>'); 
  d.writeln('  <hr align="center" width="80%">');
  d.writeln('  <p align="center">note please: text-length may be limited due to browser restrictions (resulting in a misleading error-message)</p>');
  d.writeln('  <p class="plainlink"><a class="menueItem" href="mailto:'+email+'?subject=HoWa-Farsi-Text&amp;body='+persText+'" onClick="javascript:self.close()">send</a></p>'); 
  d.writeln('</body>');
  d.writeln('</html>');
  d.close ();
}

//  ------------------------------------------------------------
function persprint() {
  window.print();
}

//  ------------------------------------------------------------
function persclose() {
  window.close();
}

//  ------------------------------------------------------------
function setFocus(focus) {
  document.getElementById(focus).focus();
}
	  
//  ------------------------------------------------------------
function findIndex (c) {
  for (i=0; i <= HTML.length; i++) {
    if (c == String.fromCharCode(HTML[i])) return i;
  }
//  alert ("character :("+c+") not found");
  return 0;
}

//  ------------------------------------------------------------
function delKey() {
  alert("'del' not yet implemented");
}

//  ------------------------------------------------------------
function insert() {
  alert("'ins' not yet implemented");
}

//  ------------------------------------------------------------
function forward() {
  alert("'->' not yet implemented");
}

//  ------------------------------------------------------------
function back() {
  alert("'<-' not yet implemented");
}

//  ------------------------------------------------------------
function setKey(ch) {
  setFocus("farsi");
  var word = document.getElementById("farsi");
  word.innerHTML += ch;
  word.style.direction = "rtl";
  input += Transcript [findIndex (ch)];
//  setFocus("toggle");
}