/*
 * Program - JS Joga-Khichuri
 * File Name - js_joga.js
 * Author - Mohammad Ahsanul Haque Shovon
 * Web site - http://www29.websamba.com/shovon
 * Email - ahsanul_haque_shovon@yahoo.com
 * (C) ShuvoRim Pvt. Ltd.
 * All rights reserved.
 */


//global variables
var tm = ""; //timer instance


//These are the opponent names who will play against
//the player.
var opponents = new Array(
 "Shiyal Pondit", "Koi Maas", "Hard Rock", "Sister Mina", "Richard Max", 
 "Chinku Pinku", "DR Damn", "Diana Ray", "Haha Hoho", "Lallu Modon", 
 "Shayla Rahman", "Kuddus Bayati", "Kutub Molla", "Kankata Romjan", 
 "Fotik Mama", "Pinky Saha", "Disco Rani", "Cute Boy", "Robotrix", 
 "Monty Khan"
);


/***********************************
 * FUNCTION: get_random_opp()
 * ARGUMENTS: None.
 * PURPOSE: Gets a random opponent.
 ***********************************/
function get_random_opp()
{
  //picking a number between 0 to 19
  var opp_idx = Math.floor(Math.random() * 20);

  //setting the opponent's name
  var opp_name = opponents[opp_idx];

  //returning opponent name to the caller
  return opp_name;
}


/*******************************
 * FUNCTION: new_game()
 * ARGUMENTS: None.
 * PURPOSE: Starts a new game.
 *******************************/
function new_game()
{
  var msg = "This will start a new game and resets your current score.";
  msg += "\nAre you sure you want to start a new game?";

  //confirms before starting a new game
  if(window.confirm(msg))
  {
    //all default values
    document.getElementById("js_joga_pane").innerHTML = "Click on 'Start Game'";
    document.getElementById("vs").innerHTML = "Your opponent: ";

    with(document.js_joga_form)
    {
      //setting all default values
      score.value = "0";
      time.value = "35";
      difficulty[0].disabled = false;
      difficulty[1].disabled = false;
      difficulty[2].disabled = false;
      difficulty[1].checked = true;
      guess.value = "";
      guess.disabled = true;
      start.disabled = false;
      checkit.disabled = true;
      window.defaultStatus = "";
      window.clearInterval(tm);
    }

    return true;
  }
}


/*******************************
 * FUNCTION: js_refresh()
 * ARGUMENTS: None.
 * PURPOSE: This function fires 
 * whenever the player presses 
 * F5 or Ctrl+R or Refresh or 
 * Reload button in the browser.
 *******************************/
function js_refresh()
{
  document.getElementById("js_joga_pane").innerHTML = "Click on 'Start Game'";
  document.getElementById("vs").innerHTML = "Your opponent: ";

  with(document.js_joga_form)
  {
    //setting all default values
    score.value = "0";
    time.value = "35";
    difficulty[0].disabled = false;
    difficulty[1].disabled = false;
    difficulty[2].disabled = false;
    difficulty[1].checked = true;
    guess.value = "";
    guess.disabled = true;
    start.disabled = false;
    checkit.disabled = true;
    window.defaultStatus = "";
    window.clearInterval(tm);
  }

  return true;
}


