answer1 = "bugaga";
q = new Array();

q['q1'] = '1da0ccad2999ad8d1d4f31593530de40efad7d13';
q['q2'] = '57b6c01d282bd7b03a708bee8e5522fa878cc9fa';
q['q3'] = '503004db1699d755081879257b45d4a03ee42221';
q['q4'] = 'b5868943442c6468aa15c031fa9ec75bc2d02ddc';
q['q5'] = 'b4cdfb42877ed45206f1cb3b8752164197d4da19';
q['q6'] = '067f3ca7005b43e0397f790eaae1df5ad1b940c5';
q['q7'] = '7ec2f7f859080c1facf41745980c665f62c0cb6f';
q['q8'] = '4762c6e3cf6dc0ddcf707e7d3b103451b4eeec18';
q['q9'] = '3ddf58ce0933726d5389f86e6636ca3573b4f615';
q['q10'] = 'dbc413f1340bbb54a12e5a18911683504e5b8927';
q['q11'] = 'd77937e881ee78806307e60e0ba76e2803e2f0e5';
q['q12'] = 'ad53e077a983b3e4b015186ceb413ffde51f9d28';
q['q13'] = '431854a8bb1a49e8dc31c9234b6996c776fde5b7';
q['q14'] = '4b49b5285d0e6a774afa44b15e80dd73d40e2487';
q['q15'] = '3ddd8fec0196b709cf7035087bec6d889eaf262f';
q['q16'] = '0b22a83450e36912d1d98a2311dd8558a180da6c';
q['q17'] = '7058ee92596ff09b1a26c560aea8d614227da2c2';
q['q18'] = 'ce9a01e26d938bd03314ddf2f64c6ad450139917';
q['q19'] = '4dd1dc786c321aa9d102bcd92852fb6ddf8ded0d';
q['q20'] = 'b1c6a69aa24eadbc4e25671e250b79ef2a897640';
q['q21'] = '23d5a94a51cc4ea0ec469dfcc2e4763f6f5e3ba9';
q['q22'] = '35c856f37da6418b73d0391beb52c73eebfdd576';
q['q23'] = 'c4c607a77e063f0ca89a2cad1180588068ad9645';
q['q24'] = '20c5365d5f01aa200d516369d73e2fbf79acaa71';
q['q25'] = '54ec8a0f4b2de166c6ff63c777bc8d760ef14ef8';
q['q26'] = '9e5408f0a6e3865859e60717110d49bc2c24184e';
q['q27'] = '71729f0c1bc26a90dee27769e02c30bfdfaec63d';
q['q28'] = '5042b95f6aeaf534e8102e82c0c2858423bfc700';
q['q29'] = '478e4473a565831a862d31955ad0e678b39c8353';
q['q30'] = 'c821c6b680fe4242e02b1c55e9db0c2f5968cccf';
q['q31'] = 'dc26b9de0dbb9ad8de6958328690198eba0bf787';
q['q32'] = '7b38c702524b16b0ed03d6eaf1c69f6b0330f286';
q['q33'] = 'ace02c34da9a678c4de9668722f1ac233a669ec2';
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;
}