// D'après Dew. Recodé par DaScritch

q=new Array();function checkQ(a){if(sha1Hash(U8E(a.value.toUpperCase()))==q[a.id]){validate1(a)}else{validate2(a)}}function U8E(a){a=a.replace(/\r\n/g,"\n");var b='';for(var n=0;n<a.length;n++){var c=a.charCodeAt(n);if(c<128){b+=String.fromCharCode(c)}else if((c>127)&&(c<2048)){b+=String.fromCharCode((c>>6)|192);b+=String.fromCharCode((c&63)|128)}else{b+=String.fromCharCode((c>>12)|224);b+=String.fromCharCode(((c>>6)&63)|128);b+=String.fromCharCode((c&63)|128)}}return b};function validate1(a){if(a.disabled==false){a.style.backgroundColor='#7f7'}}function validate2(a){a.style.backgroundColor=(a.value=='')?'':'#f77'}function sha1Hash(g){var K=[0x5a827999,0x6ed9eba1,0x8f1bbcdc,0xca62c1d6];g+=String.fromCharCode(0x80);var l=Math.ceil(g.length/4)+2;var N=Math.ceil(l/16);var M=new Array(N);for(var i=0;i<N;i++){M[i]=new Array(16);for(var j=0;j<16;j++){M[i][j]=(g.charCodeAt(i*64+j*4)<<24)|(g.charCodeAt(i*64+j*4+1)<<16)|(g.charCodeAt(i*64+j*4+2)<<8)|(g.charCodeAt(i*64+j*4+3))}}M[N-1][14]=((g.length-1)>>>30)*8;M[N-1][15]=((g.length-1)*8)&0xffffffff;var h=0x67452301;var k=0xefcdab89;var m=0x98badcfe;var n=0x10325476;var o=0xc3d2e1f0;var W=new Array(80);var a,b,c,d,e;for(var i=0;i<N;i++){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);a=h;b=k;c=m;d=n;e=o;for(var t=0;t<80;t++){var s=Math.floor(t/20);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}h=(h+a)&0xffffffff;k=(k+b)&0xffffffff;m=(m+c)&0xffffffff;n=(n+d)&0xffffffff;o=(o+e)&0xffffffff}return h.toHexStr()+k.toHexStr()+m.toHexStr()+n.toHexStr()+o.toHexStr()}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}}function ROTL(x,n){return(x<<n)|(x>>>(32-n))}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};$(document).ready(function(){$('#contenu input[type=text]').each(function(){$(this).keyup(function(){checkQ(this)}).focus(function(){$(this).parents('li').css('background','#ff7')}).blur(function(){$(this).parents('li').css('background','')})});});