nbCasesCochees=0;nbCases=70;nbIndice=0;function makeArray(a){this.length=a;return this}var griTab=new makeArray(nbCases);function Case(a){this.etat=a}function changerCase(b,a){if(griTab[a].etat==0){nbIndice++;grilleOn(b,a);nbCasesCochees++}else{grilleOff(b,a);nbIndice--;nbCasesCochees--}}function grilleOn(a,b){x_pos=(b-1)*22;a.style.backgroundPosition="-"+x_pos+"px -27px";griTab[b].etat=nbIndice}function grilleOff(a,c){var b;x_pos=(c-1)*22;a.style.backgroundPosition="-"+x_pos+"px 0px";b=griTab[c].etat;griTab[c].etat=0;for(i=1;i<=nbCases;i++){if(griTab[i].etat>=b){griTab[i].etat--}}}function recupererNumCochees(){liste="";selection=new makeArray(nbCases);for(i=1;i<=nbCases;i++){selection[i]=0}for(i=1;i<=nbCases;i++){if(griTab[i].etat!=0){selection[griTab[i].etat]=i}}for(i=1;i<=nbCases;i++){if(selection[i]!=0){liste+=selection[i]+","}}return liste}function effacer(){nbCasesCochees=0}function initGrille(){for(i=1;i<=nbCases;i++){griTab[i]=new Case(0)}}function afficheGrille(){document.write('<table border="0" cellspacing="1">');for(i=1;i<=10;i++){document.write("<tr>");for(j=0;j<=60;j+=10){numero=i+j;x_pos=(numero-1)*22;document.write('<td valign="middle" align="center" width="22" height="27">');document.write('<a title="'+numero+'" href="#" onClick="changerCase(this, '+numero+'); return false;" class="NumeroGrille" style="background-position:-'+x_pos+'px 0px;"></a>');document.write("</td>")}document.write("</tr>")}document.write("</table>")};