//The words to use in the game
var words = new Array(
 //Words for the Easy level (Length: 3-4)
 "SEA", "TEA", "VIA", "JOB", "PUB", "ADD", "AID", "AND", "AND", "BAD", "BED", "DID", "END", "END", "GOD", "HAD", "KID", "NOD", "ODD", "OLD", "RED", "AGE", "ARE", "AYE", "DIE", "DUE", "EYE", "FEE", "LIE", "ONE", "ONE", "SEE", "SEE", "SHE", "SHE", "THE", "THE", "USE", "USE", "USE", "OFF", "OFF", "BAG", "BIG", "DOG", "EGG", "LEG", "ASK", "ALL", "ALL", "ALL", "OIL", "AIM", "AIM", "ARM", "HIM", "HIM", "SUM", "CAN", "CAN", "GUN", "MAN", "OWN", "OWN", "RUN", "RUN", "SON", "SUN", "WIN", "AGO", "TOO", "TWO", "WHO", "WHO", "CUP", "LIP", "MAP", "TOP", "TOP", "AIR", "BAR", "CAR", "EAR", "FAR", "FAR", "FOR", "FOR", "FOR", "HER", "HER", "HER", "NOR", "OUR", "PER", "SIR", "WAR", "BUS", "COS", "GAS", "HAS", "HIS", "HIS", "HIS", "ITS", "WAS", "YES", "ACT", "ACT", "ART", "BIT", "BUT", "BUT", "CAT", "CUT", "CUT", "EAT", "FIT", "GET", "HIT", "HOT", "LET", "LOT", "NOT", "NOT", "OUT", "OUT", "PUT", "SET", "SET", "SIT", "YET", "YOU", "YOU", "FEW", "FEW", "HOW", "LAW", "LOW", "NEW", "NOW", "NOW", "ROW", "BOX", "FIX", "SEX", "TAX", "ANY", "BOY", "BUY", "CRY", "DAY", "DRY", "FLY", "KEY", "KEY", "LAY", "MAY", "PAY", "SAY", "SKY", "TRY", "WAY", "WAY", "WHY", 

 //Words for the Normal level (Length: 5-6)
 "ABLE", "ABOUT", "ABOVE", "ACID", "ADMIT", "ADOPT", "ADULT", "AFTER", "AFTER", "AFTER", "AGAIN", "AGENT", "AGREE", "AHEAD", "ALLOW", "ALONE", "ALONG", "ALONG", "ALSO", "AMONG", "ANGEL", "APART", "APPLY", "AREA", "ARGUE", "ARISE", "ARMY", "ASSET", "AVOID", "AWARD", "AWARE", "AWAY", "BABY", "BACK", "BACK", "BALL", "BAND", "BANK", "BASE", "BASE", "BASIC", "BASIS", "BEAR", "BEAT", "BEEN", "BEGIN", "BELOW", "BELOW", "BEST", "BILL", "BIND", "BIRD", "BIRTH", "BLACK", "BLOCK", "BLOOD", "BLOW", "BLUE", "BOARD", "BOAT", "BODY", "BONE", "BOOK", "BOTH", "BOTH", "BRAIN", "BREAK", "BRIEF", "BRING", "BROAD", "BUILD", "BURN", "BUSY", "CALL", "CALL", "CARD", "CARE", "CARE", "CARRY", "CASE", "CASH", "CATCH", "CAUSE", "CAUSE", "CELL", "CHAIN", "CHAIR", "CHEAP", "CHECK", "CHIEF", "CHILD", "CITY", "CIVIL", "CLAIM", "CLAIM", "CLASS", "CLEAN", "CLEAR", "CLEAR", "CLIMB", "CLOSE", "CLOSE", "CLOSE", "CLUB", "COAL", "CODE", "COLD", "COME", "COPY", "COST", "COST", "COULD", "COUNT", "COURT", "COVER", "COVER", "CRIME", "CROSS", "CROWD", "DARK", "DATA", "DATE", "DATE", "DEAD", "DEAL", "DEAL", "DEATH", "DEBT", "DEEP", "DEEP", "DENY", "DESK", "DOOR", "DOUBT", "DOWN", "DRAW", "DREAM", "DRESS", "DRESS", "DRINK", "DRINK", "DRIVE", "DRIVE", "DROP", "DRUG", "DUTY", "EACH", "EACH", "EARLY", "EARLY", "EARN", "EARTH", "EAST", "EASY", "EDGE", "ELSE", "EMPTY", "ENEMY", "ENJOY", "ENTER", "ENTRY", "EQUAL", "ERROR", "EVEN", "EVENT", "EVER", "EVERY", "EXIST", "EXTRA", "FACE", "FACE", "FACT", "FAIL", "FAIR", "FAITH", "FALL", "FALL", "FARM", "FAST", "FEAR", "FEEL", "FIELD", "FIGHT", "FILE", "FILL", "FILM", "FINAL", "FIND", "FIND", "FINE", "FIRE", "FIRM", "FIRST", "FISH", "FLAT", "FLOOR", "FLOW", "FOCUS", "FOOD", "FOOT", "FORCE", "FORM", "FREE", "FRESH", "FROM", "FROM", "FRONT", "FRONT", "FRUIT", "FUEL", "FULL", "FULLY", "FUND", "FUNNY", "GAIN", "GAME", "GATE", "GIRL", "GIVE", "GLASS", "GOAL", "GOLD", "GOOD", "GRANT", "GREAT", "GREEN", "GREY", "GROUP", "GROW", "GUEST", "GUIDE", "HAIR", "HALF", "HALL", "HAND", "HANG", "HAPPY", "HARD", "HARD", "HATE", "HAVE", "HEAD", "HEAD", "HEAR", "HEART", "HEAT", "HEAVY", "HELL", "HELP", "HENCE", "HERE", "HIDE", "HIGH", "HILL", "HOLD", "HOLE", "HOME", "HOPE", "HOPE", "HORSE", "HOTEL", "HOUR", "HOUSE", "HUGE", "HUMAN", "HURT", "IDEA", "IMAGE", "IMPLY", "INDEX", "INTO", "IRON", "ISSUE", "ISSUE", "ITEM", "JOIN", "JOINT", "JUDGE", "JUDGE", "JUMP", "JUST", "KEEP", "KILL", "KIND", "KING", "KNEE", "KNOW", "KNOW", "LACK", "LADY", "LAND", "LARGE", "LAST", "LATE", "LATER", "LAUGH", "LEAD", "LEAF", "LEAN", "LEARN", "LEAST", "LEAVE", "LEFT", "LEGAL", "LESS", "LEVEL", "LIFE", "LIFT", "LIGHT", "LIKE", "LIKE", "LIKE", "LIMIT", "LINE", "LINK", "LIST", "LIVE", "LOAN", "LOCAL", "LONG", "LOOK", "LORD", "LOSE", "LOSS", "LOVE", "LUNCH", "MADE", "MAIN", "MAJOR", "MAKE", "MALE", "MANY", "MARK", "MARRY", "MASS", "MATCH", "MAYBE", "MEAL", "MEAN", "MEANS", "MEDIA", "MEET", "METAL", "MIGHT", "MILE", "MILK", "MIND", "MINE", "MISS", "MODEL", "MONEY", "MONTH", "MORE", "MOST", "MOTOR", "MOUTH", "MOVE", "MOVE", "MUCH", "MUSIC", "MUST", "NAME", "NEAR", "NECK", "NEED", "NEVER", "NEWS", "NEXT", "NEXT", "NICE", "NIGHT", "NOISE", "NONE", "NORTH", "NOSE", "NOTE", "NURSE", "OCCUR", "OFFER", "OFTEN", "OKAY", "ONCE", "ONLY", "ONTO", "OPEN", "ORDER", "OTHER", "OUGHT", "OVER", "OWNER", "PAGE", "PAIN", "PAINT", "PAIR", "PANEL", "PAPER", "PARK", "PART", "PARTY", "PASS", "PAST", "PATH", "PEACE", "PHASE", "PHONE", "PICK", "PIECE", "PLACE", "PLAN", "PLANT", "PLATE", "PLAY", "PLAY", "PLUS", "POINT", "POOL", "POOR", "POST", "POUND", "POWER", "PRESS", "PRICE", "PRIME", "PROVE", "PULL", "PUPIL", "PUSH", "QUICK", "QUIET", "QUITE", "RACE", "RADIO", "RAIN", "RAISE", "RANGE", "RARE", "RATE", "REACH", "READ", "READY", "REAL", "REFER", "RELY", "REPLY", "REST", "REST", "RICH", "RIDE", "RIGHT", "RING", "RISE", "RISK", "RIVER", "ROAD", "ROCK", "ROLE", "ROLL", "ROOF", "ROOM", "ROUND", "ROUTE", "ROYAL", "RULE", "RURAL", "SAFE", "SAID", "SALE", "SAME", "SAVE", "SCALE", "SCENE", "SCORE", "SEAT", "SEEK", "SEEM", "SELL", "SEND", "SENSE", "SERVE", "SHAKE", "SHALL", "SHAPE", "SHARE", "SHARE", "SHEET", "SHIP", "SHOE", "SHOOT", "SHOP", "SHORT", "SHOT", "SHOUT", "SHOW", "SHOW", "SHUT", "SIDE", "SIGHT", "SIGN", "SIGN", "SINCE", "SING", "SITE", "SIZE", "SKILL", "SKIN", "SLEEP", "SLIP", "SLOW", "SMALL", "SMILE", "SOFT", "SOIL", "SOME", "SONG", "SOON", "SORRY", "SORT", "SOUND", "SOUTH", "SPACE", "SPEAK", "SPEED", "SPEND", "SPORT", "SPOT", "STAFF", "STAGE", "STAND", "STAR", "START", "STATE", "STAY", "STEAL", "STEP", "STICK", "STILL", "STOCK", "STONE", "STOP", "STORE", "STORY", "STUDY", "STUFF", "STYLE", "SUCH", "SURE", "TABLE", "TAKE", "TALK", "TALL", "TAPE", "TASK", "TEACH", "TEAM", "TEAR", "TELL", "TEND", "TERM", "TERMS", "TEST", "TEXT", "THAN", "THANK", "THAT", "THEIR", "THEM", "THEME", "THEN", "THERE", "THESE", "THEY", "THIN", "THING", "THINK", "THIS", "THOSE", "THROW", "THUS", "TIME", "TINY", "TITLE", "TODAY", "TONE", "TOOL", "TOOTH", "TOTAL", "TOTAL", "TOUCH", "TOUCH", "TOUR", "TOWN", "TRACK", "TRADE", "TRAIN", "TREAT", "TREE", "TREND", "TRIAL", "TRIP", "TROOP", "TRUE", "TRUST", "TRUTH", "TURN", "TWICE", "TYPE", "UNDER", "UNION", "UNIT", "UNTIL", "UPON", "UPPER", "URBAN", "USED", "USER", "USUAL", "VALUE", "VARY", "VAST", "VERY", "VIDEO", "VIEW", "VISIT", "VITAL", "VOICE", "VOTE", "WAGE", "WAIT", "WALK", "WALL", "WANT", "WARM", "WARN", "WASH", "WATCH", "WATER", "WAVE", "WEAK", "WEAR", "WEEK", "WELL", "WERE", "WEST", "WHAT", "WHEN", "WHEN", "WHERE", "WHICH", "WHILE", "WHITE", "WHOLE", "WHOM", "WHOSE", "WIDE", "WIFE", "WILD", "WILL", "WIND", "WINE", "WING", "WISH", "WITH", "WOMAN", "WOOD", "WORD", "WORDS", "WORK", "WORKS", "WORLD", "WORRY", "WORTH", "WOULD", "WRITE", "WRONG", "YARD", "YEAH", "YEAR", "YOUNG", "YOUR", "YOUTH",  
 
//Words for the Hard level (Length: 7-8)
 "CHARACTERISTIC", "REPRESENTATIVE", "ADMINISTRATION", "INTERPRETATION", "REPRESENTATION", "RESPONSIBILITY", "UNDERSTANDING", "ENVIRONMENTAL", "INTERNATIONAL", "COMMUNICATION", "CONCENTRATION", "CONSIDERATION", "INVESTIGATION", "PRONUNCIATION", "ENTERTAINMENT", "ESTABLISHMENT", "UNFORTUNATELY", "CIRCUMSTANCE", "CONSERVATIVE", "CONSIDERABLE", "SIGNIFICANCE", "PROFESSIONAL", "APPRECIATION", "CONSTRUCTION", "CONTRIBUTION", "CONVERSATION", "DISTRIBUTION", "INTRODUCTION", "ORGANISATION", "ORGANIZATION", "ACCORDINGTO", "RELATIONSHIP", "NEVERTHELESS", "UNEMPLOYMENT", "INCREASINGLY", "PARTICULARLY", "ALTERNATIVE", "ALTERNATIVE", "APPROPRIATE", "CONCENTRATE", "CONSEQUENCE", "DEMONSTRATE", "EXPENDITURE", "INVESTIGATE", "PERFORMANCE", "RESPONSIBLE", "TEMPERATURE", "ENGINEERING", "INTERESTING", "EDUCATIONAL", "SUBSTANTIAL", "TRADITIONAL", "APPLICATION", "ASSOCIATION", "COMBINATION", "COMPETITION", "DESCRIPTION", "DISTINCTION", "EXAMINATION", "EXPECTATION", "EXPLANATION", "IMPLICATION", "INFORMATION", "INFORMATION", "INFORMATION", "INSTITUTION", "INSTRUCTION", "LEGISLATION", "NEGOTIATION", "OBSERVATION", "PUBLICATION", "RECOGNITION", "ACHIEVEMENT", "APPOINTMENT", "ARRANGEMENT", "DEVELOPMENT", "ENVIRONMENT", "IMPROVEMENT", "INDEPENDENT", "REQUIREMENT", "SIGNIFICANT", "EFFECTIVELY", "IMMEDIATELY", "NECESSARILY", "OPPORTUNITY", "POSSIBILITY", "DEMOCRATIC", "SCIENTIFIC", "BACKGROUND", "INTERESTED", "UNDERSTAND", "APPEARANCE", "ATMOSPHERE", "ATTRACTIVE", "CONFERENCE", "CONFIDENCE", "CONTRIBUTE", "DIFFERENCE", "DISCIPLINE", "ENTERPRISE", "EXPERIENCE", "EXPERIENCE", "ILLUSTRATE", "IMPORTANCE", "IMPOSSIBLE", "INITIATIVE", "LITERATURE", "REASONABLE", "EVERYTHING", "PHOTOGRAPH", "ADDITIONAL", "COMMERCIAL", "HISTORICAL", "INDIVIDUAL", "INDIVIDUAL", "INDUSTRIAL", "SUCCESSFUL", "CURRICULUM", "ASSUMPTION", "COLLECTION", "COMMISSION", "COMPARISON", "CONCLUSION", "CONNECTION", "CONVENTION", "DEFINITION", "DISCUSSION", "EXHIBITION", "EXPRESSION", "FOUNDATION", "GENERATION", "IMPRESSION", "OPPOSITION", "POPULATION", "PRODUCTION", "PROPORTION", "PROTECTION", "REGULATION", "REVOLUTION", "SUGGESTION", "TELEVISION", "LEADERSHIP", "MEMBERSHIP", "PARTICULAR", "AFTERWARDS", "THEMSELVES", "ASSESSMENT", "COMMITMENT", "DEPARTMENT", "EMPLOYMENT", "EXPERIMENT", "EXPERIMENT", "GOVERNMENT", "GOVERNMENT", "INSTRUMENT", "INVESTMENT", "MANAGEMENT", "PARLIAMENT", "RESTAURANT", "SETTLEMENT", "SUFFICIENT", "THROUGHOUT", "ABSOLUTELY", "APPARENTLY", "COMPLETELY", "DICTIONARY", "DIFFICULTY", "ESPECIALLY", "EVENTUALLY", "FREQUENTLY", "PREVIOUSLY", "RELATIVELY", "STRAWBERRY", "TECHNOLOGY", "UNIVERSITY", "AUTOMATIC", "CONCERNED", "HOUSEHOLD", "INCREASED", "RECOMMEND", "ADVANTAGE", "ASSOCIATE", "AVAILABLE", "CANDIDATE", "CHALLENGE", "COLLEAGUE", "COMMITTEE", "CORPORATE", "DETERMINE", "EFFECTIVE", "ELSEWHERE", "ENCOURAGE", "EXECUTIVE", "EXISTENCE", "EXPENSIVE", "IMMEDIATE", "INFLUENCE", "INFLUENCE", "INSTITUTE", "INSURANCE", "INTRODUCE", "KNOWLEDGE", "MEANWHILE", "OBJECTIVE", "OTHERWISE", "PRINCIPLE", "PROCEDURE", "PROGRAMME", "RECOGNISE", "RECOGNIZE", "RECOGNIZE", "REFERENCE", "SOMEWHERE", "STRUCTURE", "TECHNIQUE", "TELEPHONE", "THEREFORE", "UNDERTAKE", "BEGINNING", "FOLLOWING", "INCLUDING", "SOMETHING", "ESTABLISH", "BEAUTIFUL", "ESSENTIAL", "FINANCIAL", "POLITICAL", "POTENTIAL", "POTENTIAL", "PRACTICAL", "TECHNICAL", "WONDERFUL", "CRITICISM", "MECHANISM", "AFTERNOON", "ATTENTION", "CONDITION", "CRITERION", "DIRECTION", "EDUCATION", "GENTLEMAN", "INTENTION", "OPERATION", "PROVISION", "REDUCTION", "SELECTION", "SELECTION", "SITUATION", "TRADITION", "VARIATION", "BEHAVIOUR", "CHARACTER", "DISAPPEAR", "NEIGHBOUR", "NEWSPAPER", "SOLICITOR", "DANGEROUS", "OURSELVES", "RELIGIOUS", "SOMETIMES", "AGREEMENT", "COMPONENT", "DEFENDANT", "DIFFERENT", "DIFFICULT", "EQUIPMENT", "EXCELLENT", "IMPORTANT", "PERMANENT", "PRESIDENT", "REPRESENT", "SCIENTIST", "STATEMENT", "TRANSPORT", "TREATMENT", "INTERVIEW", "ACCOMPANY", "AUTHORITY", "BLUEBERRY", "CAREFULLY", "CERTAINLY", "COMMUNITY", "CURRENTLY", "EVERYBODY", "EXTREMELY", "GENERALLY", "LIABILITY", "NECESSARY", "OBVIOUSLY", "SECONDARY", "SECRETARY", "SERIOUSLY", "YESTERDAY", "ACADEMIC", "DOMESTIC", "ECONOMIC", "SPECIFIC", "DETAILED", "PROVIDED", "STANDARD", "STANDARD", "SURROUND", "ANNOUNCE", "ATTITUDE", "AUDIENCE", "COMPLETE", "COMPLETE", "COMPLETE", "CONCLUDE", "CONTINUE", "DESCRIBE", "DISTANCE", "EMPLOYEE", "ESTIMATE", "EVERYONE", "EVIDENCE", "EXCHANGE", "EXERCISE", "EXERCISE", "GENERATE", "INCREASE", "INCREASE", "INDICATE", "INSTANCE", "LANGUAGE", "LANGUAGE", "MAGAZINE", "MARRIAGE", "ORGANISE", "PERSUADE", "PLEASURE", "POSITIVE", "POSSIBLE", "PRACTICE", "PRESENCE", "PRESSURE", "RELATIVE", "RESOURCE", "RESPONSE", "SENTENCE", "SEPARATE", "SEPARATE", "SEQUENCE", "SOFTWARE", "SUITABLE", "SURPRISE", "TERRIBLE", "VIOLENCE", "YOURSELF", "ANYTHING", "BUILDING", "EXISTING", "PAINTING", "PLANNING", "SHOPPING", "TEACHING", "TRAINING", "ALTHOUGH", "APPROACH", "APPROACH", "RESEARCH", "STRENGTH", "CHEMICAL", "CRIMINAL", "CRITICAL", "CULTURAL", "EXTERNAL", "FOOTBALL", "HOSPITAL", "INTERNAL", "MATERIAL", "NATIONAL", "OFFICIAL", "OFFICIAL", "ORIGINAL", "PERSONAL", "PHYSICAL", "POWERFUL", "PROPOSAL", "REGIONAL", "ADDITION", "CAMPAIGN", "CHAIRMAN", "CREATION", "DECISION", "DIVISION", "ELECTION", "FUNCTION", "LOCATION", "MAINTAIN", "MOUNTAIN", "NORTHERN", "OCCASION", "POSITION", "QUESTION", "QUESTION", "REACTION", "RELATION", "RELIGION", "SOLUTION", "SOUTHERN", "THREATEN", "COMPUTER", "CONSIDER", "CONSUMER", "CUSTOMER", "CUSTOMER", "DAUGHTER", "DIRECTOR", "DISCOVER", "EMPLOYER", "FAMILIAR", "MINISTER", "PRISONER", "REMEMBER", "SHOULDER", "TOGETHER", "TRANSFER", "TRANSFER", "WHATEVER", "ANALYSIS", "BUSINESS", "CONGRESS", "EMPHASIS", "POLITICS", "PREVIOUS", "PROGRESS", "ACCIDENT", "AIRCRAFT", "APPARENT", "ARGUMENT", "CONFLICT", "CONSTANT", "CONTRACT", "CONTRAST", "DISTRICT", "DOCUMENT", "EGGPLANT", "INCIDENT", "INTEREST", "MOVEMENT", "PROSPECT", "RELEVANT", "SOMEWHAT", "STRAIGHT", "TOMORROW", "WITHDRAW", "ACTIVITY", "ACTUALLY", "ASSEMBLY", "CAPACITY", "CATEGORY", "DIRECTLY", "ENTIRELY", "FACILITY", "IDENTIFY", "INDUSTRY", "MAJORITY", "MILITARY", "MINISTRY", "NORMALLY", "ORDINARY", "POSSIBLY", "PRIORITY", "PROBABLY", "PROPERLY", "PROPERTY", "RECENTLY", "SECURITY", "SLIGHTLY", "SOMEBODY", "STRATEGY", "STRONGLY", "SUDDENLY", "UNLIKELY", "ORGANIC", "PLASTIC", "PSYCHIC", "TRAFFIC", "FORWARD", "HUSBAND", "INSTEAD", "LIMITED", "MARRIED", "RESPOND", "SUCCEED", "WEEKEND", "ABSENCE", "ACHIEVE", "ACQUIRE", "ADVANCE", "APPROVE", "ARRANGE", "ARTICLE", "AVERAGE", "BALANCE", "BECAUSE", "BELIEVE", "CAPABLE", "COLLEGE", "COMBINE", "COMPARE", "CULTURE", "DECLARE", "DEFENCE", "DESPITE", "DISEASE", "ENTITLE", "EXAMINE", "EXAMPLE", "EXAMPLE", "EXPENSE", "EXPLORE", "FAILURE", "FEATURE", "FINANCE", "IMAGINE", "IMPROVE", "INCLUDE", "INVOLVE", "JUSTICE", "MACHINE", "MEASURE", "MEASURE", "MESSAGE", "MISTAKE", "OBSERVE", "OFFENCE", "OPERATE", "OUTCOME", "OUTSIDE", "OUTSIDE", "PACKAGE", "PASSAGE", "PICTURE", "PREPARE", "PRIVATE", "PRODUCE", "PROMISE", "PROMOTE", "PROPOSE", "PROVIDE", "PURPOSE", "REALISE", "REALIZE", "RECEIVE", "RELEASE", "RELEASE", "REPLACE", "REQUIRE", "REVENUE", "SCIENCE", "SERVICE", "SILENCE", "SOMEONE", "STRANGE", "SUPPOSE", "SURFACE", "SURVIVE", "THEATRE", "TROUBLE", "VEHICLE", "VILLAGE", "WELCOME", "WELFARE", "HERSELF", "HIMSELF", "DRAWING", "EVENING", "FEELING", "FINDING", "GROWING", "HOUSING", "LEADING", "MEANING", "MEETING", "MORNING", "NOTHING", "READING", "WORKING", "WRITING", "BENEATH", "PUBLISH", "THROUGH", "THROUGH", "NETWORK", "CAPITAL", "CAREFUL", "CENTRAL", "CHANNEL", "CONTROL", "CONTROL", "COUNCIL", "GENERAL", "GENERAL", "INITIAL", "LIBERAL", "MEDICAL", "NATURAL", "OVERALL", "SEVERAL", "SPECIAL", "TYPICAL", "BEDROOM", "CONFIRM", "FREEDOM", "PERFORM", "PROBLEM", "PROGRAM", "BETWEEN", "CERTAIN", "CHICKEN", "CITIZEN", "CONCERN", "CONCERN", "CONTAIN", "EXPLAIN", "FASHION", "FOREIGN", "KITCHEN", "MENTION", "OPINION", "PATTERN", "PENSION", "SECTION", "SESSION", "STATION", "VERSION", "WESTERN", "DEVELOP", "ANOTHER", "BROTHER", "CHAPTER", "DELIVER", "FURTHER", "HOWEVER", "MANAGER", "NEITHER", "NUCLEAR", "OFFICER", "PARTNER", "POPULAR", "QUARTER", "RECOVER", "REGULAR", "SIMILAR", "SOLDIER", "SPEAKER", "TEACHER", "VISITOR", "WEATHER", "WHETHER", "ADDRESS", "ADDRESS", "CLOTHES", "DISCUSS", "EXPRESS", "OBVIOUS", "PERHAPS", "PROCESS", "SERIOUS", "SPECIES", "SUCCESS", "TOWARDS", "VARIOUS", "WHEREAS", "ACCOUNT", "ACCOUNT", "AGAINST", "ALRIGHT", "AMONGST", "ANCIENT", "APPOINT", "ATTEMPT", "ATTEMPT", "ATTRACT", "BENEFIT", "CABINET", "COLLECT", "COMMENT", "COMMENT", "CONCEPT", "CONDUCT", "CONNECT", "CONSIST", "CONTACT", "CONTACT", "CONTENT", "CONTEXT", "CORRECT", "CURRENT", "ELEMENT", "PATIENT", "PAYMENT", "PERCENT", "PERFECT", "PRESENT", "PRESENT", "PRESENT", "PREVENT", "PRODUCT", "PROJECT", "PROTECT", "REFLECT", "REQUEST", "RESPECT", "SERVANT", "STUDENT", "SUBJECT", "SUGGEST", "SUPPORT", "SUPPORT", "THOUGHT", "TONIGHT", "WITHOUT", "COMPLEX", "ABILITY", "ALREADY", "ANYBODY", "CENTURY", "CLEARLY", "CLOSELY", "COMPANY", "COUNTRY", "DESTROY", "DISPLAY", "DISPLAY", "ECONOMY", "ELDERLY", "EQUALLY", "EXACTLY", "FACTORY", "FINALLY", "HISTORY", "HOLIDAY", "JOURNEY", "LARGELY", "LIBRARY", "PRIMARY", "QUALITY", "QUICKLY", "RAILWAY", "RAPIDLY", "REALITY", "SATISFY", "SOCIETY", "TOTALLY", "USUALLY", "VARIETY", "VICTORY", "PUBLIC", "PUBLIC", "AFFORD", "AFRAID", "AROUND", "AROUND", "ATTEND", "BEHIND", "BEYOND", "CALLED", "DEMAND", "DEMAND", "DEPEND", "EXTEND", "FRIEND", "GROUND", "INDEED", "INTEND", "ISLAND", "METHOD", "PERIOD", "RECORD", "RECORD", "REGARD", "REMIND", "SECOND", "SHOULD", "SPREAD", "UNITED", "ACTIVE", "ADVICE", "ADVISE", "ANYONE", "ARRIVE", "ASSUME", "BATTLE", "BECOME", "BEFORE", "BEFORE", "BEFORE", "BESIDE", "BOTTLE", "BRIDGE", "CENTRE", "CHANCE", "CHANGE", "CHANGE", "CHARGE", "CHARGE", "CHOICE", "CHOOSE", "CIRCLE", "COFFEE", "COUPLE", "COURSE", "CREATE", "DAMAGE", "DAMAGE", "DEBATE", "DECADE", "DECIDE", "DEFINE", "DEGREE", "DERIVE", "DESIRE", "DEVICE", "DIVIDE", "DOUBLE", "EMERGE", "ENABLE", "ENGINE", "ENSURE", "ENTIRE", "ESCAPE", "ESTATE", "FEMALE", "FIGURE", "FUTURE", "FUTURE", "HANDLE", "IGNORE", "IMPOSE", "INCOME", "INSIDE", "INSIDE", "INVITE", "LEAGUE", "LITTLE", "LITTLE", "LITTLE", "LITTLE", "MANAGE", "MIDDLE", "MINUTE", "MODULE", "NATURE", "NOTICE", "NOTICE", "OFFICE", "PEOPLE", "PEOPLE", "PLEASE", "POLICE", "REDUCE", "REFUSE", "RELATE", "REMOVE", "SAMPLE", "SCHEME", "SECURE", "SETTLE", "SEVERE", "SIMPLE", "SINGLE", "SOURCE", "STRIKE", "STRIKE", "UNABLE", "UNIQUE", "VOLUME", "BELIEF", "ITSELF", "MYSELF", "RELIEF", "BELONG", "DURING", "LIVING", "SPRING", "STRONG", "ATTACH", "BRANCH", "BREATH", "CHURCH", "ENOUGH", "ENOUGH", "FINISH", "GROWTH", "HEALTH", "LAUNCH", "LENGTH", "SEARCH", "SEARCH", "SPEECH", "SWITCH", "THOUGH", "THOUGH", "ATTACK", "ATTACK", "ACTUAL", "ANIMAL", "ANNUAL", "APPEAL", "APPEAL", "DETAIL", "FORMAL", "MENTAL", "NORMAL", "RECALL", "REVEAL", "SCHOOL", "SEXUAL", "SIGNAL", "SOCIAL", "TRAVEL", "USEFUL", "BOTTOM", "INFORM", "MUSEUM", "REFORM", "SYSTEM", "VICTIM", "ACTION", "COMMON", "DESIGN", "DESIGN", "GARDEN", "HAPPEN", "LISTEN", "MODERN", "MOTION", "NATION", "NOTION", "OBTAIN", "OPTION", "ORIGIN", "PERSON", "PRISON", "REASON", "REGION", "REMAIN", "RETAIN", "RETURN", "RETURN", "SCREEN", "SEASON", "SEASON", "VISION", "WEAPON", "WITHIN", "STUDIO", "AFFAIR", "ANSWER", "ANSWER", "APPEAR", "AUTHOR", "BETTER", "BORDER", "CAREER", "COLOUR", "CORNER", "DANGER", "DINNER", "DOCTOR", "DRIVER", "EDITOR", "EITHER", "EITHER", "FACTOR", "FARMER", "FATHER", "FAVOUR", "FINGER", "FLOWER", "FORMER", "GATHER", "LABOUR", "LABOUR", "LATTER", "LAWYER", "LEADER", "LETTER", "MANNER", "MASTER", "MATTER", "MATTER", "MEMBER", "MOTHER", "MURDER", "NUMBER", "PLAYER", "PREFER", "PROPER", "RATHER", "READER", "SECTOR", "SENIOR", "SISTER", "SUFFER", "SUMMER", "WINNER", "WINTER", "WONDER", "WORKER", "WRITER", "ACCESS", "ACROSS", "ALWAYS", "ASSESS", "CRISIS", "FAMOUS", "SERIES", "STATUS", "THANKS", "UNLESS", "ACCEPT", "AFFECT", "ALMOST", "AMOUNT", "ARTIST", "ASPECT", "BRIGHT", "BUDGET", "CLIENT", "COMMIT", "CREDIT", "DIRECT", "DIRECT", "EFFECT", "EFFORT", "EXCEPT", "EXPECT", "EXPERT", "EXTENT", "FLIGHT", "FOREST", "FORGET", "IMPACT", "INSIST", "MARKET", "MARKET", "MARKET", "MOMENT", "OBJECT", "OUTPUT", "PARENT", "POCKET", "PROFIT", "RECENT", "REJECT", "REPEAT", "REPORT", "REPORT", "RESULT", "RESULT", "SELECT", "SPIRIT", "STREET", "SUNSET", "TARGET", "THREAT", "TICKET", "WEIGHT", "WHILST", "FOLLOW", "NARROW", "REVIEW", "WINDOW", "AGENCY", "ANYWAY", "BAKERY", "BLOODY", "COUNTY", "DEPUTY", "EASILY", "EMPLOY", "ENERGY", "FAIRLY", "FAMILY", "HARDLY", "HIGHLY", "INJURY", "LIKELY", "LOVELY", "MAINLY", "MEMORY", "MERELY", "NEARLY", "NOBODY", "PARTLY", "PLENTY", "POLICY", "PRETTY", "REALLY", "SAFETY", "SIMPLY", "SLOWLY", "SUPPLY", "SUPPLY", "SURELY", "SURVEY", "THEORY", "TREATY", "WIDELY"
);


