<!--

/*
 * Program - Country Guessing Game
 * File Name - script.js
 * Author - ShuvoRim
 * Web site - http://www.shuvorim.tk
 * Email - shuvorim@hotmail.com
 * (c)ShuvoRim Pvt. Ltd. 2002 - 03
 * All rights reserved.
 * ------------------------------
 * Visit our web site for free open
 * source Applications, Applets,
 * Scripts and Games. Thank you for
 * using our program.
 */


/* declaring an array to hold the country names */

 var country = new Array(180);

/* initializing the array */

   country[0] = "AFGANISTAN";
   country[1] = "AFRICA DE SUD";
   country[2] = "ALBANIA";
   country[3] = "ALGERIA";
   country[4] = "AFRICA CENTRALA";
   country[5] = "ANDORRA";
   country[6] = "ANGOLA";
   country[7] = "ANTARCTICA";
   country[8] = "ARGENTINA";
   country[9] = "ARMENIA";
  country[10] = "AUSTRALIA";
  country[11] = "AUSTRIA";
  country[12] = "AZERBAIJAN";
  country[13] = "BAHAMAS";
  country[14] = "BAHRAIN";
  country[15] = "BANGLADESH";
  country[16] = "BARBADOS";
  country[17] = "BELARUS";
  country[18] = "BELGIA";
  country[19] = "BELIZE";
  country[20] = "BENIN";
  country[21] = "BHUTAN";
  country[22] = "BOLIVIA";
  country[23] = "BOSNIA HERTEGOVINA";
  country[24] = "BOTSWANA";
  country[25] = "BRAZILIA";
  country[26] = "BRUNEI";
  country[27] = "BULGARIA";
  country[28] = "BURKINA";
  country[29] = "BURUNDI";
  country[30] = "CAMBODGIA";
  country[31] = "CAMERUN";
  country[32] = "CANADA";
  country[33] = "CAPE VERDE ISLANDS";
  country[34] = "CIAD";
  country[35] = "CHILE";
  country[36] = "CHINA";
  country[37] = "COLUMBIA";
  country[38] = "COMOROS";
  country[39] = "CONGO";
  country[40] = "COSTA RICA";
  country[41] = "CROATIA";
  country[42] = "CUBA";
  country[43] = "CIPRU";
  country[44] = "CEHIA";
  country[45] = "DANEMARCA";
  country[46] = "DJIBOUTI";
  country[47] = "DOMINICA";
  country[48] = "ECUADOR";
  country[49] = "EGIPT";
  country[50] = "SALVADOR";
  country[51] = "ERITREEA";
  country[52] = "ESTONIA";
  country[53] = "ETIOPIA";
  country[54] = "DIEGO GARCIA";
  country[55] = "FIJI";
  country[56] = "FINLANDA";
  country[57] = "FRANTA";
  country[58] = "GABON";
  country[59] = "GAMBIA";
  country[60] = "GEORGIA";
  country[61] = "GERMANIA";
  country[62] = "GHANA";
  country[63] = "GRECIA";
  country[64] = "GRENADA";
  country[65] = "GUATEMALA";
  country[66] = "GUINEEA";
  country[67] = "HAITI";
  country[68] = "OLANDA";
  country[69] = "HONDURAS";
  country[70] = "HONG KONG";
  country[71] = "UNGARIA";
  country[72] = "ISLANDA";
  country[73] = "INDIA";
  country[74] = "INDONEZIA";
  country[75] = "IRAN";
  country[76] = "IRAK";
  country[77] = "ISRAEL";
  country[78] = "ITALIA";
  country[79] = "JAMAICA";
  country[80] = "JAPONIA";
  country[81] = "IORDANIA";
  country[82] = "KAZAKHSTAN";
  country[83] = "KENYA";
  country[84] = "KIRGYZSTAN";
  country[85] = "KIRIBATI";
  country[86] = "COREEA";
  country[87] = "KUWAIT";
  country[88] = "LAOS";
  country[89] = "LETONIA";
  country[90] = "LEBANON";
  country[91] = "LESOTO";
  country[92] = "LIBERIA";
  country[93] = "LIBIA";
  country[94] = "LIECHTENSTEIN";
  country[95] = "LITUANIA";
  country[96] = "LUXEMBURG";
  country[97] = "MADAGASCAR";
  country[98] = "MALAWI";
  country[99] = "MALAYSIA";
 country[100] = "MALDIVES";
 country[101] = "MALI";
 country[102] = "MALTA";
 country[103] = "MAURITANIA";
 country[104] = "MAURITIUS";
 country[105] = "MEXIC";
 country[106] = "MOLDOVA";
 country[107] = "MONACO";
 country[108] = "MONGOLIA";
 country[109] = "MONTSERRAT";
 country[110] = "MAROC";
 country[111] = "MOZAMBIC";
 country[112] = "MYANMAR";
 country[113] = "NAMIBIA";
 country[114] = "NAURU";
 country[115] = "NEPAL";
 country[116] = "NOUA CALEDONIE";
 country[117] = "NOUA ZEELANDA";
 country[118] = "NICARAGUA";
 country[119] = "NIGERIA";
 country[120] = "NORVEGIA";
 country[121] = "OMAN";
 country[122] = "PAKISTAN";
 country[123] = "PANAMA";
 country[124] = "PAPUA NOUA GUINEE";
 country[125] = "PARAGUAY";
 country[126] = "PERU";
 country[127] = "FILIPINE";
 country[128] = "POLONIA";
 country[129] = "PORTUGALIA";
 country[130] = "QATAR";
 country[131] = "ROMANIA";
 country[132] = "RUSIA";
 country[133] = "RWANDA";
 country[134] = "SAN MARINO";
 country[135] = "ARABIA SAUDITA";
 country[136] = "SENEGAL";
 country[137] = "SEYCHELLES";
 country[138] = "SIERRA LEONE";
 country[139] = "SINGAPORE";
 country[140] = "SLOVACIA";
 country[141] = "SLOVENIA";
 country[142] = "SOLOMON ISLANDS";
 country[143] = "SOMALIA";
 country[144] = "SVALBARD";
 country[145] = "SPANIA";
 country[146] = "SRI LANKA";
 country[147] = "SUDAN";
 country[148] = "SURINAM";
 country[149] = "SWAZILAND";
 country[150] = "SUEDIA";
 country[151] = "ELVETIA";
 country[152] = "SIRIA";
 country[153] = "TAIWAN";
 country[154] = "TAJIKITAN";
 country[155] = "TANZANIA";
 country[156] = "THAILANDA";
 country[157] = "TOGO";
 country[158] = "TONGA";
 country[159] = "TRINIDAD";
 country[160] = "TUNISIA";
 country[161] = "TURCIA";
 country[162] = "TURKMENISTAN";
 country[163] = "TUVALU";
 country[164] = "UGANDA";
 country[165] = "UCRAINA";
 country[166] = "EMIRATELE ARABE UNITE";
 country[167] = "URUGUAY";
 country[168] = "UZBEKISTAN";
 country[169] = "VANUATU";
 country[170] = "VATICAN CITY";
 country[171] = "VENEZUELA";
 country[172] = "VIETNAM";
 country[173] = "WEST INDIES";
 country[174] = "SAMOA DE VEST";
 country[175] = "REPUBLICA YEMEN";
 country[176] = "YUGOSLAVIA";
 country[177] = "ZAIR";
 country[178] = "ZAMBIA";
 country[179] = "ZIMBABWE";

