ask = 0
var timerID
freeKey=0
var mix1 = new Array()
var mix2 = new Array()
var mix3 = new Array()
var mix4 = new Array()
var play = new Array()
var keySet=new Array("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")
worm=0
test=0
UsedKeys=""
InfoEnd = ""
Words = new Array(2)
Words[0] = new Array("apple","arrow","band","bolder","bark","belly","bicycle","bond","bulb","burp","calling","challenge","comet","cream","cricket","cramp","clamp","dream","drop","drier","damp","dull","drip","drink","drum","drowsy","earn","easel","eraser","equal","escape","ether","fairy","fall","faker","fence","fellow","film","filter","figure","flash","follow","fruit","fuzzy","galaxy","gallon","gather","gentle","genius","great","golden","griped","giant","giggly","gnome","goalie","grocer","grieve","gurgle","gypsum","hamlet","halve","handle","heart","hertz","hinder","hurray","hustle","ideal","igloo","immune","indent","inland","insult","jazz","jewel","joker","juice","jungle","kind","kicker","knead","kneel","kosher","lace","lather","lavish","league","leech","library","linear","living","loud","marshy","mat","medic","meteor","micron","mimic","misplay","modern","mouse","mumble","night","nostalgic","candies","writing","thesaurus","native","nasal","never","nostril","nozzle","oat","oblige","ocean","ocurr","onside","outfit","pack","palm","palace","parent","pastry","pectin","perch","phrase","pitch","platter","polar","point","poems","precious","private","prude","puzzle","quest","quilt","quick","race","rascal","receive","reflect","riddle","rinse","rotary","russet","salty","sandal","scared","script","sector","settle","shunt","sinus","slick","smooth","smile","snowy","spasm","spice","stage","extra","streak","subway","swamp","sweet","syntax","tariff","tempt","think","thumb","today","tough","trail","traffic","tragic","trawl","tulip","twist","unclean","uncoil","unfair","upper","utility","uvula","usher","vapor","vanish","valid","vest","virus","vintage","volley","vocal","waddle","waffle","wander","wash","water","weasel","wheel","whine","which","winch","wood","worker","wound","xenon","xylem","yellow","yonder","yield","zenith","zero","zebra","zombie","zodiac","zipper","practice","spelling","power ","your","spelling","skills")
Words[1] = new Array("aardvark","albatross","alligator","ant","anteater","armadillo","baboon","badger","bass","bear","beaver","bee","beetle","bird","bison","bobcat","buffalo","bull","butterfly","buzzard","calf","camel","cardinal","caribou","carp","cat","centipede","cheetah","chick","chicken","chipmunk","cockroach","cockatoo","cod","colt","condor","cormorant","cougar","cow","coyote","crab","crane","crawdad","crayfish","cricket","crocodile","crow","deer","dingo","dog","dolphin","donkey","dove","dragonfly","drake","duck","duckling","eagle","eel","elephant","emu","falcon","ferret","finch","fish","flamingo","flea","fly","fox","frog","gander","gazelle","gecko","giraffe","goat","goldfish","goose","gorilla","gosling","grizzly","grouse","grub","halibut","hamster","hare","hawk","hen","heron","herring","hippo","horse","hyena","ibis","iguanas","impala","insect","jacanas","jackal","jaguar","kangaroo","kinkajou","kitten","koala","komodos","ladybug","lamb","lemur","leopard","lion","lizard","llama","lobster","lynx","macaw","maggot","magpie","marten","meerkat","mongoose","monkey","mosquito","moth","mouse","mule","nighthawk","numbat","nutcracker","ocelot","octopus","ostrich","otter","owl","oyster","panda","panther","parakeet","parrot","partridge","pelican","perch","pheasant","pig","pigeon","pike","porcupine","potoroo","ptarmigan","puffin","puma","puppy","python","quail","quoll","rabbit","raccoon","rat","raven","reindeer","rhino","robin","rooster","salmon","sardine","scorpion","seagull","seal","shark","sheep","shrimp","sidewinder","snail","snake","sparrow","spider","sponge","squid","squirrel","stork","sturgeon","swallow","swan","swordfish","tadpole","termite","tick","tiger","toad","tortoise","trout","trumpeter","tuna","turkey","turtle","viper","vulture","wallaby","walrus","wapiti","warthog","wasp","weasel","whale","wolf","wombat","woodchuck","woylie","yak","zebra","zooid","zorilla","zorro")
MWa1 = 0
var mixX = 0
function $i(id) { return document.getElementById(id); }
function getmixX() { 
	mixX = MWa1.toString()
	for (var i = 0; i < mix1.length; i++) { 
		if (mixX == mix1[i]) { 
			break 
		} 
	} 
	if (i < mix1.length) { 

makeWord()
	} else {
makeMWa()
	} 
} 
function usedLetters() { 
	for (var i = 0; i < mix4.length; i++) { 
		if (Akey == mix4[i]) { 
			break 
		} 
	} 
	if (i < mix4.length) { 
	} else {  
mix4[mix4.length] = Akey
$i("rightB").innerHTML = mix4
	} 
} 