//The hints to use in the status bar
var hints = new Array(
 //Hints for the Easy level

 "sea", "tea", "via", "job", "pub", "add", "aid", "and", "and", "bad", "bed", "did", "end", "end", "god", "had", "kid", "nod", "odd", "old", "red", "age", "are", "aye", "die", "due", "eye", "fee", "lie", "one", "one", "see", "see", "she", "she", "the", "the", "use", "use", "use", "off", "off", "bag", "big", "dog", "egg", "leg", "ask", "all", "all", "all", "oil", "aim", "aim", "arm", "him", "him", "sum", "can", "can", "gun", "man", "own", "own", "run", "run", "son", "sun", "win", "ago", "too", "two", "who", "who", "cup", "lip", "map", "top", "top", "air", "bar", "car", "ear", "far", "far", "for", "for", "for", "her", "her", "her", "nor", "our", "per", "sir", "war", "bus", "cos", "gas", "has", "his", "his", "his", "its", "was", "yes", "act", "act", "art", "bit", "but", "but", "cat", "cut", "cut", "eat", "fit", "get", "hit", "hot", "let", "lot", "not", "not", "out", "out", "put", "set", "set", "sit", "yet", "you", "you", "few", "few", "how", "law", "low", "new", "now", "now", "row", "box", "fix", "sex", "tax", "any", "boy", "buy", "cry", "day", "dry", "fly", "key", "key", "lay", "may", "pay", "say", "sky", "try", "way", "way", "why", 


//Hints for the Normal level
 "able", "about", "above", "acid", "admit", "adopt", "adult", "after", "after", "after", "again", "agent", "agree", "ahead", "allow", "alone", "along", "along", "also", "among", "angel", "apart", "apply", "area", "argue", "arise", "army", "asset", "avoid", "award", "aware", "away", "baby", "back", "back", "ball", "band", "bank", "base", "base", "basic", "basis", "bear", "beat", "been", "begin", "below", "below", "best", "bill", "bind", "bird", "birth", "black", "block", "blood", "blow", "blue", "board", "boat", "body", "bone", "book", "both", "both", "brain", "break", "brief", "bring", "broad", "build", "burn", "busy", "call", "call", "card", "care", "care", "carry", "case", "cash", "catch", "cause", "cause", "cell", "chain", "chair", "cheap", "check", "chief", "child", "city", "civil", "claim", "claim", "class", "clean", "clear", "clear", "climb", "close", "close", "close", "club", "coal", "code", "cold", "come", "copy", "cost", "cost", "could", "count", "court", "cover", "cover", "crime", "cross", "crowd", "dark", "data", "date", "date", "dead", "deal", "deal", "death", "debt", "deep", "deep", "deny", "desk", "door", "doubt", "down", "draw", "dream", "dress", "dress", "drink", "drink", "drive", "drive", "drop", "drug", "duty", "each", "each", "early", "early", "earn", "earth", "east", "easy", "edge", "else", "empty", "enemy", "enjoy", "enter", "entry", "equal", "error", "even", "event", "ever", "every", "exist", "extra", "face", "face", "fact", "fail", "fair", "faith", "fall", "fall", "farm", "fast", "fear", "feel", "field", "fight", "file", "fill", "film", "final", "find", "find", "fine", "fire", "firm", "first", "fish", "flat", "floor", "flow", "focus", "food", "foot", "force", "form", "free", "fresh", "from", "from", "front", "front", "fruit", "fuel", "full", "fully", "fund", "funny", "gain", "game", "gate", "girl", "give", "glass", "goal", "gold", "good", "grant", "great", "green", "grey", "group", "grow", "guest", "guide", "hair", "half", "hall", "hand", "hang", "happy", "hard", "hard", "hate", "have", "head", "head", "hear", "heart", "heat", "heavy", "hell", "help", "hence", "here", "hide", "high", "hill", "hold", "hole", "home", "hope", "hope", "horse", "hotel", "hour", "house", "huge", "human", "hurt", "idea", "image", "imply", "index", "into", "iron", "issue", "issue", "item", "join", "joint", "judge", "judge", "jump", "just", "keep", "kill", "kind", "king", "knee", "know", "know", "lack", "lady", "land", "large", "last", "late", "later", "laugh", "lead", "leaf", "lean", "learn", "least", "leave", "left", "legal", "less", "level", "life", "lift", "light", "like", "like", "like", "limit", "line", "link", "list", "live", "loan", "local", "long", "look", "lord", "lose", "loss", "love", "lunch", "made", "main", "major", "make", "male", "many", "mark", "marry", "mass", "match", "maybe", "meal", "mean", "means", "media", "meet", "metal", "might", "mile", "milk", "mind", "mine", "miss", "model", "money", "month", "more", "most", "motor", "mouth", "move", "move", "much", "music", "must", "name", "near", "neck", "need", "never", "news", "next", "next", "nice", "night", "noise", "none", "north", "nose", "note", "nurse", "occur", "offer", "often", "okay", "once", "only", "onto", "open", "order", "other", "ought", "over", "owner", "page", "pain", "paint", "pair", "panel", "paper", "park", "part", "party", "pass", "past", "path", "peace", "phase", "phone", "pick", "piece", "place", "plan", "plant", "plate", "play", "play", "plus", "point", "pool", "poor", "post", "pound", "power", "press", "price", "prime", "prove", "pull", "pupil", "push", "quick", "quiet", "quite", "race", "radio", "rain", "raise", "range", "rare", "rate", "reach", "read", "ready", "real", "refer", "rely", "reply", "rest", "rest", "rich", "ride", "right", "ring", "rise", "risk", "river", "road", "rock", "role", "roll", "roof", "room", "round", "route", "royal", "rule", "rural", "safe", "said", "sale", "same", "save", "scale", "scene", "score", "seat", "seek", "seem", "sell", "send", "sense", "serve", "shake", "shall", "shape", "share", "share", "sheet", "ship", "shoe", "shoot", "shop", "short", "shot", "shout", "show", "show", "shut", "side", "sight", "sign", "sign", "since", "sing", "site", "size", "skill", "skin", "sleep", "slip", "slow", "small", "smile", "soft", "soil", "some", "song", "soon", "sorry", "sort", "sound", "south", "space", "speak", "speed", "spend", "sport", "spot", "staff", "stage", "stand", "star", "start", "state", "stay", "steal", "step", "stick", "still", "stock", "stone", "stop", "store", "story", "study", "stuff", "style", "such", "sure", "table", "take", "talk", "tall", "tape", "task", "teach", "team", "tear", "tell", "tend", "term", "terms", "test", "text", "than", "thank", "that", "their", "them", "theme", "then", "there", "these", "they", "thin", "thing", "think", "this", "those", "throw", "thus", "time", "tiny", "title", "today", "tone", "tool", "tooth", "total", "total", "touch", "touch", "tour", "town", "track", "trade", "train", "treat", "tree", "trend", "trial", "trip", "troop", "true", "trust", "truth", "turn", "twice", "type", "under", "union", "unit", "until", "upon", "upper", "urban", "used", "user", "usual", "value", "vary", "vast", "very", "video", "view", "visit", "vital", "voice", "vote", "wage", "wait", "walk", "wall", "want", "warm", "warn", "wash", "watch", "water", "wave", "weak", "wear", "week", "well", "were", "west", "what", "when", "when", "where", "which", "while", "white", "whole", "whom", "whose", "wide", "wife", "wild", "will", "wind", "wine", "wing", "wish", "with", "woman", "wood", "word", "words", "work", "works", "world", "worry", "worth", "would", "write", "wrong", "yard", "yeah", "year", "young", "your", "youth",  

 //Hints for the Hard level
 "characteristic", "representative", "administration", "interpretation", "representation", "responsibility", "understanding", "environmental", "international", "communication", "concentration", "consideration", "investigation", "pronunciation", "entertainment", "establishment", "unfortunately", "circumstance", "conservative", "considerable", "significance", "professional", "appreciation", "construction", "contribution", "conversation", "distribution", "introduction", "organisation", "organization", "accordingto", "relationship", "nevertheless", "unemployment", "increasingly", "particularly", "alternative", "alternative", "appropriate", "concentrate", "consequence", "demonstrate", "expenditure", "investigate", "performance", "responsible", "temperature", "engineering", "interesting", "educational", "substantial", "traditional", "application", "association", "combination", "competition", "description", "distinction", "examination", "expectation", "explanation", "implication", "information", "information", "information", "institution", "instruction", "legislation", "negotiation", "observation", "publication", "recognition", "achievement", "appointment", "arrangement", "development", "environment", "improvement", "independent", "requirement", "significant", "effectively", "immediately", "necessarily", "opportunity", "possibility", "democratic", "scientific", "background", "interested", "understand", "appearance", "atmosphere", "attractive", "conference", "confidence", "contribute", "difference", "discipline", "enterprise", "experience", "experience", "illustrate", "importance", "impossible", "initiative", "literature", "reasonable", "everything", "photograph", "additional", "commercial", "historical", "individual", "individual", "industrial", "successful", "curriculum", "assumption", "collection", "commission", "comparison", "conclusion", "connection", "convention", "definition", "discussion", "exhibition", "expression", "foundation", "generation", "impression", "opposition", "population", "production", "proportion", "protection", "regulation", "revolution", "suggestion", "television", "leadership", "membership", "particular", "afterwards", "themselves", "assessment", "commitment", "department", "employment", "experiment", "experiment", "government", "government", "instrument", "investment", "management", "parliament", "restaurant", "settlement", "sufficient", "throughout", "absolutely", "apparently", "completely", "dictionary", "difficulty", "especially", "eventually", "frequently", "previously", "relatively", "strawberry", "technology", "university", "automatic", "concerned", "household", "increased", "recommend", "advantage", "associate", "available", "candidate", "challenge", "colleague", "committee", "corporate", "determine", "effective", "elsewhere", "encourage", "executive", "existence", "expensive", "immediate", "influence", "influence", "institute", "insurance", "introduce", "knowledge", "meanwhile", "objective", "otherwise", "principle", "procedure", "programme", "recognise", "recognize", "recognize", "reference", "somewhere", "structure", "technique", "telephone", "therefore", "undertake", "beginning", "following", "including", "something", "establish", "beautiful", "essential", "financial", "political", "potential", "potential", "practical", "technical", "wonderful", "criticism", "mechanism", "afternoon", "attention", "condition", "criterion", "direction", "education", "gentleman", "intention", "operation", "provision", "reduction", "selection", "selection", "situation", "tradition", "variation", "behaviour", "character", "disappear", "neighbour", "newspaper", "solicitor", "dangerous", "ourselves", "religious", "sometimes", "agreement", "component", "defendant", "different", "difficult", "equipment", "excellent", "important", "permanent", "president", "represent", "scientist", "statement", "transport", "treatment", "interview", "accompany", "authority", "blueberry", "carefully", "certainly", "community", "currently", "everybody", "extremely", "generally", "liability", "necessary", "obviously", "secondary", "secretary", "seriously", "yesterday", "academic", "domestic", "economic", "specific", "detailed", "provided", "standard", "standard", "surround", "announce", "attitude", "audience", "complete", "complete", "complete", "conclude", "continue", "describe", "distance", "employee", "estimate", "everyone", "evidence", "exchange", "exercise", "exercise", "generate", "increase", "increase", "indicate", "instance", "language", "language", "magazine", "marriage", "organise", "persuade", "pleasure", "positive", "possible", "practice", "presence", "pressure", "relative", "resource", "response", "sentence", "separate", "separate", "sequence", "software", "suitable", "surprise", "terrible", "violence", "yourself", "anything", "building", "existing", "painting", "planning", "shopping", "teaching", "training", "although", "approach", "approach", "research", "strength", "chemical", "criminal", "critical", "cultural", "external", "football", "hospital", "internal", "material", "national", "official", "official", "original", "personal", "physical", "powerful", "proposal", "regional", "addition", "campaign", "chairman", "creation", "decision", "division", "election", "function", "location", "maintain", "mountain", "northern", "occasion", "position", "question", "question", "reaction", "relation", "religion", "solution", "southern", "threaten", "computer", "consider", "consumer", "customer", "customer", "daughter", "director", "discover", "employer", "familiar", "minister", "prisoner", "remember", "shoulder", "together", "transfer", "transfer", "whatever", "analysis", "business", "congress", "emphasis", "politics", "previous", "progress", "accident", "aircraft", "apparent", "argument", "conflict", "constant", "contract", "contrast", "district", "document", "eggplant", "incident", "interest", "movement", "prospect", "relevant", "somewhat", "straight", "tomorrow", "withdraw", "activity", "actually", "assembly", "capacity", "category", "directly", "entirely", "facility", "identify", "industry", "majority", "military", "ministry", "normally", "ordinary", "possibly", "priority", "probably", "properly", "property", "recently", "security", "slightly", "somebody", "strategy", "strongly", "suddenly", "unlikely", "organic", "plastic", "psychic", "traffic", "forward", "husband", "instead", "limited", "married", "respond", "succeed", "weekend", "absence", "achieve", "acquire", "advance", "approve", "arrange", "article", "average", "balance", "because", "believe", "capable", "college", "combine", "compare", "culture", "declare", "defence", "despite", "disease", "entitle", "examine", "example", "example", "expense", "explore", "failure", "feature", "finance", "imagine", "improve", "include", "involve", "justice", "machine", "measure", "measure", "message", "mistake", "observe", "offence", "operate", "outcome", "outside", "outside", "package", "passage", "picture", "prepare", "private", "produce", "promise", "promote", "propose", "provide", "purpose", "realise", "realize", "receive", "release", "release", "replace", "require", "revenue", "science", "service", "silence", "someone", "strange", "suppose", "surface", "survive", "theatre", "trouble", "vehicle", "village", "welcome", "welfare", "herself", "himself", "drawing", "evening", "feeling", "finding", "growing", "housing", "leading", "meaning", "meeting", "morning", "nothing", "reading", "working", "writing", "beneath", "publish", "through", "through", "network", "capital", "careful", "central", "channel", "control", "control", "council", "general", "general", "initial", "liberal", "medical", "natural", "overall", "several", "special", "typical", "bedroom", "confirm", "freedom", "perform", "problem", "program", "between", "certain", "chicken", "citizen", "concern", "concern", "contain", "explain", "fashion", "foreign", "kitchen", "mention", "opinion", "pattern", "pension", "section", "session", "station", "version", "western", "develop", "another", "brother", "chapter", "deliver", "further", "however", "manager", "neither", "nuclear", "officer", "partner", "popular", "quarter", "recover", "regular", "similar", "soldier", "speaker", "teacher", "visitor", "weather", "whether", "address", "address", "clothes", "discuss", "express", "obvious", "perhaps", "process", "serious", "species", "success", "towards", "various", "whereas", "account", "account", "against", "alright", "amongst", "ancient", "appoint", "attempt", "attempt", "attract", "benefit", "cabinet", "collect", "comment", "comment", "concept", "conduct", "connect", "consist", "contact", "contact", "content", "context", "correct", "current", "element", "patient", "payment", "percent", "perfect", "present", "present", "present", "prevent", "product", "project", "protect", "reflect", "request", "respect", "servant", "student", "subject", "suggest", "support", "support", "thought", "tonight", "without", "complex", "ability", "already", "anybody", "century", "clearly", "closely", "company", "country", "destroy", "display", "display", "economy", "elderly", "equally", "exactly", "factory", "finally", "history", "holiday", "journey", "largely", "library", "primary", "quality", "quickly", "railway", "rapidly", "reality", "satisfy", "society", "totally", "usually", "variety", "victory", "public", "public", "afford", "afraid", "around", "around", "attend", "behind", "beyond", "called", "demand", "demand", "depend", "extend", "friend", "ground", "indeed", "intend", "island", "method", "period", "record", "record", "regard", "remind", "second", "should", "spread", "united", "active", "advice", "advise", "anyone", "arrive", "assume", "battle", "become", "before", "before", "before", "beside", "bottle", "bridge", "centre", "chance", "change", "change", "charge", "charge", "choice", "choose", "circle", "coffee", "couple", "course", "create", "damage", "damage", "debate", "decade", "decide", "define", "degree", "derive", "desire", "device", "divide", "double", "emerge", "enable", "engine", "ensure", "entire", "escape", "estate", "female", "figure", "future", "future", "handle", "ignore", "impose", "income", "inside", "inside", "invite", "league", "little", "little", "little", "little", "manage", "middle", "minute", "module", "nature", "notice", "notice", "office", "people", "people", "please", "police", "reduce", "refuse", "relate", "remove", "sample", "scheme", "secure", "settle", "severe", "simple", "single", "source", "strike", "strike", "unable", "unique", "volume", "belief", "itself", "myself", "relief", "belong", "during", "living", "spring", "strong", "attach", "branch", "breath", "church", "enough", "enough", "finish", "growth", "health", "launch", "length", "search", "search", "speech", "switch", "though", "though", "attack", "attack", "actual", "animal", "annual", "appeal", "appeal", "detail", "formal", "mental", "normal", "recall", "reveal", "school", "sexual", "signal", "social", "travel", "useful", "bottom", "inform", "museum", "reform", "system", "victim", "action", "common", "design", "design", "garden", "happen", "listen", "modern", "motion", "nation", "notion", "obtain", "option", "origin", "person", "prison", "reason", "region", "remain", "retain", "return", "return", "screen", "season", "season", "vision", "weapon", "within", "studio", "affair", "answer", "answer", "appear", "author", "better", "border", "career", "colour", "corner", "danger", "dinner", "doctor", "driver", "editor", "either", "either", "factor", "farmer", "father", "favour", "finger", "flower", "former", "gather", "labour", "labour", "latter", "lawyer", "leader", "letter", "manner", "master", "matter", "matter", "member", "mother", "murder", "number", "player", "prefer", "proper", "rather", "reader", "sector", "senior", "sister", "suffer", "summer", "winner", "winter", "wonder", "worker", "writer", "access", "across", "always", "assess", "crisis", "famous", "series", "status", "thanks", "unless", "accept", "affect", "almost", "amount", "artist", "aspect", "bright", "budget", "client", "commit", "credit", "direct", "direct", "effect", "effort", "except", "expect", "expert", "extent", "flight", "forest", "forget", "impact", "insist", "market", "market", "market", "moment", "object", "output", "parent", "pocket", "profit", "recent", "reject", "repeat", "report", "report", "result", "result", "select", "spirit", "street", "sunset", "target", "threat", "ticket", "weight", "whilst", "follow", "narrow", "review", "window", "agency", "anyway", "bakery", "bloody", "county", "deputy", "easily", "employ", "energy", "fairly", "family", "hardly", "highly", "injury", "likely", "lovely", "mainly", "memory", "merely", "nearly", "nobody", "partly", "plenty", "policy", "pretty", "really", "safety", "simply", "slowly", "supply", "supply", "surely", "survey", "theory", "treaty", "widely"
);


