//========================================================================
//   "WebHangman"  JavaScript Hangman
//
//    This is a modified version by Chinmay Barve.
//    Jan Mulder is the author of the original WebHangman. (Copyright 2002)
//
//   This program is free software; you can redistribute it and/or modify
//   it under the terms of the GNU General Public License as published by
//   the Free Software Foundation; either version 2 of the License, or
//   (at your option) any later version, and as long as this notice is
//   kept unmodified at the top of the script source code.
//
//   This program is distributed in the hope that it will be useful,
//   but WITHOUT ANY WARRANTY; without even the implied warranty of
//   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//   GNU General Public License (license.txt) for more details.
//
//=======================================================================

var numRight = 0;
var numWrong = 0;
var wordCount = 0;
var doneAction = '';

var thisAnswer;
var thisHint;
var lastAnswer = '';
var answerIdx;
var blankChar = '*';
var answerDisplay;
var maxAttempts = 7;
var usedLetters = '';
var wrongLetters = '';
var maxLength = 0;

var gameOver = false;
var gameStart = true;
var isHint = false;
var imgWidth;
var imgHeight;
var cellDimension;
var firstRun = true;

tempArray = new Array();
wordArray = new Array();
var words = new Array(
"knoll","n. small round hill or mound",
"abase","n. lower, degrade; humiliate",
"abash","embarrass",
"abate","subside or moderate",
"abbreviate","shorten",
"abdicate","renounce; give up (position, right, or responsibility)",
"aberrant","abnormal or deviant",
"abet","assist usually in doing something wrong; encourage",
"abeyance","suspended action",
"abhor","detest; hate",
"abide","dwell; abide by: comply with; put up with; tolerate",
"abject","(of a condition) wretched; as low as possible; lacking pride; very humble",
"abjure","renounce upon oath",
"ablution","washing",
"abnegation","renunciation; self-sacrifice; self-abnegation",
"abode","dwelling place; home",
"abolish","cancel; put an end to",
"abominable","detestable; extremely unpleasant",
"abominate","loathe; hate",
"abrogate","abolish, repeal",
"absolve","pardon(an offense), forgive, acquit, exonerate",
"abysmal","bottomless",
"abyss","enormous chasm; vast bottomless pit",
"academic","related to a school; not practical or directly useful",
"accede","agree",
"accolade","award of merit; strong praise and approval",
"accomplice","partner in crime",
"accord","agreement",
"accost","approach and speak first to a person",
"accoutre","equip",
"accretion","growth, increase",
"accrue","come out by addition",
"acme","pinnacle; peak; higest point",
"acquiesce","assent; agree passively",
"adamant","hard; inflexible",
"adapt","make or become suitable for a specific use",
"addendum","addition; appendix to book",
"addiction","compulsive habitual need",
"addle","make or become confused; muddle; drive crazy; become rotten (egg)",
"address","direct a speech to",
"adept","expert at; very skilled",
"adhere","stick fast; be a devotd follower; N. adhesion: adhering",
"advocate","urge; plead for",
"aesthetic","artistic",
"affected","artificial; prtended",
"affinity","feeling of kinship; similarity",
"affirmation","positive assertion; confirmation",
"affliction","state of distress",
"affluence","abundance; wealth",
"affront","insult; offense",
"afterlife","life after death; later part of one's life",
"agenda","items of business at a meeting",
"agglomeration","collection",
"aggrandize","make greater; increase in power, wealth, rank, or honor",
"agility","nimbleness",
"alcove","nook; recess",
"alias","an assumed name esp. by a criminal",
"alienate","make unfriendly or hostile; estrange; separate; change the ownership of",
"alimentary","supplying nourishment",
"allegory","fable; story in which characters are used as symbols",
"alleviate","relieve (pain)",
"alluvial","pertaining to soil deposits left by running water",
"alms","money or goods given to the poor",
"aloft","upward; high up in the air",
"aloof","apart; not open in one's relationship with other people; reserved; ADV.",
"altercation","noisy quarrel",
"altruistic","unselfishly generous",
"amalgam","combination of different things",
"ambidextrous","capable of using either hand with equal ease",
"ambience","environment; atmosphere",
"ambiguous","unclear or doubtful in meaning; having more than one possible interpretation",
"amend","correct; change ; generally for the better",
"amenities","convenient features that helps to make life pleasant; social courtesies",
"amiable","agreeable; lovable; warmly friendly",
"amicable","peaceful; politely friendly; not quarrelsome; Ex. amicable settlement",
"amiss","wrong; faulty; Ex. something amiss; ADV.",
"amity","friendship; peaceful relationship as between nations",
"amnesia","loss of memory",
"amnesty","pardon (allowed by government to political criminals)",
"amok(amuck)","in a state of rage; Ex. run amok",
"amoral","nonmoral; having no understanding of right and wrong",
"amorous","moved by sexual love; loving; of sexual love; Ex. amorous advances",
"amorphous","formless; lacking shape or definition",
"amphibian","able to live both on land and in water; N.",
"amphitheater","oval building with tiers of seats; CF. arena",
"ample","enough; abundant; spacious; large in size",
"amplify","increase in size or effect",
"amputate","cut off part of body; prune (a limb)",
"amulet","charm; talisman; an object worn believed to protect against evil, bad luck",
"anachronism","an error involving time in a story",
"analgesia","condition of being unable to feel pain",
"anchor","secure or fasten firmly; be fixed in place; N. anchorage",
"ancillary","serving as an aid or accessory; auxiliary; N.",
"anonymity","state of being nameless; anonymousness; ADJ. anonymous",
"antagonism","hostility; active opposition",
"antecede","precede",
"apathy","lack of caring; indifference",
"ape","imitate or mimic (a person's behavior or manner)",
"aperture","opening; hole; adjustable opening in a camera that limits the amount of light",
"apex","tip; summit; climax; highest point",
"aphasia","loss of speech due to injury or illness",
"aphorism","pithy maxim or saying; ADJ. aphoristic",
"apiarist","person who keeps bees",
"apiculture","bee-keeping",
"aplomb","poise; composure in difficult situations; assurance; self-confidence",
"apocalyptic","prophetic; pertaining to revelations especially of disaster",
"apocryphal","(of a story) widely believed but untrue",
"apogee","highest point; the point farthest from the earth; OP. perigee",
"apolitical","having an aversion or lack of concern for political affairs",
"apologist","one who writes in defense of a cause or institution",
"apoplexy","stroke; loss of consciousness caused by too much blood in the brain",
"apostate","one who abandons his religious faith or political beliefs",
"apothecary","druggist; pharmacist",
"apothegm","pithy, compact saying",
"artless","without guile; open and honest",
"ascendancy","controlling influence",
"ascertain","find out for certain; make certain",
"ascetic","practicing self-denial",
"astronomical","enormously large or extensive",
"astute","wise; shrewd; keen; seeing quickly something that is to one's advantage",
"asunder","into parts; apart; V. sunder",
"asylum","place of refuge or shelter; protection (religious or political)",
"asymmetric","not identical on both sides of a dividing central line",
"atavism","resemblance to remote ancestors rather than to parents",
"atheistic","denying the existence of God; N. atheism",
"atone","make amends for; pay for; Ex. atone for",
"atrocity","brutal deed; ADJ. atrocious",
"atrophy","wasting away",
"attentive","alert and watchful",
"attenuate","make thin; weaken",
"attest","testify; bear witness",
"attire","clothe; N: clothing; array; apparel",
"attribute","essential quality; V: ascribe; explain",
"attrition","rubbing away by friction",
"atypical","not normal; not typical",
"audacious","daring; bold; N. audacity",
"audit","examination of accounts of a business; official examination",
"augment","increase; add to",
"augury","omen",
"august","impressive; majestic",
"aureole","sun's corona; halo; bright circle of light",
"auroral","pertaining to the aurora borealis; CF. aurora australis",
"efface","v. rub or wipe (sth) out; cause to fade",
"effective","adj. having an effect; producing the intended result",
"effectual","adj. (not used of people) producing the intended result",
"effectuate","to cause to happen; effect; accomplish",
"effeminate","adj. (of a man or his behaviour) like a woman; unmanly",
"effervescence","(n.) liveliness; spirit; enthusiasm; bubbliness",
"effete","adj. weak, having lost power",
"enumerate","v. name one by one; count",
"enunciate","v. say or pronounce clearly",
"environ","enclose; surround",
"fiasco ","n. complete and ridiculous failure",
"fiat ","n. formal authorization, order or decree",
"fickle ","adj. often changing; not constant",
"fictitious ","adj. imagined or invented; not real",
"fidelity ","n. ~ loyalty; faithfulness",
"gambol ","v. (US also -l-) jump or skip about playfully",
"gamely ","adv: fight, struggle, etc gamely, ie bravely but perhaps unsuccessfully ,",
"gamut ","n. the gamut complete range or scale",
"gangrene ","n. decay and death of body tissue when the blood supply has been stopped",
"gape ","v. ~ (often derog ) stare with an open mouth, usu in surprise",
"garbled ","adj. confusedor misleading",
"glut ","v. ~ sth (with sth) supply sth with much more than is needed",
"glutinous ","adj. of or like gluten; sticky",
"glutton ","n. person who eats too much",
"guffaw ","v. give a noisy laugh",
"guile ","n. deceit; cunning",
"guileless ","without deceit",
"guise ","n. style of dress",
"illuminate ","v. provide with light",
"illusion ","n. false idea, belief or impression; delusion",
"illusive ","adjs. based on illusion; deceptive",
"illusory ","based on or producing illusion:DECEPTIVE",
"imbalance ","n. lack of balance or proportion; inequality",
"imbecility ","n. stupidity",
"imbibe ","v. drink (sth, esp alcohol)",
"invidious ","adj. likely to cause resentment or unpopularity",
"invincible ","adj. too strong to be overcome or defeated",
"inviolable ","adj. that must not be violated or dishonoured",
"jingoism","n. extreme and unreasonable belief that one's own country is best, together with a warlike attitude towards other countries",
"jingoist","n. person who has such a belief",
"jocose","adj. humorous; playful ;",
"jocular","adj. meant as a joke; humorous",
"jocund","adj. merry; cheerful ;","amenable","obedient; compliant",
"juridical","adj. of law or legal proceedings",
"jurisdiction","n. authority to carry out justice and to interpret and apply laws; right to exercise legal authority",
"jurisprudence","n. science or philosophy of law",
"juxtapose","v. place (people or things) side by side or very close together, esp to show a contrast",
"kaleidoscope","n. toy consisting of a tube containing small loose pieces of coloured glass, etc and mirrors which reflect these to form changing patterns when the tube is turned",
"ken","n. beyond/outside one's ken not within one's range of knowledge",
"kernel","n. soft and usu edible part inside a nut or fruit stone .",
"killjoy","n. person who spoils the enjoyment of others",
"kindle","v. catch fire",
"kindred","n. family relationship",
"kinetic","adj. of or produced by movement",
"knotty","adj. (of timber) full of knots",
"lace","n. delicate fabric with an ornamental openwork design of threads",
"lacerate","v. injure by tearing",
"laceration","n. tearing of the flesh",
"libretto","n. words that are sung and spoken in an opera or musical play",
"license","v. give a licence to",
"licentious","adj. disregarding the rules of behaviour, esp in sexual matters",
"lien","n. ~ (on/upon sth) right to keep sb's property until a debt owed in connection with it (for repair, transport, etc) is paid ,",
"ligneous","adj. woody",
"lilliputian","adj. on a small scale; tiny",
"log","n. length of tree-trunk that has fallen or been cut down",
"loiter","v. ~ stand about idly",
"loll","v. ~ rest, sit or stand lazily, often while leaning against sth",
"longevity","n. long life",
"lookout","the act of keeping watch against danger, etc.",
"loom","n. machine for weaving cloth",
"mauve","adj. n pale purple colour",
"maverick","n. unbranded calf",
"mawkish","adj. sentimental in a feeble or sickly way",
"maxim","n. saying that expresses a general truth or rule of conduct, eg `Waste not, want not' ,",
"mayhem","n. violent disorder or confusion; havoc",
"meager","deficient in quality or quantity",
"ploy","n. words or actions, eg in a game, intended to win an advantage over one's opponent",
"pluck","v. ~ sth gather or remove sth by pulling; pick sth",
"plumage","n. feathers covering a bird's body",
"plumb","n. piece of lead that is tied to a cord and used to find the depth of water or test whether a wall, etc is vertical ,",
"plumber","n. person whose job is to fit and repair water-pipes, water-tanks, cisterns, etc in buildings",
"plume","n. feather, esp a large one used as a decoration",
"plummet","n. plumb-line",
"plump","adj. (esp of an animal, a person, parts of the body) having a full rounded shape; fleshy",
"raconteur","n. person who tells stories skilfully and wittily",
"raffle","n. lottery with an article as the prize",
"rag","n. odd cloth, usu torn, frayed, etc",
"ragamuffin","n. person, esp a small boy, in dirty untidy clothes",
"rail","n. level or sloping bar or connected series of bars of wood or metal, eg forming part of a fence, the top of a banister, a protective barrier, etc",
"rolling","having gentle rising and falling slopes; undulating",
"romp","v. play about together in a lively way, running, jumping, etc",
"rooster","n. = cock 1",
"roseate","adj. deep pink",
"rusticate","v. send (a student) away from university temporarily, as a punishment",
"rustle","v. make a dry light sound, esp by friction or rubbing together",
"ruthless","adj. having or showing no pity or compassion; cruel",
"saboteur","n. person who commits sabotage",
"saccharine","adj. very sweet; too sweet",
"sacrilegious","desecrating; profane",
"sacrosanct","adj. considered too important to be changed, argued about, etc",
"sadistic","adj. of or showing sadism",
"sensuous","adj. affecting, noticed by or giving pleasure to the senses",
"sententious","adj. expressing pompous moral judgements",
"sentient","adj. capable of perceiving or feeling things",
"sentimental","adj. of or concerning the emotions, rather than the reason",
"sentinel","n. sentry",
"torpor","n. torpid condition",
"torque","n. twisting force causing rotation in machinery",
"torrent","n. violently rushing stream of water, lava, etc",
"torrid","adj. very hot and dry",
"undermine","v. make a hollow or tunnel beneath (sth); weaken at the base",
"yore","n. of yore (arch or rhet ) long ago",
"zany","adj. (infml ) amusingly ridiculous; eccentric",
"zeal","n. ~ (for sth) (usu intense) energy or enthusiasm; keenness",
"zealot","n. person who is extremely enthusiastic about sth, esp religion or politics; fanatic ",
"zenith","n. point in the heavens directly above an observer"
);