/* generates a random integer between 0 to 179 */

 var sr = Math.floor(Math.random() * 180);

/* stores the country name */

 var temp = country[sr];

/* declaring and initializing tries */

 var tries = 0;

/* the main function */

 function guessit()
 {

   var guess = document.form1.guess1.value;

   tries++;

   window.status = "Incercari : " + tries;

   switch(tries)
   {

     case 1:
     document.form1.hint.value = "Primul indiciu : numele statului incepe cu litera " + temp.charAt(0);
     break;

     case 2:
     document.form1.hint.value = "Al doilea indiciu : ultima litera este " + temp.charAt(temp.length - 1);
     break;

     case 3:
     document.form1.hint.value = "Ultimul indiciu : numele statului are " + temp.length + " litere";
     break;

     default:
     document.form1.hint.value = "Nu mai ai indicii";

   }

   if(guess.toUpperCase() == temp)	/* if guess equals to temp */
   {

     if(window.confirm("CORECT ! Statul era " + temp + ".\nVrei sa incerci din nou?"))
      window.location.reload();		/* reloads the page for a new game */

   }

   else
   {

     if(tries == 5) /* game over */
     {

	if(window.confirm("Ghinion ! Nu ai ghicit numele statului. Acesta era " + temp + "\nVrei sa incerci din nou?"))
	{
	  window.location.reload();	/* reloads the page for a new game */

	  document.form1.hint.value = "Scrie mai jos numele statului si apasa 'Ghiceste!'";

	}

     }

   }

 }

/* end of guessit() function! */


function catchKeyCode() //calls when the user press the RETURN key
 {

   if(event.keyCode == 13)
    guessit();

 }

 function stat()
 {
   window.status = "Incercari : " + tries;
 }

 function clearBox()
 {

   document.form1.guess1.value = "";

 }

 function newGame()
 {
   if(window.confirm("Vrei sa incepi un joc nou?"))
   {
     window.location.reload();	/* reloads the page for a new game */
     document.form1.hint.value = "Scrie numele statului si apasa 'Ghiceste!'";
   }

 }


-->