/***********************************
 * FUNCTION: scramble()
 * ARGUMENTS: The word to scramble.
 * PURPOSE: Takes a word or phrase, 
 * scramble it and return it to the 
 * caller.
 ***********************************/
function scramble(word)
{
  var len = word.length; //length of the word
  var scrm = ""; //temporary scramble

  //scrambling, phase 1
  for(i = 0; i < len; i += 2)
  {
    scrm += word.charAt(i);
  }

  //scrambling, phase 2
  for(i = 1; i < len; i += 2)
  {
    scrm += word.charAt(i);
  }

  var w = ""; //empty word

  //scrambling, phase 3 (final)
  for(i = len; i >= 0; i--)
  {
    w += scrm.charAt(i);
  }

  return w; //returning it to the caller
}


/*************************************
 * FUNCTION: check_it()
 * ARGUMENTS: None.
 * PURPOSE: Checks the word that the 
 * player entered and performs 
 * necessary action.
 *************************************/
function check_it()
{
  //getting entered guess word
  var gs_word = document.js_joga_form.guess.value.toLowerCase();

  //getting the hidden number
  var r_num = document.js_joga_form.num.value;

  //getting the actual word from the words array
  var wd = words[r_num].toLowerCase();

  //for a correct guess
  if(gs_word == wd)
  {
    //creating winning message
    var msg = "Yes! The word was \'" + wd.toUpperCase();
    msg += "\'. You get " + wd.length + " points.";

    //showing winning message
    window.alert(msg);

    //getting previous score
    var set_score = parseInt(document.js_joga_form.score.value);

    //adding current score
    set_score += wd.length;

    //setting the score
    document.js_joga_form.score.value = set_score;

    //clearing previous timer
    window.clearInterval(tm);

    //calling the js_joga_main() for a new word
    js_joga_main();
  }

  //incorrect guess
  else
  {
    //preparing message
    var msg = "Your guess was wrong. Sorry I have to deduct 1 point";
    msg += "\nfrom your current score. Please try again.";

    //showing message
    window.alert(msg);

    //getting previous score
    var set_score = parseInt(document.js_joga_form.score.value);

    //deducting current score
    set_score--;

    //setting the score
    document.js_joga_form.score.value = set_score;

    //focusing on the textbox
    document.js_joga_form.guess.focus();
  }
}