alphaLower = 'abcdefghijklmnopqrstuvwxyz';

doneLoading = false;
imageCount = 0;
var progressBar = '||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||';

function updateProgress(ims)
{
 var cnt=0;

 for(var i = 0; i < ims.length; i++)
  if(ims[i].complete || ims[i].errored) cnt++;

 if(ims.length > 0)
    window.status='Loading ['+Math.round((cnt / imageCount)*100)+'%] ' + progressBar.substring(0, cnt);

 if(cnt < ims.length)
 {
  tempArray = ims;
  setTimeout("updateProgress(tempArray)",200);
 }
 else
  onComplete();
}

function onComplete()
{
 window.status='Done';
 doneLoading = true;
}

function preloadImages()
{
 this.length = preloadImages.arguments.length;
 imageCount = this.length;
 for (var i = 0; i < this.length; i++)
 {
  this[i] = new Image();
  this[i].errored=false;
  this[i].onerror=new Function("this["+i+"].errored=true");
  this[i].src = preloadImages.arguments[i];
 }
 updateProgress(this);
}

var pictures = new preloadImages(
 sourceDir+"newbtn.gif", sourceDir+"scores.gif", sourceDir+"hintbtn.gif", 
 sourceDir+"a.gif", sourceDir+"b.gif", sourceDir+"c.gif", sourceDir+"d.gif",
 sourceDir+"e.gif", sourceDir+"f.gif", sourceDir+"g.gif", sourceDir+"h.gif",
 sourceDir+"i.gif", sourceDir+"j.gif", sourceDir+"k.gif", sourceDir+"l.gif",
 sourceDir+"m.gif", sourceDir+"n.gif", sourceDir+"o.gif", sourceDir+"p.gif",
 sourceDir+"q.gif", sourceDir+"r.gif", sourceDir+"s.gif", sourceDir+"t.gif",
 sourceDir+"u.gif", sourceDir+"v.gif", sourceDir+"w.gif", sourceDir+"x.gif",
 sourceDir+"y.gif", sourceDir+"z.gif",
 sourceDir+"image1.gif", sourceDir+"image2.gif", sourceDir+"image3.gif", sourceDir+"image4.gif",
 sourceDir+"image5.gif", sourceDir+"image6.gif", sourceDir+"lose.gif", sourceDir+"win.gif"
);

