Typing test

by softwareinnovator

HTML

<form id="SearchForm" action="index.aspx">

  <table id="searchtable" border="0" cellpadding="4" cellspacing="4">
    <tbody>
      <tr>
        <td>
          <input id="EnglishText" name="EnglishText" tabindex="15" maxlength="100" type="text">
        </td>
        <td>
          <input id="SearchEnglishHTML" name="SearchEnglish" tabindex="17" value="Search" type="submit">
        </td>
      </tr>
      <tr>
        <td>
          <input id="AmharicText" name="AmharicText" style="font-family:Visual Geez Unicode" tabindex="16" maxlength="100" type="text">
        </td>
        <td>
          <input id="SearchAmharicHTML" style="font-family:Visual Geez Unicode" name="SearchAmharic" tabindex="18" value="ፈልግ" type="submit">
        </td>
      </tr>
    </tbody>
  </table>

</form>

JavaScript

// Copyright: (c) 2009 by SelamSoft Inc.
// Product title: Amharic Phonetic Typing Javascript
// Product version details: 2.1.0, 01-28-2009  Updated and tested on IE, Firefox, Opera, Safari and Google Chrome
// Product URL: http://www.amharicdictionary.com/js/amharictyping.js
// Contact info: [email protected]
// Notes: You are free to use this script on your website with the requirement that you 
//        link to www.AmharicDictionary.com on your site's front page. 
// Feel free to copy, use and change this script as long as this head part remains unchanged.  
// If you improve on this script, please send us your updates.


function getCursorPosition() {
  var range;
  range = document.selection.createRange();
  range.moveStart("Textedit", -1);
  return range.text.length;
};

function isRootLetter(amharicValue) {
  var isRoot = false;

  switch (amharicValue) {
    case 4629:
    case 4677:
    case 4741:
    case 4797:
    case 4813:
    case 4653:
    case 4845:
    case 4725:
    case 4901:
    case 4949:
    case 4661:
    case 4853:
    case 4941:
    case 4821:
    case 4877:
    case 4613:
    case 4869:
    case 4781:
    case 4621:
    case 4829:
    case 4933:
    case 4733:
    case 4717:
    case 4709:
    case 4765:
    case 4757:
    case 4637:
    case 4909:
    case 4637:
    case 4917:
    case 4669:
    case 4925:
    case 4645:
    case 4837:
    case 4637:
      {
        isRoot = true;
        break;
      }
  }
  return isRoot;
};

function withinRange(numValue) {
  if (numValue >= 4608 && numValue <= 4988) {
    return true;
  } else {
    return false;
  }
};

var getKeyCode = function (keyCodeString) {
    return keyCodeString.charCodeAt(keyCodeString.length - 1);
};

$(document).ready(function() {

  $("#AmharicText").keydown(
    function(event) {

//alert("keydown");
      //event.preventDefault();
    //return false;
    var press = jQuery.Event("keyup");
		//press.ctrlKey = false;
		press.which = event.which;
// ... any other...