q = new Array();
q['q1'] = new Array('51dc735e17c623f2e0eb225b75b2efa85a76bf70');
q['q2'] = new Array('3896398c15c93a03a01be09bbd081e1dfae191a7');
q['q3'] = new Array('9623985670b1f2373458188233f7c55cd8838126');
q['q4'] = new Array('11e2787de54c2d5a1424d32422a7602cf97d47d8', '26fa441b8aa9e16c34d8b27b293cb9fa513032ac', 'aa0826f1b859330cf933c9af3791a0a362062487');
q['q5'] = new Array('92d3aa776a8a34f2b4ad3ff17fc36d8ab19a04f5');
q['q6'] = new Array('a11803df53b196dda89ca8c18a1943698b5ccfb6');
q['q7'] = new Array('1773d755560d34b05b7dfd108c20c1bacba19a31');
q['q8'] = new Array('1773d755560d34b05b7dfd108c20c1bacba19a31');
q['q9'] = new Array('faf0ca6c1703a156621a2480b4f9e10035b08a6a');
q['q10'] = new Array('5859c64f8db1508fba3ed57b794878aef07fff71', '4964ff5dadba1542da876297f443986d554f8c22');
q['q11'] = new Array('15817417dd574aa73ab123efd7312362a27556b5');
q['q12'] = new Array('53827aec9d340d6c7a339110d6b443269f6640e9');
q['q13'] = new Array('85581bab614ad552c999f8f00a8bd076ca318a61', '571a710e3e2ae3e29778670285096a9ee6bc0c33', '3d5f356f8162a658172b5470376c3e02e3d7fc19');
q['q14'] = new Array('b2a86317a58b2408f0b7c13a26663e3a95b26f8d', 'b2a86317a58b2408f0b7c13a26663e3a95b26f8d');
q['q15'] = new Array('026c5de602444178915df2a9d142cb981fb27723');
q['q16'] = new Array('d19f00b906342f74a4b2fe9a908de21ffb8af3c3');
q['q17'] = new Array('7a1a7d4ba634a13b209b2ea877c69513c28f8093');
q['q18'] = new Array('0e32c5ef297a6eaaff5b4e3db214d0c9b05320e2');
q['q19'] = new Array('c06beae551928efe8b658611dc0c842c566b3320');
q['q20'] = new Array('391195113fa921176acd2fe2d1ae8c53b9ea2a9f');
q['q21'] = new Array('1bb4b1ff26733d258e79a93e3ec9a4151fb71517');
q['q22'] = new Array('a6f2a2586622a188fbb8d61cd467dd29943e3b5c');
q['q23'] = new Array('8ab7415c70a6f847aab5a6d4c685a0896fc3a0b1');
q['q24'] = new Array('0724c2018025f90475d7c244bfea9efe31a1bf3f', '48d837fca857aafc5502e26da0f94081c8b07380');
q['q25'] = new Array('1e4dc2137f3ef9e364f89ff75f1f179e9be9cb2d');
q['q26'] = new Array('2d337b62ad65bdbe589d86ad94a5b391f91c22dc');
q['q27'] = new Array('c9cf9fe750a6df06356e530f5df79f86ab94d80f');
q['q28'] = new Array('ac790aacdc07b3fb0db549875f47a3d5a7226472');
q['q29'] = new Array('02080db6375c14f6b4dc457e72857e35d232b1ec', '1e64ff6477ef2ab0bfd28389c925ec62533398ec');
q['q30'] = new Array('0f5895a7eb5c66cc93d5ce84e9e934b88000ea1a');
q['q31'] = new Array('36c0ce3dafd8d744c9829b8184bfdfa33d7b2f61');
q['q32'] = new Array('dcb81ca152c583d2662d859a48f0b286d02f8cb6');
q['q33'] = new Array('b26a52d0906b87ae97acbcba515bac949b5df83b');
q['q34'] = new Array('28b76550f6c76ae0c817d6a7792dff48c2bd7fa5');
q['q35'] = new Array('b13ff06103c2e9f02ce6a72595b39155542e3ab2');
q['q36'] = new Array('00809a88d594fd36c46a2687547484c9ea179923');
q['q37'] = new Array('46411e8985c243571beb040ed236a1f8bf3577ab');
q['q38'] = new Array('6edf1aaf8c81e0598039286b9e6992ae3059dc07');
q['q39'] = new Array('5b2132f9f621ebf5b9e2092d78408d5efa514809');
q['q40'] = new Array('fb1a3029f7cf31e7151d83122756eb2afc0c6646');
q['q41'] = new Array('3085512a38f4fc8aa670bf826652d9161e763fe0');
q['q42'] = new Array('bb2dd136917bd68270bd388eafd732990595d5eb');
q['q43'] = new Array('5dd5a303cac113d04f65c884e188df78a65784fc');
q['q44'] = new Array('9ecba8254e186f279e9f5d0e34cb5a6a2b6dc313');
q['q45'] = new Array('22c49ff8422ae5ff9cd8ae4837f6fc9f81670165');
q['q46'] = new Array('ebf2a7d0d2fe284680cad58c0d37a4b9eb0a8bfc');
q['q47'] = new Array('e358333ef18dd6474655363e52d7e4ec97582c1d');
q['q48'] = new Array('dcfafd1ef709b4d4bd1001d944d6e5f8e4d9a748');
q['q49'] = new Array('880e608af561a6b6daba33585a73524dbfaf400c');
q['q50'] = new Array('37aa8010ea6618833b6dd7ea16bd6325d392ceed');
q['q51'] = new Array('1960bf22e8b27ba08a873606762df976f086be9a', '3f3d7d37b5e41c5df2e5f0c5d36db7012b5097c9');
q['q52'] = new Array('4a89cf0a5507ac904af390671cfb7ef391a8d8e3');
q['q53'] = new Array('919ff8708bd9e22a958735fd59416dcd59d01942');
q['q54'] = new Array('6b3f27ab7cbf0129fca2c612e86aea0e1ae7e9c6');
q['q55'] = new Array('2eb5afda657c4b3644d0549b82b3d7b9637e9d72', '69bb281cc0895744692157f7357c38e1be17492c');
q['q56'] = new Array('03ffae8d42611c826969f3550fe238e8a7b9767c');
q['q57'] = new Array('3865cebf3c4423e9025b5d75d1601e2c6b59e57e');
q['q58'] = new Array('ef1dccc3a3d406780e591d4a60c4872b9b2a3700', 'f896468c89df69d9398acbba7b69f304e9038526');
q['q59'] = new Array('aa773c0e236a816cd1fd4c8b9c9e1993ed8cc4b0');
q['q60'] = new Array('0fb77b35546f2aa5e325f44378704ea9c8baf02b');
q['q61'] = new Array('30548929e577f019274ddda47c770678155c5e85');
q['q62'] = new Array('86efdbc0d97641117fb77cc41e63aa2b8a0e5791');
q['q63'] = new Array('3bc4f06e09773ded77ca0781ed9644716c5599f6', 'ce26d58574a06eaab9ed14250bf3ff94fa937cce');
q['q64'] = new Array('89da046a91a6bc415e3b0b3bda9bf42b00bbd675');
q['q65'] = new Array('246930167c67cd950f57de823be18ffddc66063f');
q['q66'] = new Array('cda8fd423e73a84edb6ea605a99afd8d2cf8e42d');
q['q67'] = new Array('aaf53373e142f7baa617afea074271cc319abb3f', '5dac91fcffe6128d9f61b353b37340f05f59c568');
q['q68'] = new Array('68fa7e6293ee6826c26362215de7ddc6f7b1c503');
q['q69'] = new Array('27090c9a208de2addbdd37258a0a7594ee1a9d70');
q['q70'] = new Array('90fa43979e4673bcedeed39a725e7394baa77e72');
q['q71'] = new Array('e8b130f362341695cf74aba18fe9ffd29f25d517');
q['q72'] = new Array('e241500e7088b0adf8d1b569a712d084875051dc');
q['q73'] = new Array('21c534b77afb42a16cc80f7346fd1112eeff6b9d');
q['q74'] = new Array('cceee3a96886e7b897c395c7c97817f21c137e6b');
q['q75'] = new Array('c422d51c1baad124f260c3635ee1f24cb0e09de6', '7ca522235ff61fdb11cd34554c7b1cd407660549');
q['q76'] = new Array('39a2f84d7800d1e09c7f64a9707a2e5df27aec9c');
q['q77'] = new Array('d3c584e0101f6d0ab1d8a004f3fd5a0194c9bb8c', 'a2f67e04032adc740d49f810a27beabbdd9ef7b4', 'fa109b2ba048bf7998ea38267925ca70a3205fc8');
q['q78'] = new Array('afabc886f8dde2c613c40a5f4ecb7e9f6ffba471');
q['q79'] = new Array('32c361e1f4ec7583a3724283257e0f64831a5958');
q['q80'] = new Array('9611746d4d18660c73f064cb612deafb3ecbefa9');
q['q81'] = new Array('e54ca9af296661af131f42bb6dfcf3dbd9bf2360');
q['q82'] = new Array('79cd23762d970235699e5033e00d38592ecd04d0', '1510bc4a211184a9f5d957ed08e2bf67727dec14');
q['q83'] = new Array('a16322260f8a16038bb0e63612cf0dc7367b413e', '2b317dd1afa75347ad2eed3c7d81a8cd03028f80');
q['q84'] = new Array('4479f45bb0dba5f3064b9c05cc88fdb4a41ce600');
q['q85'] = new Array('8d8217a46b0dbe8aab61fdc313eda45eb080fba8');
q['q86'] = new Array('343d6819393ae46a14c07e04a50ef81b37c256d6', '1acf6c978ee17e06a6dd1acb1476653b50bbf225', 'ce0720c7e789a9ad0e32c997f123d658d2ba8748');
q['q87'] = new Array('b5f1b9b7b153f3c35ec4dd56a5cc17ae50ed9672');
q['q88'] = new Array('79659a0ae43878c2ebc2214f9d8105a1987231cb');
q['q89'] = new Array('878c1ca5caf10f47ff57139bbc39989f48e3d16c');
q['q90'] = new Array('ca6a26c43bd1b2e5aadacca63b4f2cc751840f50');
q['q91'] = new Array('62110be5f0577b94e0a3ab463599e2b265b49a28');
q['q92'] = new Array('95176c19aa71caa07dfbaa39597d0d9d6b62a553');
q['q93'] = new Array('44cd399c4a02f80f3800e5562ff07a02c1ffba37');
q['q94'] = new Array('65fd3f4801329723a0339d9cadb2d3122245cb3e', '1272c41bcbe1322e13d5f8c632b6df74a008ab49');
q['q95'] = new Array('7459fd3490b080c478a967fe2d20b0ffdd0d7505');
q['q96'] = new Array('1ebc1d0aa8b398df024667b13c983ac1080e5384');
q['q97'] = new Array('14fdd3607d8275506d50127433d40a55b519b20c');
q['q98'] = new Array('178e8e8290b14279d622df6c998250e016db647b');
q['q99'] = new Array('f3146ac5c38aa898b23d406dd53994bdf8e95fb8');
q['q100'] = new Array('1453c41d9617e25b2884ae8d11423aa8917d6192');
q['q101'] = new Array('1267e8788a466a9a0191ce4e012f57d42f14c4f8');
q['q102'] = new Array('9ab9b6b0af8d5479cf62ac9562032fbc8066a3c5');
q['q103'] = new Array('11e14a884c79669a77ebcd15d7a9eaa17221c11f', '63e32cb250b40f68181809c5e2219108abf2b7ef', '93b68eaede0d33aa9e6eba002ea85a89c9a76874', '5ad36eacb1582179ebc3d576637050146413f80c');
q['q104'] = new Array('6de78863a0066d57c4bce7df97af0d6b4311cfdd');
q['q105'] = new Array('bba579aff85f1c6f415b479301bb2afed1db415b');
q['q106'] = new Array('62e4baf3eb57502bf6ecdbb643b9ec2190473a11');
q['q107'] = new Array('a8efac1088225b6f49647ccd0a7961a4c4255932');
q['q108'] = new Array('77f3e22331f2dac63484289238be24ce3ab5dedd');
q['q109'] = new Array('ad9d9736d63136a2675034585315dfa2452e26e8');
q['q110'] = new Array('0e32c5ef297a6eaaff5b4e3db214d0c9b05320e2');
q['q111'] = new Array('01dffec39771e26b2c947405ce5fccc1fc2895d9');
q['q112'] = new Array('40de80ffb4c75483f37b5f62fc78bfde3b76f48b', '664fe8f1bf0fb0aef80d9a766bcd2a2eec3477c5');
q['q113'] = new Array('e79a667cdd373d409651ff58f73bb8e370018fe5');
q['q114'] = new Array('266c5258f798aaa031c567c5b737bb51c71e128a');
q['q115'] = new Array('621638a281a1fe6d531c7201f2848cc3c855a9d7');
q['q116'] = new Array('d0f48cab6b094bf2fd42e7f3007bfb572a14f1e9');
q['q117'] = new Array('9368dd89a66c4b041ecee765a993c6d04ccef35f');
q['q118'] = new Array('77e3fbcaba0475052223757aa0413a24fa9e085a');
q['q119'] = new Array('bb56e2820eac60bbcb31de7e5c2267518f57fa03');
q['q120'] = new Array('a8682547c59257196293bf6ad0a4136edc526abe');
q['q121'] = new Array('84ff77ad8af9e7329908a0477932ea58072d4726');
q['q122'] = new Array('0f70d719a4c29a9ac28a2f004f0ce9d753597ec8');
q['q123'] = new Array('fc3d7c5e0ede8c8e474a2a380a0efdb30f3e00fa');
q['q124'] = new Array('8a5a5b56c31b8b5285e767e28cbbb98d3ae3749b');
q['q125'] = new Array('ef209cf4e3eb338c6e489794c54433975691996e');
q['q126'] = new Array('7c4293feb45f8538baf2c1ca7527be9fcd6fe658');
q['q127'] = new Array('0912b34ea6bd6094f190d9639fe51a3633202078');
q['q128'] = new Array('c4753cc0fb22a881bbb9e80210390bf874190572');
q['q129'] = new Array('1b6507dafc59579be2c684692c38903c4a5411dd', '3f86060a5da14accf974aafac17f9e877d8adcd0', '39e2c54d06c2587e9baef6bb00f4a96d1b7d6dae');
q['q130'] = new Array('7b818d52ca01b6820e70a7fa35dc1c24b74f77f7');
q['q131'] = new Array('7c3af762e4f2bbe762b2e2de17c2289d5f384e56');
q['q132'] = new Array('97ff64dc90b0ac0405ea5ac4f745cdf7f40d25ef');
q['q133'] = new Array('e59983090b694fdcb0a74c6506eeced8891e5256', '9ee053aaad460efe287debdb00b846afe50f7ae1');
q['q134'] = new Array('52e6920e4314575e484b018a771e03de736b544e');
q['q135'] = new Array('6c65dea883dabe23c23bd2c63c8bcc5ca4624228');
q['q136'] = new Array('09f7ad48f25cc09e8f4ec2ba7a0032997da0d011');
q['q137'] = new Array('823502059b835b1af5e61ea959159420d5fc5858');
q['q138'] = new Array('249f3451d4632669212353dd48d46d2379fa770a', 'd3bf9bcd2d0aa97e30db4051fb5d21bff3817f1d');
q['q139'] = new Array('5e27accca32f1a72b6bb06f231a6562db1caa1a1');
q['q140'] = new Array('4eea43b431267d5249b3d0178c09a8ea2298b355', '818a540e30ab57b13eb553ddc106c2ebdde88759');
q['q141'] = new Array('0e6fd5fbde59beeab5de7be80c38de9be9be750e', 'a4dbe3d137b10a18a8f36d3224d79742d2c74ba2');
q['q142'] = new Array('e290cf13e129ce33cd39dd84d269b61ff4c0695b', 'f39ed473c12e3d37c6796206bd597444307a23ca');
q['q143'] = new Array('f7faf6417a9411b71a9ef7bf8aa6d89ffd584f16');
q['q144'] = new Array('d4dca1f619a6a631a5730aaac323c135af58513b');
q['q145'] = new Array('0f70e320eeb9bc0c7c922861e5f6222654c26e94', '069d950d9ed76722146e6641f4d62e28a50a3e67');
q['q146'] = new Array('98ec0fbda09b361e21defb236642902ce160a74a', 'b2dce705d0fd53264e6d6ab81837dd3eadd64b79');
q['q147'] = new Array('a8af4641b91453a160d042aa27cfc63fcc44bdbb');
q['q148'] = new Array('2ae9ba11c4431b6b77bddc2d93a4003668a5a330');
q['q149'] = new Array('69fba63fd4d3c9c1ea2f153579ff4d4fa7309fe8');
q['q150'] = new Array('25e4c4111be1686eed25692d7734a39787bd2338');

 