function doFunction(aFunction)
{
 if (aFunction.indexOf('(') > -1)
   eval( aFunction );
 else
   eval(aFunction+'()');
}

function endGame()
{
  gameOver = true;
  document.control.you.value = numRight;
  document.control.me.value = numWrong;
  if (doneAction != '')
    doFunction(doneAction);
}

function showHint()
{
  if (wrongLetters.indexOf(blankChar) == -1)
    wrongLetters = wrongLetters+blankChar;

   if ( wrongLetters.length < maxAttempts )
     document.hangimage.src=sourceDir+"image"+wrongLetters.length+".gif";

  document.hintForm.hint.value=thisHint;
}

function setBrowserInfo(cd, iw, ih)
{
  cellDimension = cd;
  imgWidth = iw;
  imgHeight = ih;
}

function getBrowserInfo()
{
  isOpera = (navigator.userAgent.indexOf('Opera') != -1);

  if (isOpera)
    setBrowserInfo(0, 50, 26);
  else if (navigator.appName == 'Netscape')
    setBrowserInfo(0, 49, 26);
  else
    setBrowserInfo(1, 48, 24);
}

function updateAnswer( str )
{
  for (var i=0; i < str.length; i++)
  {
    if ((lastAnswer.charAt(i) == str.charAt(i)) && (!gameStart))
      continue;
    if (str.charAt(i) == " ")
      eval('document.ans'+i+'.src="'+sourceDir+'space.gif"');
    else if (str.charAt(i) == blankChar)
      eval('document.ans'+i+'.src="'+sourceDir+'blank.gif"');
    else
      eval('document.ans'+i+'.src="'+sourceDir+str.charAt(i)+'.gif"');
  }
  lastAnswer = str;

  if (gameStart)
    for (var i=str.length; i < maxLength; i++)
       eval('document.ans'+i+'.src="'+sourceDir+'space.gif"');

  gameStart = false;
}

