// FingerSpell FlashCards Letter and Alphabet Functions // Copyright (c) 2008 Peter Stevens, some rights reserved // Licensed under a Creative Commons Attribution-Noncommercial-No Derivative Works License. // // double letter (e.g. ee in "need") are recognized // shortcuts up to three letters (sch, did) can be recognized, but doubles // of shortcuts are not recognized // // an alphabet needs // letters a-z and special chars (e.g. ö, ü) in jpg format // composite letter z-0.jpg, z-1.jpg... // double letters aa-0.jpg, aa-1.jpg // blank.jpg // create function (analog ASLAlphabet) - customized per language // controllers must be adapted as well. // // function debugmsg(msg){ tn = document.createTextNode(msg + "\n" ); el=document.getElementById("debug"); el.appendChild(tn); //alert (msg); } // ww = document.getElementById("titlebar"); debugmsg("Show - Start, cnt = " + Discover(ww)); function Discover (obj ){ cnt = 0; for ( i in obj ){ cnt++; } return cnt; } function fDefined ( obj ) { return ( typeof(obj) != "undefined" ); } function mouseOverHandler(e){ var targ; var parent; if (!e) { var e=window.event; } if (e.target) { targ=e.target; } else if (e.srcElement) { targ=e.srcElement; } if (targ.nodeType==3) { // defeat Safari bug targ = targ.parentNode; } var tname; /* if clicking on a link, get parent div */ tname=targ.tagName; // debugmsg ("MouseHandler: tagName = '" + targ.tagName + "', id = '" + targ.id +"'"); showPicForLetter(targ.id); } function showPicForLetter(i){ // sl is a signed letter (possibly a composite letter) // alphabet is an ASL, DSGS- or whatever structure if ( glob.st.fMouseOverActive) { glob.st.highlight(i) sl = glob.st.tSignedLetters[i]; sl.Display(glob.speed); } } function ShowText () { // displays clickable letters as text as they are output, this.reset=function(){ this.el=document.getElementById("spelledOut"); this.el.innerHTML=""; this.tSignedLetters = new Object(); this.itSL = 0; this.iCur = 0; } this.addCh=function(sl){ el = document.createElement("div"); el.className = "spelled"; tn = document.createTextNode(sl.text); el.appendChild(tn); el.onmouseover=mouseOverHandler; el.setAttribute("id",this.itSL ); this.el.appendChild(el); this.highlight(this.itSL); this.tSignedLetters[this.itSL++]=sl; } this.highlight=function(itSL){ this.clearHighlight(); this.iCur = itSL; el=document.getElementById(this.iCur ); el.className=glob.st.activatedClassName ; } this.clearHighlight=function(){ el=document.getElementById(this.iCur ); el.className=this.normalClassName ; } this.activateMouseOver=function(){ this.fMouseOverActive=1; } this.deactivateMouseOver=function(){ this.fMouseOverActive=0; } this.hide=function(){ this.fHidden=1; this.el.style.display="none"; } this.unhide=function(){ this.fHidden=0; this.el.style.display=""; } this.normalClassName = "spelled" ; this.activatedClassName = "activated spelled" ; this.deactivateMouseOver(); this.reset(); } function finishShow ( ) { glob.sl = glob.ls.alphabet["ww-blank"] ; glob.sl.Display(glob.speed); glob.st.activateMouseOver(); glob.st.clearHighlight(); } function Show ( ls ) { glob.ls = ls ; glob.ch = glob.ls.getCh(); glob.st.deactivateMouseOver(); if ( glob.ch ) { glob.sl = glob.ls.alphabet[glob.ch] ; RealShow(); } else { finishShow(); } } function RealShow () { //if browser does not support the image object, exit if (!document.images) { return; } if ( glob.ch ) { glob.sl = glob.ls.alphabet[glob.ch] ; glob.sl.prefetch(); if ( glob.sl.fLoaded() ) { glob.sl.Display(glob.speed); glob.st.addCh(glob.sl); setTimeout("RealShow()",glob.speed * glob.sl.duration); // when to show next character glob.ch = glob.ls.getCh(); } else { setTimeout("RealShow()",glob.speed * glob.sl.duration); // when to show next character } } else { finishShow(); } } function LetterSequence ( text, alphabet ) { // debugmsg(text); this.text = text.toLowerCase(); this.alphabet = alphabet; this.step = 0; this.setText=function(text){ this.text = text.toLowerCase(); } this.getCh=function(){ len=3; defaultch=" "; nil = 0; remaining = this.text.length-this.step ; len = Math.min ( len, remaining ); len = Math.max ( len, 0 ); if ( len == 0 ) { return nil; } while ( len > 1 ) { ch = this.text.substr(this.step, len) ; if ( fDefined(this.alphabet[ch] ) ) { this.step += len; return ( ch ) ; } len--; } ch = this.text.charAt(this.step); this.step = Math.min(this.step+1,this.text.length); if ( !fDefined(this.alphabet[ch] ) ) { debugmsg("glob.ls.alphabet[" + ch + "] is undefined " ); return nil; } return ch; } } function SignedLetter( text, lang, filename ) { this.text = text; if ( ! filename ) { filename = text + text }; this.filename = filename ; this.Language = lang; this.duration = 1; var imgf = this.ImageFile() ; this.pic = new Image(); this.pic.title = text ; } SignedLetter.prototype.ImageFile=function(){ slash="/"; dash="-"; n = 0; ret = ""; if ( fDefined(glob.imageHome ) ) { ret = glob.imageHome; } ret += slash + "abcs" + slash + this.Language + slash + this.filename + dash + n + ".jpg"; return ret; } SignedLetter.prototype.prefetch=function(){ if (!fDefined(this.image) ) { var imgf = this.ImageFile() ; this.pic = new Image(); this.pic.src = imgf ; } } SignedLetter.prototype.fLoaded=function(){ if (fDefined(this.pic) ) { return this.pic.complete ; } else { return 0; } } SignedLetter.prototype.Display=function(speed){ var imgf = this.ImageFile() ; this.pic.src = imgf ; document.images.slide.src=imgf ; document.images.slide.title=this.text ; } function CompositeLetter( text, lang , cnt, filename ) { // cnt is the number of images required to display the letter // images are named x-0.jpg, x-1.jpg,... x-cnt-1.jpg // all files must exist this.text = text; if ( ! filename ) { filename = text }; this.filename = filename; this.Language = lang; this.imageCnt = cnt; this.duration = 1; this.pic = new Object(); for ( i = 0; i< cnt; i++ ) { imgf = this.ImageFile(i) ; this.pic[i] = new Image(); } } CompositeLetter.prototype.ImageFile=function(n){ // n is which image you want if ( n < this.imageCnt ) { slash="/"; dash="-"; ret=""; if ( fDefined(glob.imageHome ) ) { ret = glob.imageHome; } ret += slash + "abcs" + slash + this.Language + slash + this.filename + dash + n + ".jpg"; // debugmsg("ImageFile returning " + ret); return ret; } else { // debugmsg("ImageFile returning 0"); return 0; } } CompositeLetter.prototype.prefetch=function(){ cnt = this.imageCnt ; for ( i = 0; i< cnt; i++ ) { imgf = this.ImageFile(i) ; this.pic[i] = new Image(); this.pic[i].src = imgf ; } } CompositeLetter.prototype.fLoaded=function(){ cnt = this.imageCnt ; result = 1; i = 0; while ( i < cnt && result ) { // alert( "defined(Pic[" + i + "]) = " + fDefined(this.pic[i].src) ); result = result && this.pic[i].complete; i++; } return result; } CompositeLetter.prototype.Display=function(speed){ // display the first slide var imgf = this.ImageFile(0) ; document.images.slide.src=imgf ; document.images.slide.title=this.text ; // distribute remaining images: x-0 x-1 ... delta = ( speed * this.duration ) / ( this.imageCnt + 1 ); cumDelta = delta; quote='"'; for ( cnt = 1; cnt < this.imageCnt; cnt++ ) { imgf = this.ImageFile(cnt) ; cmd = "document.images.slide.src=" + quote+ imgf + quote; this.pic[cnt].src = imgf ; setTimeout(cmd,cumDelta) ; cumDelta += delta; } } function ASLAlphabet(){ // anthing with a name up to three characters is considered a signed letter var Letters = [ "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z"]; var tCompositeLetters = [ "j", "z" ]; var tSecondLetters = [ "a", "b", "c", "d", "e", "f", "g", "h", "i", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y" ]; var lang = "ASL"; this.text="American Sign Language"; this.list=function(){ return "abcdefghijklmnopqrstuvwxyz"; } for (var l in Letters ) { ndx = Letters[l]; var ll = new SignedLetter(Letters[l], lang); this[ndx] = ll; } for (var itSL in tSecondLetters ) { ndx = tSecondLetters[itSL]; ndx += ndx; var ll = new CompositeLetter(ndx, lang, 2); ll.duration = 2; this[ndx] = ll; } this["j"]=new CompositeLetter("j", lang, 3); this["z"]=new CompositeLetter("z", lang, 4); var spc = "space"; this[" "]=new SignedLetter("_",lang, spc); this["."]=new SignedLetter(spc,lang,spc); this["\n"]=new SignedLetter(spc,lang,spc); this["-"]=new SignedLetter(spc,lang,spc); this["ww-blank"]=new SignedLetter("blank",lang,"blank"); } function DSGSAlphabet(){ // anthing with a name up to three characters is considered a signed letter var Letters = [ "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z", "ch", "sch" ]; var tCompositeLetters = [ "j", "ä", "ö", "u", "z" ]; var tSecondLetters = [ "a", "b", "c", "d", "e", "f", "g", "h", "i", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y" ]; var lang = "DSGS"; this.text="Deutschschweizer Gebärdensprache"; this.list=function(){ return "abcdefghijklmnopqrstuvwxyzäöüchsch"; } for (var l in Letters ) { ndx = Letters[l]; var ll = new SignedLetter(Letters[l], lang); this[ndx] = ll; } for (var itSL in tSecondLetters ) { ndx = tSecondLetters[itSL]; ndx += ndx; if ( ndx == "ll" ) { // debugmsg ( "ndx = " + ndx ); } var ll = new CompositeLetter(ndx, lang, 2); ll.duration = 2; this[ndx] = ll; } this["j"]=new CompositeLetter("j", lang, 3); this["ä"]=new CompositeLetter("ä", lang, 3, "ae"); this["ö"]=new CompositeLetter("ö", lang, 3, "oe"); this["ü"]=new CompositeLetter("ü", lang, 3, "ue"); this["z"]=new CompositeLetter("z", lang, 4); this["ß"]=new CompositeLetter("ss", lang, 2, "ss"); var spc = "space"; this[" "]=new SignedLetter("_",lang, "space"); this["."]=new SignedLetter(".",lang, "space"); this["\n"]=new SignedLetter("",lang, "space"); this["-"]=new SignedLetter("-",lang, "space"); this["ww-blank"]=new SignedLetter("blank",lang,"blank"); } function DGSAlphabet(){ // anthing with a name up to three characters is considered a signed letter var Letters = [ "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z", "sch" ]; var tCompositeLetters = [ "j", "ä", "ö", "u", "z", "ß" ]; var tSecondLetters = [ "a", "b", "c", "d", "e", "f", "g", "h", "i", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y" ]; var lang = "DGS"; this.text="Deutsche Gebärdensprache"; this.list=function(){ return "abcdefghijklmnopqrstuvwxyzschäöüß"; } for (var l in Letters ) { ndx = Letters[l]; var ll = new SignedLetter(Letters[l], lang); this[ndx] = ll; } for (var itSL in tSecondLetters ) { ndx = tSecondLetters[itSL]; ndx += ndx; var ll = new CompositeLetter(ndx, lang, 2); ll.duration = 2; this[ndx] = ll; } this["j"]=new CompositeLetter("j", lang, 3); this["ä"]=new CompositeLetter("ä", lang, 3, "ae"); this["ö"]=new CompositeLetter("ö", lang, 3, "oe"); this["ü"]=new CompositeLetter("ü", lang, 3, "ue"); this["ß"]=new CompositeLetter("ß", lang, 3, "sb"); this["z"]=new CompositeLetter("z", lang, 4); var spc = "space"; this[" "]=new SignedLetter("_",lang, spc); this["."]=new SignedLetter(".",lang, spc); this["\n"]=new SignedLetter("",lang, spc); this["-"]=new SignedLetter("-",lang, spc); this["ww-blank"]=new SignedLetter("blank",lang,"blank"); } // FingerSpell FlashCards Letter and Alphabet Functions // Copyright (c) 2008 Peter Stevens, some rights reserved // Licensed under a Creative Commons Attribution-Noncommercial-No Derivative Works License. // function Dictionary(name){ this.int = new Object(); this.tWords = new Object(); this.int.name=name; this.int.length=0; this.random=function(){ if ( this.int.length ) { result = Math.floor(Math.random()*(this.int.length)); // debugmsg ( "random: result = " + result + ", length = " + this.int.length ); return this.tWords[result]; } else { return 0; } } this.add=function(word){ this.tWords[this.int.length++]=word; } this.name=function(newName){ if ( newName ) { this.int.name=newName; } return this.int.name; } } function AnyAlphabet(){ dict = new Dictionary("Alphabet"); text = glob.alphabet.list(); ls = new LetterSequence ( text, glob.alphabet ) ; ch = ls.getCh(); while ( ch ) { // debugmsg ( "ch = " + ch + "; "); dict.add(ch); ch = ls.getCh(); } return dict; } function SwissNames(){ dict = new Dictionary("beliebte Schweizer Vornamen"); dict.add("Ali"); dict.add("Arne"); dict.add("Ben"); dict.add("Brian"); dict.add("Cedrik"); dict.add("Clemens"); dict.add("Constantin"); dict.add("Dean"); dict.add("Domenic"); dict.add("Elias"); dict.add("Fabian"); dict.add("Finn"); dict.add("Frederik"); dict.add("Hannes"); dict.add("Henry"); dict.add("Jamie"); dict.add("Jannick"); dict.add("Jeremie"); dict.add("John"); dict.add("Jordan"); dict.add("Justin"); dict.add("Keno"); dict.add("Konrad"); dict.add("Laurens"); dict.add("Leif"); dict.add("Lennox"); dict.add("Leonardo"); dict.add("Linus"); dict.add("Lucas"); dict.add("Luke"); dict.add("Marc"); dict.add("Marius"); dict.add("Marten"); dict.add("Matis"); dict.add("Matti"); dict.add("Maxim"); dict.add("Michel"); dict.add("Mirco"); dict.add("Nick"); dict.add("Niklas"); dict.add("Noel"); dict.add("Pascal"); dict.add("Philip"); dict.add("Raphael"); dict.add("Robin"); dict.add("Sandro"); dict.add("Sören"); dict.add("Swen"); dict.add("Till"); dict.add("Tobias"); dict.add("Tristan"); dict.add("Yannick"); dict.add("Alessia"); dict.add("Alisha"); dict.add("Angelina"); dict.add("Annabel"); dict.add("Annemarie"); dict.add("Antonia"); dict.add("Carlotta"); dict.add("Celina"); dict.add("Cheyenne"); dict.add("Cora"); dict.add("Elena"); dict.add("Emelie"); dict.add("Emilie"); dict.add("Eva"); dict.add("Felicitas"); dict.add("Franka"); dict.add("Greta"); dict.add("Helena"); dict.add("Ina"); dict.add("Jana"); dict.add("Jasmina"); dict.add("Jette"); dict.add("Johanna"); dict.add("Josephine"); dict.add("Judith"); dict.add("Karla"); dict.add("Kim"); dict.add("Klara"); dict.add("Larissa"); dict.add("Leandra"); dict.add("Lenya"); dict.add("Letizia"); dict.add("Lilli"); dict.add("Linnea"); dict.add("Louis"); dict.add("Lucas"); dict.add("Luise"); dict.add("Maike"); dict.add("Maria"); dict.add("Marleen"); dict.add("Marwin"); dict.add("Melanie"); dict.add("Michelle"); dict.add("Natalia"); dict.add("Nina"); dict.add("Patrizia"); dict.add("Rebecca"); dict.add("Salome"); dict.add("Saskia"); dict.add("Sofia"); dict.add("Sophia"); dict.add("Svea"); dict.add("Tara"); dict.add("Valerie"); dict.add("Vivien"); dict.add("Yannik"); return dict; } function SwissPlaces ( ) { dict = new Dictionary ("Schweizer Ortschaften"); dict.add("Baden"); dict.add("Birrwil"); dict.add("Buchs"); dict.add("Eiken"); dict.add("Frick"); dict.add("Hägglingen"); dict.add("Holziken"); dict.add("Kallern"); dict.add("Lengnau"); dict.add("Mellingen"); dict.add("Mumpf"); dict.add("Oberentfelden"); dict.add("Oberwil"); dict.add("Remigen"); dict.add("Safenwil"); dict.add("Schöftland"); dict.add("Stein"); dict.add("Turgi"); dict.add("Veltheim"); dict.add("Wil"); dict.add("Zeihen"); dict.add("Rüte"); dict.add("Lutzenberg"); dict.add("Wald"); dict.add("Aeschlen"); dict.add("Bannwil"); dict.add("Biel"); dict.add("Bremgarten"); dict.add("Därligen"); dict.add("Erlenbach"); dict.add("Freimettigen"); dict.add("Guggisberg"); dict.add("Hilterfingen"); dict.add("Ittigen"); dict.add("Kiesen"); dict.add("La Ferriere"); dict.add("Leissigen"); dict.add("Lützelflüh"); dict.add("Merzligen"); dict.add("Muri"); dict.add("Oberdiessbach"); dict.add("Pieterlen"); dict.add("Röthenbach"); dict.add("Rüti bei Büren"); dict.add("Schwarzhäusern"); dict.add("Steffisburg"); dict.add("Thun"); dict.add("Uetendorf"); dict.add("Walkringen"); dict.add("Wilderswil"); dict.add("Wyssachen"); dict.add("Arlesheim"); dict.add("Bottmingen"); dict.add("Duggingen"); dict.add("Hersberg"); dict.add("Lauwil"); dict.add("Nusshof"); dict.add("Rickenbach"); dict.add("Tenniken"); dict.add("Ziefen"); dict.add("Charmey"); dict.add("Giffers"); dict.add("Muntelier"); dict.add("Tafers"); dict.add("Avusy"); dict.add("Bourg"); dict.add("Genthod"); dict.add("Onex"); dict.add("Soral"); dict.add("Braunwald"); dict.add("Matt"); dict.add("Rüti"); dict.add("Arosa"); dict.add("Buseno"); dict.add("Clugin"); dict.add("Feldis Veulden"); dict.add("Guarda"); dict.add("Ladir"); dict.add("Madulain"); dict.add("Molinis"); dict.add("Praden"); dict.add("Samedan"); dict.add("Scuol"); dict.add("Splügen"); dict.add("Surava"); dict.add("Trans"); dict.add("Valchava"); dict.add("Zernez"); dict.add("Courgenay"); dict.add("Saignelegier"); dict.add("Altwis"); dict.add("Ebersecken"); dict.add("Fischbach"); dict.add("Hämikon"); dict.add("Knutwil"); dict.add("Mauensee"); dict.add("Oberkirch"); dict.add("Römerswil"); dict.add("Schwarzenbach"); dict.add("Wauwil"); dict.add("Auvernier"); dict.add("Cortaillod"); dict.add("Le Landeron"); dict.add("Rochefort"); dict.add("Buochs"); dict.add("Engelberg"); dict.add("Au"); dict.add("Degersheim"); dict.add("Gaiserwald"); dict.add("Jonschwil"); dict.add("Muolen"); dict.add("Rapperswil"); dict.add("Sennwald"); dict.add("Uzwil"); dict.add("Wildhaus"); dict.add("Gächlingen"); dict.add("Neunkirch"); dict.add("Thayngen"); dict.add("Bellach"); dict.add("Büsserach"); dict.add("Etziken"); dict.add("Günsberg"); dict.add("Hubersdorf"); dict.add("Lostorf"); dict.add("Niedergösgen"); dict.add("Ramiswil"); dict.add("Solothurn"); dict.add("Witterswil"); dict.add("Gersau"); dict.add("Reichenburg"); dict.add("Aadorf"); dict.add("Bichelsee"); dict.add("Erlen"); dict.add("Hauptwil"); dict.add("Kradolf"); dict.add("Münsterlingen"); dict.add("Schönholzerswilen"); dict.add("Uttwil"); dict.add("Acquarossa"); dict.add("Calonico"); dict.add("Gordola"); dict.add("Mendrisio"); dict.add("Ponte Tresa"); dict.add("Torricella"); dict.add("Bürglen"); dict.add("Seelisberg"); dict.add("Avenches"); dict.add("Montreux"); dict.add("Ausserberg"); dict.add("Bitsch"); dict.add("Champery"); dict.add("Fiesch"); dict.add("Guttet"); dict.add("Leukerbad"); dict.add("Nendaz"); dict.add("Brig"); dict.add("Sion"); dict.add("Törbel"); dict.add("Vionnaz"); dict.add("Menzingen"); dict.add("Adliswil"); dict.add("Bauma"); dict.add("Buchs"); dict.add("Dorf"); dict.add("Fällanden"); dict.add("Greifensee"); dict.add("Hittnau"); dict.add("Illnau"); dict.add("Lindau"); dict.add("Neftenbach"); dict.add("Oberrieden"); dict.add("Pfäffikon"); dict.add("Rümlang"); dict.add("Seegräben"); dict.add("Truttikon"); dict.add("Wädenswil"); dict.add("Wetzikon"); dict.add("Herzogenbuchsee"); dict.add("Balterswil"); dict.add("Büren"); dict.add("Flüh"); dict.add("Kallnach"); dict.add("Prättigau"); dict.add("Schönbühl"); dict.add("Taverne"); dict.add("Vuorz"); dict.add("Yverdon"); dict.add("Bern"); dict.add("St. Gallen"); dict.add("Neuenburg"); dict.add("Ammannsegg"); dict.add("Buchen"); dict.add("Flamatt"); dict.add("Jona"); dict.add("Olten"); dict.add("Schönenberg"); dict.add("Teufen"); dict.add("Wangen"); return dict; } function USAPlaces ( ) { dict = new Dictionary ("USA Cities, States, Rivers and Mountains"); dict.add("San Jose"); dict.add("Charlotte"); dict.add("Las Vegas"); dict.add("Sacramento"); dict.add("Minneapolis"); dict.add("Pittsburgh"); dict.add("St. Paul"); dict.add("Chandler"); dict.add("Garland"); dict.add("Montgomery"); dict.add("South"); dict.add("Grand Rapids"); dict.add("Little Rock"); dict.add("Rancho Cucamonga"); dict.add("Tallahassee"); dict.add("Springfield"); dict.add("Pasadena"); dict.add("Hayward"); dict.add("Sunnyvale"); dict.add("Thousand Oaks"); dict.add("Stamford"); dict.add("Lafayette"); dict.add("Costa Mesa"); dict.add("West Covina"); dict.add("Arvada"); dict.add("Killeen"); dict.add("Alaska"); dict.add("Hawaii"); dict.add("Massachusetts"); dict.add("New Mexico"); dict.add("South Dakota"); dict.add("Missouri"); dict.add("Brazos"); dict.add("Kansas"); dict.add("Copper"); dict.add("River"); dict.add("Chiginagak"); dict.add("Juneau"); dict.add("Chugach"); dict.add("Saint Elias"); dict.add("Westdahl"); dict.add("University"); dict.add("Cathedral"); dict.add("Fresno Dome"); dict.add("Lassen"); dict.add("The"); dict.add("Ritter"); dict.add("Tamalpais"); dict.add("Bailey"); dict.add("Three Fingered Jack"); dict.add("Constance"); dict.add("St. Helens"); return dict; } function USANames ( ) { dict = new Dictionary ("Top US First Names"); dict.add("Matthew"); dict.add("William"); dict.add("Noah"); dict.add("John"); dict.add("Samuel"); dict.add("Aiden"); dict.add("Jack"); dict.add("Isaiah"); dict.add("Justin"); dict.add("Jayden"); dict.add("Jason"); dict.add("Charles"); dict.add("Julian"); dict.add("Carlos"); dict.add("Carter"); dict.add("Kyle"); dict.add("Dominic"); dict.add("Steven"); dict.add("Henry"); dict.add("Devin"); dict.add("Brady"); dict.add("Patrick"); dict.add("Kaleb"); dict.add("Jorge"); dict.add("Trevor"); dict.add("Alexis"); dict.add("Levi"); dict.add("Nicolas"); dict.add("Nolan"); dict.add("Malachi"); dict.add("Grant"); dict.add("Max"); dict.add("Stephen"); dict.add("Jonah"); dict.add("Hector"); dict.add("Jeffrey"); dict.add("Brendan"); dict.add("Wesley"); dict.add("Sergio"); dict.add("Martin"); dict.add("Drew"); dict.add("Ty"); dict.add("Roberto"); dict.add("Calvin"); dict.add("Keegan"); dict.add("Kayden"); dict.add("Maddox"); dict.add("Julio"); dict.add("Frank"); dict.add("Trey"); dict.add("Ava"); dict.add("Samantha"); dict.add("Sarah"); dict.add("Brianna"); dict.add("Hailey"); dict.add("Savannah"); dict.add("Morgan"); dict.add("Alexandra"); dict.add("Makayla"); dict.add("Gabriella"); dict.add("Riley"); dict.add("Megan"); dict.add("Evelyn"); dict.add("Stephanie"); dict.add("Haley"); dict.add("Michelle"); dict.add("Isabelle"); dict.add("Valeria"); dict.add("Autumn"); dict.add("Layla"); dict.add("Molly"); dict.add("Gabriela"); dict.add("Kennedy"); dict.add("Diana"); dict.add("Sophie"); dict.add("Erin"); dict.add("Serenity"); dict.add("Ashlyn"); dict.add("Skylar"); dict.add("Liliana"); dict.add("Reagan"); dict.add("Angel"); dict.add("Mckenzie"); dict.add("Alondra"); dict.add("Ellie"); dict.add("Camila"); dict.add("Kiara"); dict.add("Courtney"); dict.add("Kyra"); dict.add("Hope"); dict.add("Abby"); dict.add("Tiffany"); dict.add("Amaya"); dict.add("Aniyah"); dict.add("Julissa"); dict.add("Savanna"); dict.add("Laila"); dict.add("Cynthia"); dict.add("Nora"); dict.add("Monica"); return dict; } function GermanPlaces ( ) { dict = new Dictionary ("deutsche Ortschaften"); dict.add("Ahrensbök"); dict.add("Altefähr"); dict.add("Amtzell"); dict.add("Aurich"); dict.add("Bad Kreuznach"); dict.add("Bad Schandau"); dict.add("Bartholomä"); dict.add("Beetzsee"); dict.add("Bergheim"); dict.add("Bielefeld"); dict.add("Blankenfelde"); dict.add("Bodenwerder"); dict.add("Borsfleth"); dict.add("Breddenberg"); dict.add("Brunsmark"); dict.add("Böhnhusen"); dict.add("Chemnitz"); dict.add("Dannenberg"); dict.add("Derenburg"); dict.add("Diespeck"); dict.add("Donau"); dict.add("Drönnewitz"); dict.add("Eberdingen"); dict.add("Einöllen"); dict.add("Elsdorf"); dict.add("Eppenberg"); dict.add("Eschenbach in der Oberpfalz"); dict.add("Eversmeer"); dict.add("Fischbach/Rhön"); dict.add("Freising"); dict.add("Fürstenau"); dict.add("Gechingen"); dict.add("Gerabronn"); dict.add("Globig-Bleddin"); dict.add("Grana"); dict.add("Groß Döbbern"); dict.add("Großenseebach"); dict.add("Gutach im Breisgau"); dict.add("Haarbach"); dict.add("Hamburg"); dict.add("Hattert"); dict.add("Heidelberg"); dict.add("Henstedt-Ulzburg"); dict.add("Hessen"); dict.add("Himmelkron"); dict.add("Hockweiler"); dict.add("Holzwickede"); dict.add("Höringen"); dict.add("Ingelfingen"); dict.add("Jarchau"); dict.add("Kail"); dict.add("Kehnert"); dict.add("Kirchwalsede"); dict.add("Kollweiler"); dict.add("Kröppelshagen-Fahrendorf"); dict.add("Laasdorf"); dict.add("Lauchheim"); dict.add("Leezen"); dict.add("Leichlingen"); dict.add("Leipe"); dict.add("Lemberg"); dict.add("Lennestadt"); dict.add("Letschin"); dict.add("Leuterod"); dict.add("Lichtenberg/Erzgebirge"); dict.add("Liebenburg"); dict.add("Lienen"); dict.add("Lietzen"); dict.add("Lindau"); dict.add("Lindwedel"); dict.add("Linum"); dict.add("Loburg"); dict.add("Lohme"); dict.add("Lommatzsch"); dict.add("Losenrade"); dict.add("Luckow"); dict.add("Lugau"); dict.add("Luso"); dict.add("Lykershausen"); dict.add("Löderburg"); dict.add("Lötzbeuren"); dict.add("Lübtheen"); dict.add("Lüerdissen"); dict.add("Lütjenburg"); dict.add("Maasen"); dict.add("Maihingen"); dict.add("Maitzborn"); dict.add("Malliß"); dict.add("Mangelsdorf"); dict.add("March"); dict.add("Marihn"); dict.add("Marklkofen"); dict.add("Marktbergel"); dict.add("Marnerdeich"); dict.add("Marth"); dict.add("Maselheim"); dict.add("Mauden"); dict.add("Mechernich"); dict.add("Meerfeld"); dict.add("Mehrstetten"); dict.add("Meitingen"); dict.add("Mellnitz"); dict.add("Menningen"); dict.add("Merschbach"); dict.add("Merzweiler"); dict.add("Mestlin"); dict.add("Meusebach"); dict.add("Moordiek"); dict.add("Märkisch Linden"); dict.add("Münchhausen"); dict.add("Nesow"); dict.add("Neuhaus am Inn"); dict.add("Neuholland"); dict.add("Neustrelitz"); dict.add("Niefern-Öschelbronn"); dict.add("Nomborn"); dict.add("Norderney"); dict.add("Nordhofen"); dict.add("Nordwestuckermark"); dict.add("Nottuln"); dict.add("Nußdorf am Inn"); dict.add("Nürburg"); dict.add("Oberammergau"); dict.add("Oberdachstetten"); dict.add("Oberfischbach"); dict.add("Oberhausen-Rheinhausen"); dict.add("Oberkrämer"); dict.add("Oberndorf"); dict.add("Oberoppurg"); dict.add("Oberreute"); dict.add("Oberschweinbach"); dict.add("Oberstenfeld"); dict.add("Obertrebra"); dict.add("Oberweis"); dict.add("Obing"); dict.add("Odelzhausen"); dict.add("Oederan"); dict.add("Oersdorf"); dict.add("Offenbach an der Queich"); dict.add("Ohlsbach"); dict.add("Olbersdorf"); dict.add("Olfen"); dict.add("Oppach"); dict.add("Oranienburg"); dict.add("Oschatz"); dict.add("Osterberg"); dict.add("Osternienburg"); dict.add("Ostheim vor der Rhön"); dict.add("Ottendorf-Okrilla"); dict.add("Otting"); dict.add("Oy-Mittelberg"); dict.add("Paitzdorf"); dict.add("Paplitz"); dict.add("Paschel"); dict.add("Patzig"); dict.add("Peiting"); dict.add("Penzin"); dict.add("Peseckendorf"); dict.add("Peuschen"); dict.add("Pfalzgrafenweiler"); dict.add("Pforzheim"); dict.add("Pickließem"); dict.add("Pintesfeld"); dict.add("Plankstadt"); dict.add("Pleiskirchen"); dict.add("Plötzkau"); dict.add("Poggensee"); dict.add("Polsingen"); dict.add("Porschdorf"); dict.add("Pottiga"); dict.add("Premnitz"); dict.add("Preußisch Oldendorf"); dict.add("Pripsleben"); dict.add("Pronsfeld"); dict.add("Puchheim"); dict.add("Pyrbaum"); dict.add("Pölsfeld"); dict.add("Pünderich"); dict.add("Quendorf"); dict.add("Quitzdorf am See"); dict.add("Raddusch"); dict.add("Radibor"); dict.add("Raitenbuch"); dict.add("Randersacker"); dict.add("Rantrum"); dict.add("Rathen"); dict.add("Rauda"); dict.add("Rayerschied"); dict.add("Recklinghausen"); dict.add("Regenstauf"); dict.add("Rehm-Flehde-Bargen"); dict.add("Reichersbeuern"); dict.add("Reiff"); dict.add("Reinsbüttel"); dict.add("Reitzenhain"); dict.add("Remstädt"); dict.add("Reppenstedt"); dict.add("Rettershain"); dict.add("Reuth"); dict.add("Rheinbach"); dict.add("Rhinow"); dict.add("Riebau"); dict.add("Riedstadt"); dict.add("Rieste"); dict.add("Rimsting"); dict.add("Rippershausen"); dict.add("Riveris"); dict.add("Rodenberg"); dict.add("Rogeez"); dict.add("Rohrberg"); dict.add("Rommerskirchen"); dict.add("Rosenau"); dict.add("Rosian"); dict.add("Rothenbuch"); dict.add("Rotthalmünster"); dict.add("Ruppach-Goldhausen"); dict.add("Röddelin"); dict.add("Rögling"); dict.add("Rötha"); dict.add("Salzgitter"); dict.add("Schköna"); dict.add("Schnelldorf"); dict.add("Schweina"); dict.add("Seifen"); dict.add("Singen"); dict.add("Spirkelbach"); dict.add("Steinach"); dict.add("Sternberg"); dict.add("Tarbek"); dict.add("Theilenhofen"); dict.add("Trantow"); dict.add("Uhyst"); dict.add("Veringenstadt"); dict.add("Walkertshofen"); dict.add("Wattenbek"); dict.add("Weißenstadt"); dict.add("Wettringen"); dict.add("Windsbach"); dict.add("Wonfurt"); dict.add("Zeitlarn"); dict.add("Öhringen"); return dict; } function GermanNames ( ) { dict = new Dictionary ("beliebte deutsche Vornamen"); dict.add("Aileen"); dict.add("Ali"); dict.add("Amely"); dict.add("Andreas"); dict.add("Anna"); dict.add("Anne"); dict.add("Anthony"); dict.add("Artur"); dict.add("Ben"); dict.add("Brian"); dict.add("Carla"); dict.add("Catharina"); dict.add("Chantal"); dict.add("Chris"); dict.add("Christopher"); dict.add("Conner"); dict.add("Dana"); dict.add("Denis"); dict.add("Diana"); dict.add("Dustin"); dict.add("Elisabeth"); dict.add("Emil"); dict.add("Enrico"); dict.add("Evelin"); dict.add("Fabio"); dict.add("Finja"); dict.add("Florian"); dict.add("Frederick"); dict.add("Fynn"); dict.add("Hanna"); dict.add("Helene"); dict.add("Henrik"); dict.add("Imke"); dict.add("Isabelle"); dict.add("Jana"); dict.add("Jannick"); dict.add("Jason"); dict.add("Jeremy"); dict.add("Joanna"); dict.add("Johanna"); dict.add("Jona"); dict.add("Jordan"); dict.add("Josy"); dict.add("Julian"); dict.add("Justus"); dict.add("Karlotta"); dict.add("Kevin"); dict.add("Kimberly"); dict.add("Konrad"); dict.add("Lana"); dict.add("Laura"); dict.add("Lea"); dict.add("Leif"); dict.add("Lenja"); dict.add("Lenny"); dict.add("Leonardo"); dict.add("Letizia"); dict.add("Liam"); dict.add("Lina"); dict.add("Lisa"); dict.add("Louis"); dict.add("Luca"); dict.add("Lucy"); dict.add("Luka"); dict.add("Lynn"); dict.add("Maja"); dict.add("Marc"); dict.add("Maria"); dict.add("Marius"); dict.add("Marlen"); dict.add("Martha"); dict.add("Mathis"); dict.add("Matthias"); dict.add("Maurice"); dict.add("Meik"); dict.add("Melvin"); dict.add("Michelle"); dict.add("Milena"); dict.add("Mohammed"); dict.add("Natalia"); dict.add("Nelly"); dict.add("Nicolas"); dict.add("Nikolas"); dict.add("Noemi"); dict.add("Oscar"); dict.add("Patrizia"); dict.add("Peter"); dict.add("Pia"); dict.add("Rebecca"); dict.add("Robin"); dict.add("Ruben"); dict.add("Sandro"); dict.add("Sebastian"); dict.add("Simon"); dict.add("Sophia"); dict.add("Stella"); dict.add("Sven"); dict.add("Tamara"); dict.add("Theo"); dict.add("Tim"); dict.add("Tom"); dict.add("Tyler"); dict.add("Veronika"); dict.add("Vivienne"); dict.add("Yannis"); return dict; } // FingerSpell FlashCards Letter and Alphabet Functions // Copyright (c) 2008 Peter Stevens, some rights reserved // Licensed under a Creative Commons Attribution-Noncommercial-No Derivative Works License. // function EventHandler(e){ var targ; var parent; if (!e) { var e=window.event; } if (e.target) { targ=e.target; } else if (e.srcElement) { targ=e.srcElement; } if (targ.nodeType==3) { // defeat Safari bug targ = targ.parentNode; } var tname; /* if clicking on a link, get parent div */ tname=targ.tagName; // alert ("EventHandler: tagName = '" + targ.tagName + "', id = '" + targ.id +"'"); if ( tname.toLowerCase() == "a" ) { targ = targ.parentNode; } tid=targ.id; parent = targ.parentNode; GlobalOnclick(parent.id, tid); } function KeyboardHandler(e){ var targ; var parent; if (!e) { var e=window.event; } if (e.target) { targ=e.target; } else if (e.srcElement) { targ=e.srcElement; } if (targ.nodeType==3) { // defeat Safari bug targ = targ.parentNode; } var tname; /* if clicking on a link, get parent div */ tname=targ.tagName; // alert ("KeyboardHandler: tagName = '" + targ.tagName + "', id = '" + targ.id +"'"); if ( tname.toLowerCase() == "a" ) { targ = targ.parentNode; } tid=targ.id; parent = targ.parentNode; GlobalOnkey(e.keyCode, parent.id, tid); } function GlobalOnkey(keyCode, parentid, tid){ CR = 13; // alert ("GlobalOnkey: keycode = '" + keyCode + "', parentid = '" + parentid +"'"); if ( keyCode == CR ) { Dispatch( "txt_Show") ; } else { options.submit.alt(); } } function inputField (id, text, parentId, parentClass ){ this.id = id; // becomes id field this.text = text; this.parentClass=parentClass; this.parentId=parentId; this.size = 35; this.tellme = 0; this.iActive = -1; this.cButtons =0; this.handler =0; this.tButtons = new Object(); this.tButtonsByName = new Object(); this.buttonClassName="button"; this.buttonActivateName="button"; this.setTitle=function(name,text){ buttonName = this.name+US+name; this.cTitle = new controlTitle(buttonName,text,this) ; return this.cTitle; } this.element=function(mother){ this.mother = mother; // DOM Object in which this input field shall be embedded result=document.createElement("div"); result.setAttribute("id", this.parentId); result.className = this.parentClass; cTitle=this.setTitle(this.id, this.text); result.appendChild(cTitle.element()); EL=document.createElement("input"); EL.type="text"; EL.setAttribute("id", this.id); EL.setAttribute("size", this.size); mother.onkeyup = KeyboardHandler; result.appendChild(EL); iStart=0; for ( i=iStart; i < this.cButtons ; i++ ) { childEl = this.tButtons[i].element(); result.appendChild(childEl); } if ( mother ) { mother.appendChild(result); } return result; } this.activate=function(buttonName){ newIndex = this.tButtonsByName[buttonName]; oldIndex = this.iActive; if ( oldIndex != newIndex) { this.tButtons[oldIndex].turnOff(); this.tButtons[newIndex].turnOn(); this.iActive=newIndex; } } this.setHandler=function(fn){ this.handler=fn; } this.dispatch=function(){ oparen='("'; cparen='")'; cmd= this.handler + oparen + this.tButtons[this.iActive].name + cparen; eval ( cmd ) ; } this.addButton=function(name,text){ buttonName = this.id+US+name; newButton = new Button(buttonName,text,this) ; newButton.normalClassName = this.buttonClassName; newButton.activatedClassName = this.buttonActivateName + " " + this.buttonClassName; if ( this.iActive < 0 ) { this.iActive = 0; } this.tButtonsByName[buttonName]= this.cButtons; this.tButtons[this.cButtons++]=newButton; return newButton; } this.imInterested=function(handler){ this.tellme = handler; } this.notify=function(){ if ( this.tellme ) { this.tellme() ; } } } function controlTitle( name, text ) { this.text = text; this.name = name; this.normalClassName = "control"; this.element=function(){ El=document.getElementById(this.name); if ( El && fDefined(El) ){ El.innerHTML=""; } else { El=document.createElement("h3"); El.setAttribute("id", this.name); El.className = this.normalClassName; } textEl = document.createTextNode(this.text); El.appendChild(textEl); return El; } } function Button ( name, text, father ) { this.name = name; // how to identify it for getElementbyId this.text = text; // how it is displayed this.mainText = text; // how it is displayed this.altText = text; // how it is displayed this.father = father; // aControl Object to which this button belongs this.state = 0 ; this.normalClassName = "button" ; this.activatedClassName = "activated button" ; this.doClick=1; this.turnOn=function() { this.state = 1; button=document.getElementById(this.name); if ( button ) { button.className=this.activatedClassName; } } this.reset=function() { // alert("Calling reset text = " + this.text +", main text = " + this.mainText ); if ( this.text != this.mainText ) { this.text = this.mainText; this.element(); } } this.alt=function() { if ( this.text != this.altText ) { this.text = this.altText; this.element(); } } this.turnOff=function() { this.state = 0; button=document.getElementById(this.name); if ( button ) { button.className=this.normalClassName; } } this.notClickable=function() { this.doClick=0; } this.clickable=function() { this.doClick=1; } this.queryState=function() { return this.state ; } this.element=function(){ El=document.getElementById(this.name); if ( El && fDefined(El) ){ El.innerHTML=""; } else { El=document.createElement("div"); El.setAttribute("id", this.name); El.className = this.normalClassName; } if ( this.doClick ) { textEl = document.createTextNode(this.text); El.onclick = EventHandler; AEl=document.createElement("a"); AEl.href="#"; AEl.appendChild(textEl); El.appendChild(AEl); } else { textEl = document.createTextNode(this.text); El.appendChild(textEl); } return El; } } function aControl ( name, text, mother ) { US = "_"; fActivate = 0; this.name = name; this.text = text; this.mother = mother; // parent node in DOM tree this.fShowState=1; this.iActive = -1; this.cButtons = 0; this.fNoText = 0; // whether to include text this.className= "option right"; this.tButtons = new Object(); this.tButtonsByName = new Object(); this.buttonClassName="button"; this.buttonActivateName="activated"; this.setTitle=function(name,text){ buttonName = this.name+US+name; iThisButton = 0 ; // Title is always the first button this.cTitle = new controlTitle(buttonName,text,this) ; return this.cTitle; } this.setTitle(name,text); this.addButton=function(name,text){ buttonName = this.name+US+name; newButton = new Button(buttonName,text,this) ; newButton.normalClassName = this.buttonClassName; newButton.activatedClassName = this.buttonActivateName + " " + this.buttonClassName; if ( this.iActive < 0 ) { this.iActive = 0; } this.tButtonsByName[buttonName]= this.cButtons; this.tButtons[this.cButtons++]=newButton; return newButton; } this.activate=function(buttonName){ newIndex = this.tButtonsByName[buttonName]; oldIndex = this.iActive; if ( oldIndex != newIndex) { this.tButtons[oldIndex].turnOff(); this.tButtons[newIndex].turnOn(); this.iActive=newIndex; } } this.noState=function(){ this.fShowState=0; for ( i = 0; i < this.cButtons; i++ ) { this.tButtons[i].activatedClassName = this.tButtons[i].normalClassName; this.tButtons[i].turnOff(); } } this.setHandler=function(fn){ this.handler=fn; } this.dispatch=function(){ oparen='("'; cparen='")'; cmd= this.handler + oparen + this.tButtons[this.iActive].name + cparen; eval ( cmd ) ; } this.displayAll=function(){ controlEl = document.createElement("div"); controlEl.className=this.className; var iStart = 0; controlEl.setAttribute("id", this.name); if ( !this.fNoText ) { controlEl.appendChild(this.cTitle.element()); } for ( i=iStart; i < this.cButtons ; i++ ) { childEl = this.tButtons[i].element(); controlEl.appendChild(childEl); } this.mother.appendChild(controlEl); this.tButtons[0].turnOn(); } } function Option (){ this.atMother = document.getElementById("automatic"); this.yrMother = document.getElementById("yours"); this.rpMother = document.getElementById("repeat"); this.prMother = document.getElementById("prefs"); this.shMother = document.getElementById("showHide_Container"); this.submit=0; this.Alphabet = new aControl ( "Alphabet", "Alphabet:", this.prMother ) ; this.Alphabet.className= "option"; this.Alphabet.addButton ( "ASL", "ASL" ); this.Alphabet.addButton ( "DSGS", "DSGS" ); this.Alphabet.addButton ( "DGS", "DGS" ); this.Alphabet.setHandler("setAlphabet"); if ( glob.language == "German" ) { this.word = new inputField ("txt", "Eigenes Wort: ", "word", "dispatch" ); this.word.addButton ( "Show", "Zeigen" ); this.word.element(this.yrMother); this.Speed = new aControl ( "Speed", "Tempo:", this.prMother ) ; this.Speed.addButton ( "Slow", "Anfänger" ); this.Speed.addButton ( "Medium", "Medium" ); this.Speed.addButton ( "Fast", "Schnell" ); this.Speed.addButton ( "Deaf", "Echt" ); this.ShowHide = new aControl ( "ShowHide", "ShowHide_Controls", this.shMother ) ; this.ShowHide.addButton ( "Hide", "Buchstaben nicht anzeigen" ); this.ShowHide.addButton ( "Unhide", "Buchstaben anzeigen" ); this.Dispatch = new aControl ( "Dispatch", "Dispatch", this.atMother ) ; this.Dispatch.buttonClassName="vButton"; this.submit=this.Dispatch.addButton ( "Random", "Zufallswort" ); this.Dispatch.addButton ( "Alphabet", "A-Z" ); this.Repeat = new aControl ( "Repeat", "Repeat", this.rpMother ) ; this.Repeat.buttonClassName="vButton"; this.Repeat.addButton ( "Repeat", "Wiederholen" ); this.Dictionary = new aControl ( "Dictionary", "Wörterbuch:", this.prMother) ; this.Dictionary.addButton ( "Alphabet", "Buchstaben" ); this.Dictionary.addButton ( "Easy", "Einfach" ); this.Dictionary.addButton ( "Hard", "Schwierig" ); } else { this.word = new inputField ("txt", "Your Word: ", "word", "dispatch" ); this.word.addButton ( "Show", "Show" ); this.word.element(this.yrMother); this.Speed = new aControl ( "Speed", "Speed:", this.prMother ) ; this.Speed.addButton ( "Slow", "Beginner" ); this.Speed.addButton ( "Medium", "Medium" ); this.Speed.addButton ( "Fast", "Fast" ); this.Speed.addButton ( "Deaf", "Deaf" ); this.ShowHide = new aControl ( "ShowHide", "ShowHide", this.shMother ) ; this.ShowHide.addButton ( "Hide", "Hide Text" ); this.ShowHide.addButton ( "Unhide", "Unhide Text" ); this.Dispatch = new aControl ( "Dispatch", "Dispatch", this.atMother ) ; this.Dispatch.buttonClassName="vButton"; this.submit=this.Dispatch.addButton ( "Random", "Random" ); this.Dispatch.addButton ( "Alphabet", "A-Z" ); this.Repeat = new aControl ( "Repeat", "Repeat", this.rpMother ) ; this.Repeat.buttonClassName="vButton"; this.Repeat.addButton ( "Repeat", "Repeat" ); this.Dictionary = new aControl ( "Dictionary", "Dictionary:", this.prMother) ; this.Dictionary.addButton ( "Alphabet", "Letters" ); this.Dictionary.addButton ( "Easy", "Easy" ); this.Dictionary.addButton ( "Hard", "Hard" ); } this.word.imInterested(this.submit.alt); this.word.setHandler("Dispatch"); this.Speed.setHandler("setSpeed"); this.Speed.displayAll(); this.Dictionary.setHandler("setDictionary"); this.Dictionary.displayAll(); this.Alphabet.displayAll(); this.ShowHide.setHandler("Dispatch"); this.ShowHide.fNoText=1; this.ShowHide.noState(); this.ShowHide.className="showHide_Container"; this.ShowHide.displayAll (); this.Repeat.setHandler("Dispatch"); this.Repeat.noState(); this.Repeat.fNoText=1; this.Repeat.className="dispatch"; this.Repeat.displayAll(); this.Dispatch.setHandler("Dispatch"); this.Dispatch.noState(); this.Dispatch.fNoText=1; this.Dispatch.className="dispatch"; this.Dispatch.displayAll(); } // FingerSpell FlashCards Letter and Alphabet Functions // Copyright (c) 2008 Peter Stevens, some rights reserved // Licensed under a Creative Commons Attribution-Noncommercial-No Derivative Works License. // var glob = new Object(); glob.imageHome="http://fingerspell.sierra-charlie.com"; var options; var fVisible=1; function GlobalOnclick ( controlName, buttonValue ) { // debugmsg ("GlobalOnclic: controlName = " + controlName + ", buttonValue = '" + buttonValue +"'"); options[controlName].activate(buttonValue); options[controlName].dispatch(); } function hide(){ fVisible=0; document.getElementById('ShowHide_Hide').style.display="none"; document.getElementById('ShowHide_Unhide').style.display=""; // document.getElementById('word').style.display="none"; glob.st.hide(); } function unhide(){ fVisible=1; document.getElementById('ShowHide_Hide').style.display=""; document.getElementById('ShowHide_Unhide').style.display="none"; // document.getElementById('word').style.display=""; glob.st.unhide(); } function toggle(){ if (fVisible) { hide(); } else { unhide(); } } function setAlphabet(Type,fNoAlert){ switch (Type) { case "Alphabet_DSGS": glob.alphabetName = "DSGS"; glob.alphabet = new DSGSAlphabet(); break; case "Alphabet_ASL": glob.alphabetName="ASL"; glob.alphabet = new ASLAlphabet(); break; case "Alphabet_DGS": glob.alphabetName="DGS"; glob.alphabet = new DGSAlphabet(); break; default: alert ( "setAlphabet: Unknown Type:" + Type ); glob.alphabetName = "DSGS"; glob.alphabet = new DSGSAlphabet(); break; } El=document.getElementById("titlebar"); El.innerHTML=""; /* p1 = document.createElement("p"); * pt1 = document.createTextNode( glob.title ); * p1.appendChild(pt1); * El.appendChild(p1); */ pt2 = document.createTextNode( glob.alphabet.text ); El.appendChild(pt2); setDictionary(glob.dictionaryType,1); if ( !fNoAlert ) { alert("Alphabet: " + glob.alphabetName); } } function setDictionary(Type,fNoAlert){ if ( Type == "Dictionary_Alphabet" ) { glob.tNames = new AnyAlphabet(); } else { switch(glob.alphabetName) { case "ASL": if ( Type == "Dictionary_Hard") { glob.tNames = new USAPlaces(); } else { glob.tNames = new USANames(); } break; case "DGS": if ( Type == "Dictionary_Hard") { glob.tNames = new GermanPlaces(); } else { glob.tNames = new GermanNames(); } break; case "DSGS": default: if ( Type == "Dictionary_Hard") { glob.tNames = new SwissPlaces(); } else { glob.tNames = new SwissNames(); } break; } } glob.dictionaryType = Type; if ( !fNoAlert ) { alert("Dictionary: " + glob.tNames.name()); } } function setSpeed(Type,fNoAlert){ switch (Type) { case "Speed_Beginner": cpm = 25; break; case "Speed_Slow": cpm = 40; break; case "Speed_Medium": cpm = 60; break; case "Speed_Fast": cpm = 90; break; case "Speed_Deaf": cpm =120; break; default: alert ( "setSpeed: Unknown Type:" + Type ); cpm=25; break; } glob.speed = Math.floor ( 60 / cpm * 1000 ) ; // alert("debug: " + cpm +" cpm = "+glob.speed+" s/char" ); if ( !fNoAlert ) { alert(cpm +" cpm = "+glob.speed/1000+" s/char" ); } } function doit(text){ glob.ls = new LetterSequence ( text, glob.alphabet ) ; glob.st.reset(); glob.text = text; Show( glob.ls ); } function Dispatch(Type){ switch (Type) { case "Dispatch_Alphabet": text = glob.alphabet.list(); document.getElementById('txt').value = text ; doit(text); break; case "txt_Show": if ( document.getElementById('txt').value ) { text = document.getElementById('txt').value ; options.submit.reset(); } else { text = glob.tNames.random(); document.getElementById('txt').value = text ; } doit(text); break; case "Dispatch_Random": document.getElementById('txt').value = ""; text = glob.tNames.random(); doit(text); break; case "Repeat_Repeat": text = glob.text; doit(text); break; case "ShowHide_Hide": hide(); break; case "ShowHide_Unhide": unhide(); break; } } function doRepeat(){ text = glob.text; doit(text); } function startUp(lang,dictionaryType,Alphabet,Gruss){ glob.dictionaryType = dictionaryType; glob.language = lang; glob.title = "FingerSpell FlashCards"; // debugmsg(Gruss); if ( fDefined(Gruss) ) { glob.text = Gruss; } else { glob.text = "Something Else"; } glob.speed = 500; options = new Option(); options["Alphabet"].activate(Alphabet); setAlphabet(Alphabet,1); options["Dictionary"].activate(dictionaryType); setDictionary(dictionaryType,1); options["Speed"].activate("Speed_Fast"); setSpeed("Speed_Fast",1); glob.st = new ShowText ( ) ; unhide(); doit(glob.text); setTimeout("unhide()",glob.speed*(glob.text.length+1)); setTimeout('options["Speed"].activate("Speed_Slow")', glob.speed*(glob.text.length+1)); setTimeout('setSpeed("Speed_Slow",1 )' ,glob.speed*(glob.text.length+1)); }