answer1 = "bugaga";
q = new Array();

q['q1'] = 'ec62abe121fe55030ae3774e49f92c9710ab07f8';
q['q2'] = 'b791be083b11222227943debb441c7e990e7b185';
q['q3'] = 'd59fcf1c64a0836c2d8a365359267d2f9b44bacf';
q['q4'] = '0082ba236aa9174a31b2c42f5fefd700e05a1d71';
q['q5'] = 'ad532f581123b957d089edec3fc4350c9ca6f885';
q['q6'] = 'b4ad86f630fff11ee3632dfae5f97365e0c3e278';
q['q7'] = '39fe3aac2b2032f4a9b820c917c614d62940441c';
q['q8'] = '6cabf9768eac14ea23bdf3cd1db9c280fa6cccc0';
q['q9'] = '5292219b224e04a6ba330af11528a67313de5aac';
q['q10'] = 'f5c11612ba33b5fe3260e5b3bf790933c009782f';
q['q11'] = '282fc4d44426b59356d6612f138ea0afe7851f26';
q['q12'] = 'b847100a65f4630145e5d4a04428802c8702b468';
q['q13'] = '334d7786d595e25f8b95f065b27aae3bc04a9c69';
q['q14'] = 'dcc2fc3b378e7949f1e2a2d4271a130c44d2e840';
q['q15'] = '8e13d70bf606adcbb463aad39f0f584612edd590';
q['q16'] = '3e816bab012c3f9745f09f8e3cfebfde33c93dac';
q['q17'] = '731786b7a5dea9a8f761a5bf0184e6e8b8ebe65d';
q['q18'] = '676fa054442689a62f17ec82e7aef25d3b1db33a';
q['q19'] = '00ca48c3a6784e40c841a97ef0a68e6a9f5365c7';
q['q20'] = '865ffedcda18e9441435ebbe81901c7e33ce268e';
q['q21'] = '13418ae17ca83de7fb6aff94ed6ae07fe69e6a89';
q['q22'] = 'de359da9b8333f94a02c37922fb8aee774bd6218';
q['q23'] = '04fdcedd22e811b93671e93e19730424b5339b58';
q['q24'] = 'cb92aa3bd709f96dc3bbe46d3e559ccc80a9aec5';
q['q25'] = '3b73717e3383a6049561fa76013e36db4e23bf4d';
q['q26'] = 'c71beebc1cb9df1a71a455792cd2fbc7459b6d2b';
q['q27'] = '171194186e41dc6c2e1533b606a6e6d098b383f0';
q['q28'] = '391c578e5a6b9b3f68f4c151707dedfc87555f9b';
q['q29'] = '10dd007d2e68113c0d5c7f60fcac44a49656dfe5';
q['q30'] = '647c7c12694c2c7575ec033e4aaed589588fde44';
q['q31'] = 'dec2f17ee14ce760bd9248eddae4696c4e1966f5';
q['q32'] = '7aa68db78a2fa4929db9b925f21c241b2bf19c70';
q['q33'] = 'fd48a5920646de1f3da01ac0f6e1ea3fed3d422c';
function checkQ(str) {
if(sha1Hash(document.getElementById(str).value.toUpperCase()) == q[str])
{
validate1(str);
}
else
{
validate2(str);
}

}
function validate1(qstr) {
if(document.getElementById(qstr).disabled == false) {
document.getElementById(qstr).disabled = true;
document.getElementById(qstr).style.border = '2px solid #00FF00';
document.getElementById('correct').innerHTML = document.getElementById('correct').innerHTML*1 + 1;
}
}

function validate2(qstr) {
if(document.getElementById(qstr).value=='') {
document.getElementById(qstr).style.border = '1px solid #A5ACB2';
}
else
{
document.getElementById(qstr).style.border = '2px solid #FF0000';
}
}