function arrayDelete( arrayName, delIndex )
{
  var ar = new Array();
  for (var ii = 0; ii < arrayName.length; ii++)
  {
     if (ii != delIndex)
      ar[ar.length] = arrayName[ii];
  }
  return ar;
}

function Word(aWord,aHint)
{
  this.value=aWord;
  this.hint=aHint;
  if (aWord.length > maxLength)
    maxLength = aWord.length;
}

function loadWords( wArray )
{
  var ar = new Array();

  for (var i=0; i < wArray.length; i=i+2)
    ar[ar.length] = new Word(wArray[i], wArray[i+1]);

  wordCount = ar.length;
  return ar;
}

function newPuzzle()
{
  gameOver = false;
  gameStart = true;
  usedLetters = '';
  wrongLetters = '';
  answerDisplay= '';
  lastAnswer = '';

  for (var i=0; i < 26; i++)
    eval('document.img'+alphaLower.charAt(i)+'.src="'+sourceDir+alphaLower.charAt(i)+'.gif"');

  answerIdx = Math.floor(Math.random()*wordArray.length);
  thisAnswer = (wordArray[answerIdx].value).toLowerCase();
  thisHint = wordArray[answerIdx].hint;

  if (wordArray.length > 1)
    wordArray = arrayDelete( wordArray, answerIdx );
  else
    wordArray = loadWords(words);

  for(var i=0; i<thisAnswer.length; i++)
  {
     if ( thisAnswer.charAt(i) == " " )
       answerDisplay = answerDisplay+" ";
     else
       answerDisplay = answerDisplay+blankChar;
  }

  updateAnswer(answerDisplay);

  if (isHint)
    document.hintForm.hint.value=' ';

  document.hangimage.src=sourceDir + "image0.gif";

  if ((firstRun) && (navigator.appName == 'Netscape'))
    setTimeout('netscapeLoad()',1000);

  firstRun = false;
}