function simplifica(msg) {
	
	var str=msg.toUpperCase();
	str=str.replace(/ /g,'');			
	str=str.replace(/\,/g,'');			
	str=str.replace(/\./g,'');			
	str=str.replace(/\-/g,'');			
	str=str.replace(/\'/g,'');			
	str=str.replace(/\:/g,'');			
	str=str.replace(/\(/g,'');			
	str=str.replace(/\)/g,'');	
	str=str.replace(/\?/g,'');			
	str=str.replace(/\¿/g,'');			
	str=str.replace(/\!/g,'');			
	str=str.replace(/\¡/g,'');							
	str=str.replace(/Á/g,'A');
	str=str.replace(/É/g,'E');
	str=str.replace(/Í/g,'I');
	str=str.replace(/Ó/g,'O');
	str=str.replace(/Ú/g,'U');
	
	
	return str;
	
}  


function mirar(str) {

var ok=0;
for (x in q[str])
{
	if(sha1Hash(simplifica(document.getElementById(str).value)) == (q[str][x]) 	)
	{
		
		ok=1;
	}
}  


	if(ok)
	{
		validar1(str);
	}
	else
	{
		validar2(str);
	}
	
}

function carga() { 
	
	for (var i=1; i<=150; i++) {		
		str='q'+i;	
		document.getElementById(str).style.border = '1px solid #A5ACB2';
		document.getElementById(str).disabled = false;

		/*str='q'+i+'b';	
		document.getElementById(str).style.border = '1px solid #A5ACB2';
		document.getElementById(str).disabled = false;*/
		
	} 
} 


function validar1(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 validar2(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<=150;i++) {
	document.getElementById('q'+i).disabled = false;
	
	/*document.getElementById('q'+i+'b').disabled = false;*/
	}
	document.forms[0].reset();
}