function $m(id,g){
if(g==0){id.style.left="8px"; id.style.top="8px" }//onmousedown
if(g==1){id.style.left="5px"; id.style.top="5px"}//onmouseup
if(g==2){id.style.left="5px"; id.style.top="5px"}//onmouseout
}
function menuA(id,g){
if(g==0){id.style.color="white";}//onmousedown
if(g==1){id.style.color="red";}//onmouseup
if(g==2){id.style.color="white";}//onmouseout
}
TmL = 0
function setTime(x){
TmL = x
$i("timeResult").innerHTML = TmL + " Minute Game"
}

function startTimer(){
if(TmL>0){
$i("timeDiv").style.visibility = "hidden"
$i("timeDivE").style.visibility = "hidden"
makeWord()
timeON()
}
}
time=0
function timeON(){
time = time*1+1
tmn = time
ts=0
tmx= time/60
tmx=Math.floor(tmx)
if(tmx >= 1){
tmn = time-(tmx*60)
}
tmr = tmn.toString()
if(tmr.length >1){ts=""}
$i("timerR").innerHTML =tmx +":"+ ts + tmr
if(tmx<TmL){
timerID = setTimeout("timeON()",1000)
}else{endGame();freeKey=1}
}
function endGame(){
$i("timeDivE").style.visibility = "visible"
$i("timeDivE").innerHTML =  ' Time is up! '+ InfoEnd + '<br>Words spelled in ' + TmL +' minutes: ' + spelled +'<BR>Missed: '+ missed + ' <BR>Your score:' +  Math.round(spelled - missed) +' <BR><SPAN onmouseover=menuA(this,0) onmouseout=menuA(this,1) onclick=newGame() style=color:red;cursor:pointer;>New Game</SPAN>' 
}
function getMTime(){
$i("timeDivE").style.visibility = "hidden"
$i("timeDiv").style.visibility = "visible"
//alert("Timer is not working. \n it will be added in soon. ")
}
function newGame(){
freeKey=0
time=0
$i("timeDiv").style.visibility = "visible"
$i("timeDivE").style.visibility = "hidden"
}
function zoomIt(){
if($i("body").style.zoom == "90%" ){
$i("body").style.zoom = "100%" 
$i("foxEXC1").innerHTML = "Zoom to fit screen"
} else {
$i("body").style.zoom = "90%"
$i("foxEXC1").innerHTML = "Un-Zoom"
}
}

function getThem(x){
if(x == 0){ask = 0; $i("board6a").style.color=bordColor; $i("board6b").style.color='white'}
if(x == 1){ask = 1; $i("board6b").style.color=bordColor; $i("board6a").style.color='white'}
makeWord()
}



function makeWord(){
document.getElementById("foxEXC").style.left = "-690px"
metTop = 160
metHeight = 20
$i("letMeter").style.top = metTop
$i("letMeter").style.height = metHeight
redL = 0
greenL = 255
spWord = 0
$i("letMeter").style.backgroundColor = "rgb(0, 255, 0)"
UsedKeys=""
blank = "_"
$i("textShow1").value = mix1
mix2.length =  0 
mix3.length =  0
	for (var i = 0; i < mix4.length; i++) { 
		$i("letter" + mix4[i]).style.visibility = "visible"
	}
mix4.length = 0
ranWord = parseInt(Math.random()*Words[ask].length)
MWa1 = Words[ask][ranWord]
InfoEnd = "The word was " + MWa1 + "."
MWa1 = MWa1.toUpperCase()
getmixX()
}
function makeMWa(){
mix2.length =  0 
MWa1 = MWa1.toUpperCase()
mix1[mix1.length] = MWa1
for(x=0;x<MWa1.length;x++){
mix2[mix2.length] = MWa1.charAt(x)
mix3[mix3.length] = blank
}
$i("board2").innerHTML = unescape(mix3.join(''))
}

document.onkeypress=GetKey

function getLet(x){
if(freeKey==0){
document.getElementById("foxEXC").style.left = "-690px"
ok=0
Akey=x
getAns()
}
}