function netscapeLoad()
{
  for (var i=0; i < answerDisplay.length; i++)
    if (answerDisplay.charAt(i) == blankChar)
      eval('document.ans'+i+'.src="'+sourceDir+'blank.gif"');
}

function check(character)
{
  if (gameOver) return;
  if (usedLetters.indexOf(character) == -1)
  {
    usedLetters = usedLetters+character;
    eval('document.img'+character+'.src="'+sourceDir+'space.gif"');
  }
  else
    return;

  var wrongLetter = true;
  for( i = 0; i < thisAnswer.length; i++ )
  {
    if ( thisAnswer.indexOf(character, i) == -1 ) break;

    if ( thisAnswer.charAt(i) == character )
    {
       wrongLetter = false;
       if( i == 0 )
         answerDisplay = character + answerDisplay.substring(i+1,thisAnswer.length);
       else if ( i == thisAnswer.length-1 )
         answerDisplay = answerDisplay.substring(0,i)+character;
       else
         answerDisplay = answerDisplay.substring(0,i)+character+answerDisplay.substring(i+1,thisAnswer.length);
     }
  }

  if (wrongLetter)
  {
    if (wrongLetters.indexOf(character) == -1)
      wrongLetters = wrongLetters+character;

     if ( wrongLetters.length < maxAttempts )
       document.hangimage.src=sourceDir+"image"+wrongLetters.length+".gif";
     else
     {
        updateAnswer(thisAnswer);
        document.hangimage.src = sourceDir+"lose.gif";
        numWrong++;
        endGame();
     }
  }
  else
  {
    updateAnswer(answerDisplay);

    if( answerDisplay.indexOf(blankChar) == -1 )
    {
      document.hangimage.src=sourceDir+"win.gif";
      numRight++;
      endGame();
    }
  }
}