function sha1Hash(msg)
{
    // constants [4.2.1]
    var K = [0x5a827999, 0x6ed9eba1, 0x8f1bbcdc, 0xca62c1d6];

    // PREPROCESSING

    msg += String.fromCharCode(0x80);  // add trailing '1' bit to string [5.1.1]

    // convert string msg into 512-bit/16-integer blocks arrays of ints [5.2.1]
    var l = Math.ceil(msg.length/4) + 2;  // long enough to contain msg plus 2-word length
    var N = Math.ceil(l/16);              // in N 16-int blocks
    var M = new Array(N);

    for (var i=0; i<N; i++) {
        M[i] = new Array(16);
        for (var j=0; j<16; j++) {  // encode 4 chars per integer, big-endian encoding
            M[i][j] = (msg.charCodeAt(i*64+j*4)<<24) | (msg.charCodeAt(i*64+j*4+1)<<16) |
                      (msg.charCodeAt(i*64+j*4+2)<<8) | (msg.charCodeAt(i*64+j*4+3));
        } // note running off the end of msg is ok 'cos bitwise ops on NaN return 0
    }
    // add length (in bits) into final pair of 32-bit integers (big-endian) [5.1.1]
    M[N-1][14] = ((msg.length-1) >>> 30) * 8;
    M[N-1][15] = ((msg.length-1)*8) & 0xffffffff;

    // set initial hash value [5.3.1]
    var H0 = 0x67452301;
    var H1 = 0xefcdab89;
    var H2 = 0x98badcfe;
    var H3 = 0x10325476;
    var H4 = 0xc3d2e1f0;

    // HASH COMPUTATION [6.1.2]

    var W = new Array(80); var a, b, c, d, e;
    for (var i=0; i<N; i++) {

        // 1 - prepare message schedule 'W'
        for (var t=0;  t<16; t++) W[t] = M[i][t];
        for (var t=16; t<80; t++) W[t] = ROTL(W[t-3] ^ W[t-8] ^ W[t-14] ^ W[t-16], 1);

        // 2 - initialise five working variables a, b, c, d, e with previous hash value
        a = H0; b = H1; c = H2; d = H3; e = H4;

        // 3 - main loop
        for (var t=0; t<80; t++) {
            var s = Math.floor(t/20); // seq for blocks of 'f' functions and 'K' constants
            var T = (ROTL(a,5) + f(s,b,c,d) + e + K[s] + W[t]) & 0xffffffff;
            e = d;
            d = c;
            c = ROTL(b, 30);
            b = a;
            a = T;
        }

        // 4 - compute the new intermediate hash value
        H0 = (H0+a) & 0xffffffff;  // note 'addition modulo 2^32'
        H1 = (H1+b) & 0xffffffff;
        H2 = (H2+c) & 0xffffffff;
        H3 = (H3+d) & 0xffffffff;
        H4 = (H4+e) & 0xffffffff;
    }

    return H0.toHexStr() + H1.toHexStr() + H2.toHexStr() + H3.toHexStr() + H4.toHexStr();
}

//
// function 'f' [4.1.1]
//
function f(s, x, y, z)
{
    switch (s) {
    case 0: return (x & y) ^ (~x & z);
    case 1: return x ^ y ^ z;
    case 2: return (x & y) ^ (x & z) ^ (y & z);
    case 3: return x ^ y ^ z;
    }
}

//
// rotate left (circular left shift) value x by n positions [3.2.5]
//
function ROTL(x, n)
{
    return (x<<n) | (x>>>(32-n));
}

//
// extend Number class with a tailored hex-string method
//   (note toString(16) is implementation-dependant, and
//   in IE returns signed numbers when used on full words)
//
Number.prototype.toHexStr = function()
{
    var s="", v;
    for (var i=7; i>=0; i--) { v = (this>>>(i*4)) & 0xf; s += v.toString(16); }
    return s;
}
function resetForm() {

for(i=1;i<34;i++) {
document.getElementById('q'+i).disabled = false;
}
document.forms[0].reset();
}
//end of antoha's js
function RandomImage(images)
{
 imageSet = new Array();
 imageSet = images.split(",");
 ind = Math.floor(Math.random() *imageSet.length);
 return imageSet[ind];
}

function OpenPic(PicName)
{
var image=RandomImage(PicName);
window.open("http://www.grog.vsu.ru/show.php?img="+image, "", "scrollbars=no,resizable=no")
}

function OpenUrl(Url)
{
window.open("http://www.grog.vsu.ru/show.php?img="+Url, "", "scrollbars=no,resizable=no")
}

function AreYouReally()
{
return confirm("?? ???????, ??? ?????? ??????? ??? ??????????");
}

function smilie(thesmilie) {
// inserts smilie text
document.write_message.user_message.value += thesmilie+" ";
document.write_message.user_message.focus();
}

function SelectAll(mark)
{
  for (i = 0; i < document.forms['delete_form'].elements.length; i++)
   {
    var item = document.forms['delete_form'].elements[i];
    if (item.name == "del_id[]")
     {
      item.checked = mark;
     };
   }
}

function CheckSelect(form)
{
  for (i = 0; i <form.elements.length; i++)
  {
    var item = form.elements[i];
    if (item.name == "del_id[]")
    {
      if (item.checked){

	return true;

      }
    }
  }
  alert("?? ??????? ?????????");
  return false;
}