/*************************************
 * FUNCTION: timer()
 * ARGUMENTS: None.
 * PURPOSE: Sets the game's time at 
 * several difficulty levels.
 *************************************/
function timer()
{
  //getting current time
  var set_time = parseInt(document.js_joga_form.time.value);

  if(set_time <= 0)
  {
    //clears previous timer
    window.clearInterval(tm);

    //getting previous score
    var set_score = parseInt(document.js_joga_form.score.value);

    //deducting current score
    set_score -= words[parseInt(document.js_joga_form.num.value)].length;

    //setting the score
    document.js_joga_form.score.value = set_score;

    //player didn't guess the word within
    //the given time, generating a new word
    js_joga_main();
  }

  else
  {
    //decreasing time by 1
    set_time--;

    //setting the time
    document.js_joga_form.time.value = set_time;
  }
}


/******************************************
 * FUNCTION: dif_level()
 * ARGUMENTS: None.
 * PURPOSE: Checks the selected difficulty 
 * level, and performs necessary action.
 ******************************************/
function dif_level()
{
  with(document.js_joga_form)
  {
    if(difficulty[0].checked)
    {
      time.value = "25"; //value should be 25 seconds for easy level
    }

    else if(difficulty[2].checked)
    {
      time.value = "45"; //value should be 45 seconds for hard level
    }

    else //donot need to check the default normal level
    {
      time.value = "35"; //value should be 35 seconds for normal level
    }
  }
}