function GetKey(){
if(freeKey==0){
if(window.event) // IE
	{
	theKey = event.keyCode;
	}
else if(event.which) // Netscape/Firefox/Opera
	{
	theKey = event.which;
	}
ok=0
Akey=String.fromCharCode(theKey)
getAns()
	}
}
function getAns(){
$i("board3").innerHTML = ""
ok=0
Akey = Akey.toUpperCase()
		for(k=0;k<keySet.length;k++){
		if(keySet[k]==Akey){
		$i("letter" + Akey).style.visibility = "hidden"
	for(x=0;x<mix2.length;x++){
	if(Akey==mix2[x]){
	mix3[x] = Akey
	spWord = unescape(mix3.join(''))
	$i("board2").innerHTML = spWord
ok=1
}}
usedLetters()
}
}
if(ok == 0){
a = 0
a = unescape(mix3.join(''))
a = a.replace(eval("/" + "_" + "/gi"), "")
a=a.length
b = mix4.length
d = b - a
c = 9
if(d > 0){
metHeight = metHeight*1+20
metTop = metTop*1-20
redL = redL+20
greenL  = greenL-20
$i("letMeter").style.top = metTop
$i("letMeter").style.height = metHeight
$i("letMeter").style.backgroundColor = "rgb("+ redL + "," + greenL + ", 0)"
$i("letMeter").style.filter = "progid:DXImageTransform.Microsoft.Gradient(gradientType=0,startColorStr=red,endColorStr=#ffff00;"
}
if(d == c){
$i("board3").innerHTML = infoD[9][mix3.length] + InfoEnd
missed +=1
$i("board4").innerHTML = "Missed " + missed
makeWord()
}}
if(spWord == MWa1){
if(mix1.length > 0){
spelled +=1
$i("board3").innerHTML = infoD[8][mix3.length] + InfoEnd
$i("board5").innerHTML = "Spelled " + spelled
} else {
welcome(2)
}
makeWord()
}
}
metTop = 160
metHeight = 20
spWord = 0
redL = 0
greenL = 255
missed = 0
spelled = 0
function Win(){
var msg2 = "You Got it! Load New Word."
$i("rightA").innerHTML = ""
makeWord()
}
infoD = new Array(5);
infoD[0] = "Practice spelling, power up your spelling skills!"; 
infoD[1] = "Welcome !!"; 
infoD[2] = "Spell words by selecting the right letters."; 
infoD[3] = "Nine wrong letters, you miss the word."; 
infoD[4] = "Use the key board or letter buttons."; 
infoD[5] = "For an added challenge use Timer."; 
infoD[6] = "Spell as many words as you can."; 
infoD[7] = "Play with a partner or an opponent!";
infoD[8] = new Array(13) 
infoD[8][0] = "You spelled another !! Way to Go!<BR>" 
infoD[8][1] = "You know your words !! Way to Go!<BR>" 
infoD[8][2] = "You spelled another !! Way to Go!<BR>" 
infoD[8][3] = "Wow!! You spelled another. Way to Go!<BR>" 
infoD[8][4] = "Excelent spelling !! Way to Go!<BR>" 
infoD[8][5] = "Your a Super Speller !! Way to Go!<BR>" 
infoD[8][6] = "Wow!! You spelled another. Way to Go!<BR>" 
infoD[8][7] = "Excellent spelling !! Way to Go!<BR>" 
infoD[8][8] = "Your a Super Speller !! Way to Go!<BR>" 
infoD[8][9] = "You spelled another !! Way to Go!<BR>" 
infoD[8][10] = "You know your words !! Way to Go!<BR>" 
infoD[8][11] = "You spelled another !! Way to Go!<BR>" 
infoD[8][12] = "Wow!! You spelled another. Way to Go!<BR>"
infoD[9] = new Array(13)
infoD[9][0] = "Wow! You missed that word.<BR>"
infoD[9][1] = "Hmm? You missed that word<BR>"
infoD[9][2] = "Sorry! You missed that word<BR>"
infoD[9][3] = "Tough word. Better luck next time<BR>"
infoD[9][4] = "Small words are hard! You missed that word<BR>"
infoD[9][5] = "Ah! You missed that word<BR>"
infoD[9][6] = "Wow! You missed that word<BR>"
infoD[9][7] = "Hmm? You missed that word<BR>"
infoD[9][8] = "Sorry! You missed that word<BR>"
infoD[9][9] = "Amost got the big one! You missed that word<BR>"
infoD[9][10] = "Ah! You missed that word<BR>"
infoD[9][11] = "Wow! You missed that word<BR>"
infoD[9][12] = "Hmm? You missed that word<BR>"
infoD[10] = "Welcome !!  Click a letter to start"; 
infoDX = 0
timerID = 0
function welcome(x){
if(x > 0 && x < 7){
infoDX = x
drawMath = "<div ID=mathContian style='position:absolute;left:0;top:0;height:80;width:690;padding:5;background:rgb(4,132,94);color:white;font-size:" + fTZ4 + ";font-family:"+ sFam +";font-weight:bold;overflow:hidden;filter:revealTrans(transition=6,duration=4)'>"
drawMath += "<DIV ID=mthD0 STYLE='position:absolute;left:0;top:0;visibility:hidden;'>" + infoD[x] + "</DIV><BR>"
drawMath += "</div>"
infoDX = infoDX*1+1
timerID = setTimeout("welcome("+ infoDX +")", 5000)
}else{
drawMath = "<div ID=mathContian style='position:absolute;left:0;top:0;height:80;width:690;padding:5;background:rgb(4,132,94);color:white;font-size:" + fTZ4 + ";font-family:"+ sFam +";font-weight:bold;overflow:hidden;filter:revealTrans(transition=6,duration=4)'>"
drawMath += "<DIV ID=mthD0 STYLE='position:absolute;left:0;top:0;visibility:hidden;'>" + infoD[x] +"</DIV><BR>"
drawMath += "</div>"
}
writeMath()
}

function writeMath(){
$i("board3").innerHTML = drawMath
    $i("mathContian").filters[0].Apply();
$i("mthD0").style.visibility = "visible"
    $i("mathContian").filters[0].Play();
}