function drawAnswer()
{
  wordArray = loadWords(words);
  for (var i=0; i < maxLength; i++)
  {
    document.writeln(
    '<img border=0 SRC=\''
    + sourceDir + 'space.gif\' name="ans'
    + i
    +'">'
    );
  }
  newPuzzle();
}

function drawControl()
{
document.writeln('<FORM name="control">');

document.writeln(
  '<TABLE border="0" bgcolor="#FFFFFF" cellspacing="'+cellDimension+'" cellpadding="'+cellDimension+'"><TR>'
  +'<TD background="'+sourceDir+'newbtn.gif" width="'+imgWidth+'" height="'+imgHeight+'"><A href="javascript:void(newPuzzle())"><IMG border=0 SRC="'+sourceDir+'space.gif" width="42" height="22" alt="new puzzle"></A></TD>'
  +'<TD background="'+sourceDir+'scores.gif" >'
  +'<IMG border=0 SRC="'+sourceDir+'space.gif" width="90" height="10"><input type="text" size="2" name="you" value="0">'
  +'<IMG border=0 SRC="'+sourceDir+'space.gif" width="90" height="10"><input type="text" size="2" name="me" value="0"></B></TD>'
  +'</TR><TR><TD colspan=3 bgcolor="#FFFFFF" align="center">'
);

document.writeln('<table border="0" bgcolor="#FFFFFF" cellpadding="3"><tr>');
for (var i=0; i < 13; i++)
{
  document.writeln('<td align="center">');

  if (navigator.appName == 'Netscape')
    document.writeln(
    '<A href=\'javascript:void(check("'
    + alphaLower.charAt(i)
    + '"))\'>'
    );
  document.writeln(
  '<img width=16 height=16 border=0 SRC=\''
  + sourceDir + alphaLower.charAt(i)
  + '.gif\' onClick=\'check("'
  + alphaLower.charAt(i)
  + '")\' name="img'
  + alphaLower.charAt(i)
  + '"></A></td>'
  );
}

document.writeln('</tr><tr>');

for (var i=13; i < 26; i++)
{
  document.writeln('<td align="center">');

  if (navigator.appName == 'Netscape')
    document.writeln(
    '<A href=\'javascript:void(check("'
    + alphaLower.charAt(i)
    + '"))\'>'
    );
  document.writeln(
  '<img border=0 width=16 height=16 SRC=\''
  + sourceDir + alphaLower.charAt(i)
  + '.gif\' onClick=\'check("'
  + alphaLower.charAt(i)
  + '")\' name="img'
  + alphaLower.charAt(i)
  + '"></A></td>'
  );
}

document.writeln('</tr></table></td></tr></TABLE>');
document.writeln('</FORM>');
}

function drawHangman()
{
  document.writeln('<img name="hangimage" src="'+sourceDir+'image0.gif" width=140 height=180>');
}

function drawHint()
{
  isHint = true;

  document.writeln('<FORM name="hintForm">');
  document.writeln(
  '<TABLE border="0" bgcolor="#FFFFFF" cellspacing="'+cellDimension+'" cellpadding="'+cellDimension+'"><TR>'
  +'<TD background="'+sourceDir+'hintbtn.gif" width="'+imgWidth+'" height="'+imgHeight+'"><A href="javascript:void(showHint())"><IMG border=0 SRC="'+sourceDir+'space.gif" width="42" height="22" alt="show hint"></A></TD>'
  +'<TD><input type="text" size="35" name="hint" value=""></TD>'
  +'</TR></TABLE></FORM>'
  );

}

getBrowserInfo();