/****************************************
 * FUNCTION: js_joga_main()
 * ARGUMENTS: None.
 * PURPOSE: Main function of the game. 
 * It controls most of the major tasks 
 * is the game. It calls other functions 
 * in time.
 ****************************************/
function js_joga_main()
{
  var r = 0; //for a random number
  var w = ""; //will contain the scrambled word

  //checks the selected difficulty level first
  if(document.js_joga_form.difficulty[0].checked)
  {
    r = Math.floor(Math.random() * 164); //it is easy
  }

  else if(document.js_joga_form.difficulty[1].checked)
  {
    r = Math.floor(Math.random() * 680); //it is normal
    r += 164;
  }

  else
  {
    r = Math.floor(Math.random() * 1103); //it is hard
    r += 844;
  }

  //calling the scramble function to scramble the word
  w = scramble(words[r]);

  //displaying the word
  document.getElementById("js_joga_pane").innerHTML = w;

  //displaying the hint
  window.defaultStatus = hints[r];

  //displaying the opponent's name
  document.getElementById("vs").innerHTML = "Your opponent: <b><font color='#0060C0'>" +   get_random_opp() + "</font></b>";

  with(document.js_joga_form)
  {
    //setting all values
    if(difficulty[0].checked)
    {
      time.value = "25"; //value should be 25 seconds for easy level
    }

    else if(difficulty[2].checked)
    {
      time.value = "45"; //value should be 45 seconds for hard level
    }

    else //donot need to check the default normal level
    {
      time.value = "35"; //value should be 35 seconds for normal level
    }

    difficulty[0].disabled = true;
    difficulty[1].disabled = true;
    difficulty[2].disabled = true;
    guess.value = "";
    guess.disabled = false;
    start.disabled = true;
    checkit.disabled = false;
    guess.focus();
    num.value = r;
  }

  //starting the new timer
  tm = window.setInterval("timer()", 1000);
}


// -*- THE END -*-

