ï»¿var go;
var go1;
var annonce;
var equipe1;
var equipe2;

function ouvrir(url,nom){
		j1=document.getElementById("equipe1").value;
		j2=document.getElementById("equipe2").value;
		if(document.getElementById("annonce").checked)annonce="ok";
		else annonce="ko";
		if(j1=="" || j2=="")alert("Il manque des joueurs !");
		else return window.open(url,nom);
}

function chargeMenu(){ //génére les balises select pour le menu
	preneur="<span><select id='preneur'>";
	preneur+="<option value=''>Preneur...</option>";
	for(a=1;a<=2;a++){
		preneur+="<option value='J"+a+"'>"+document.getElementById('equipe'+a).value+"</option>";
	}
	preneur+="</select></span><br/><br/>";
	go.menu.document.getElementById("affichageMenu").innerHTML=preneur;
	
	nbpoint="<span><select id='point'><option value=''>Nombre de points...</option>";
	for(i=162;i>=0;i--){
		nbpoint+="<option value='"+i+"'>"+i+"</option>";
	}
	nbpoint+="</select></span><br/><br/>";
	go.menu.document.getElementById("affichageMenu").innerHTML+=nbpoint;
	
	beEtRe="<span><select id='beEtRe'>";
	beEtRe+="<option value=''>Belote et rebelote...</option>";
	for(a=1;a<=2;a++){
		beEtRe+="<option value='J"+a+"'>"+document.getElementById('equipe'+a).value+"</option>";
	}
	beEtRe+="</select></span><br/><br/>";
	go.menu.document.getElementById("affichageMenu").innerHTML+=beEtRe;
	
	if(annonce=="ok"){
		annoncePour="<span><select id='annoncePour'>";
		annoncePour+="<option value=''>Annonce pour...</option>";
		for(a=1;a<=2;a++){
			annoncePour+="<option value='J"+a+"'>"+document.getElementById('equipe'+a).value+"</option>";
		}
		annoncePour+="</select></span><br/><br/>";
		go.menu.document.getElementById("affichageMenu").innerHTML+=annoncePour;
		
		carreV="<span><select id='carreV'>";
		carreV+="<option value=''>CarrÃ© de valets...</option>";
		carreV+="<option value='1'>X 1</option>";
		carreV+="</select></span><br/><br/>";
		go.menu.document.getElementById("affichageMenu").innerHTML+=carreV;
		
		carre9="<span><select id='carre9'>";
		carre9+="<option value=''>CarrÃ© de 9...</option>";
		carre9+="<option value='1'>X 1</option>";
		carre9+="</select></span><br/><br/>";
		go.menu.document.getElementById("affichageMenu").innerHTML+=carre9;
		
		carreA="<span><select id='carreA'>";
		carreA+="<option value=''>CarrÃ© d'as, 10, roi, dame...</option>";
		for(a=1;a<=4;a++){
			carreA+="<option value='"+a+"'>X "+a+"</option>";
		}
		carreA+="</select></span><br/><br/>";
		go.menu.document.getElementById("affichageMenu").innerHTML+=carreA;
		
		cent="<span><select id='cent'>";
		cent+="<option value=''>Cent...</option>";
		for(a=1;a<=2;a++){
			cent+="<option value='"+a+"'>X "+a+"</option>";
		}
		cent+="</select></span><br/><br/>";
		go.menu.document.getElementById("affichageMenu").innerHTML+=cent;
		
		cinquante="<span><select id='cinquante'>";
		cinquante+="<option value=''>Cinquante...</option>";
		for(a=1;a<=4;a++){
			cinquante+="<option value='"+a+"'>X "+a+"</option>";
		}
		cinquante+="</select></span><br/><br/>";
		go.menu.document.getElementById("affichageMenu").innerHTML+=cinquante;
		
		tierce="<span><select id='tierce'>";
		tierce+="<option value=''>Tierce...</option>";
		for(a=1;a<=4;a++){
			tierce+="<option value='"+a+"'>X "+a+"</option>";
		}
		tierce+="</select></span><br/><br/>";
		go.menu.document.getElementById("affichageMenu").innerHTML+=tierce;
	}
	donne="<span><select id='donne'>";
	donne+="<option value=''>Fausse donne...</option>";
	for(a=1;a<=2;a++){
		donne+="<option value='J"+a+"'>"+document.getElementById('equipe'+a).value+"</option>";
	}
	donne+="</select></span>";
	go.menu.document.getElementById("affichageMenu").innerHTML+=donne;
}

function calculatrice(){
	if(go.haut.document.getElementById("calc").value==""){
		go.haut.document.getElementById("resultCalc").innerHTML="";
	}
	else{
		pointAdv=go.haut.document.getElementById("calc").value;
		pointAdv2=parseFloat(pointAdv);
		pointPreneur=162-pointAdv2;
		go.haut.document.getElementById("resultCalc").innerHTML=pointPreneur;
	}
}

function init(){
	// affichage des noms des équipes dans la frame du haut
	equipe1=document.getElementById("equipe1").value;
	equipe2=document.getElementById("equipe2").value;
	
	affichageJoueur="<table width='730' cellspacing='0' cellpadding='0'>";
	affichageJoueur+="<tr class='nomJoueur'>";
	affichageJoueur+="<td align='center' class='bordureJoueur bordure2'>DÃ©tails</td>";
	affichageJoueur+="<td align='center' width='240' class='bordureJoueur'>"+equipe1+"</td>";
	affichageJoueur+="<td align='center' width='240' class='bordureJoueur'>"+equipe2+"</td>";
	affichageJoueur+="</tr>";
	affichageJoueur+="</table>";
	go.haut.document.getElementById("nomJoueur").innerHTML+=affichageJoueur;
	
	//préparation de l'affichage des scores en noir pour impression (cacher dans la frame du haut)
	affichagePrint="<table width='730' cellspacing='0' cellpadding='0'>";
	affichagePrint+="<tr class='nomJoueurPrint'>";
	affichagePrint+="<td align='center' width='240' class='bordurePrintJoueur bordurePrint2'>"+equipe1+"</td>";
	affichagePrint+="<td align='center' width='240' class='bordurePrintJoueur'>"+equipe2+"</td>";
	affichagePrint+="</tr>";
	affichagePrint+="</table>";
	affichagePrint+="<span id='printAffich'>";
	affichagePrint+="</span>";
	go.haut.document.getElementById("affichPrint").innerHTML+=affichagePrint;
}

function alerte(){ // Message d'alerte
	preneur=go.menu.document.getElementById("preneur").value;
	nbPoint=go.menu.document.getElementById("point").value;
	beEtRe=go.menu.document.getElementById("beEtRe").value;
	donne=go.menu.document.getElementById("donne").value;
	if(annonce=="ok"){
		annoncePour=go.menu.document.getElementById("annoncePour").value;
		carreV=go.menu.document.getElementById("carreV").value;
		carre9=go.menu.document.getElementById("carre9").value;
		carreA=go.menu.document.getElementById("carreA").value;
		cent=go.menu.document.getElementById("cent").value;
		cinquante=go.menu.document.getElementById("cinquante").value;
		tierce=go.menu.document.getElementById("tierce").value;
	}
	go.menu.document.getElementById("alerte").innerHTML="&nbsp;";

	if(victoire=="ok")go.menu.document.getElementById("alerte").innerHTML+="Cette partie est terminÃ©,<br/>retournez sur la page d'accueil<br/>pour remettre les compteurs Ã  0.";
	else if(annonce=="ko"){
		if(preneur=="" && nbPoint=="" && beEtRe=="" && donne=="")go.menu.document.getElementById("alerte").innerHTML+="Il n'y a rien de sÃ©lectionnÃ©<br/>";
		else if(donne!="" || preneur=="" || nbPoint==""){
			// si fausse donne
			if(donne!=""){
				if(preneur!="" || nbPoint!="" || beEtRe!=""){
					if(preneur!="")go.menu.document.getElementById("alerte").innerHTML+="Il ne doit pas y avoir de preneur<br/>";
					if(nbPoint!="")go.menu.document.getElementById("alerte").innerHTML+="Il ne doit pas y avoir de nombre de points<br/>";
					if(beEtRe!="")go.menu.document.getElementById("alerte").innerHTML+="Il ne doit pas y avoir de belote et rebelote<br/>";
				}
				else calcul();
			}
			else if(preneur=="" || nbPoint==""){
				// si pas de preneur
				if(preneur=="")go.menu.document.getElementById("alerte").innerHTML+="Il n'y a pas de preneur<br/>";
				// si pas de point
				if(nbPoint=="")go.menu.document.getElementById("alerte").innerHTML+="Il n'y a pas de nombre de point<br/>";
			}
		}
		else calcul();
	}
	else{
		if(preneur=="" && nbPoint=="" && beEtRe=="" && donne=="" && annoncePour=="" && carreV=="" && carre9=="" && carreA=="" && cent=="" && cinquante=="" && tierce=="")go.menu.document.getElementById("alerte").innerHTML+="Il n'y a rien de sÃ©lectionnÃ©<br/>";
		else if(donne!="" || preneur=="" || nbPoint=="" || annoncePour!=""){
			// si fausse donne
			if(donne!=""){
				if(preneur!="" || nbPoint!="" || beEtRe!="" || annoncePour!=""){
					if(preneur!="")go.menu.document.getElementById("alerte").innerHTML+="Il ne doit pas y avoir de preneur<br/>";
					if(nbPoint!="")go.menu.document.getElementById("alerte").innerHTML+="Il ne doit pas y avoir de nombre de points<br/>";
					if(beEtRe!="")go.menu.document.getElementById("alerte").innerHTML+="Il ne doit pas y avoir de belote et rebelote<br/>";
					if(annoncePour!="")go.menu.document.getElementById("alerte").innerHTML+="Il ne doit pas y avoir d'annonce<br/>";
				}
				else calcul();
			}
			else if(annoncePour!=""){
				if(preneur=="" || nbPoint==""){
					// si pas de preneur
					if(preneur=="")go.menu.document.getElementById("alerte").innerHTML+="Il n'y a pas de preneur<br/>";
					// si pas de point
					if(nbPoint=="")go.menu.document.getElementById("alerte").innerHTML+="Il n'y a pas de nombre de point<br/>";
				}
				else if(carreV=="" && carre9=="" && carreA=="" && cent=="" && cinquante=="" && tierce=="")go.menu.document.getElementById("alerte").innerHTML+="Il n'y a pas d'annonce sÃ©lectionnÃ©<br/>";
				else if(carreV!="" || carre9!="" || carreA!="" || cent!="" || cinquante!="" || tierce!=""){
					// dÃ©finition du nombre de carte pour chaque annonce
					if(carreV!="")nbCarreV=carreV*4;
					else nbCarreV=0;
					if(carre9!="")nbCarre9=carre9*4;
					else nbCarre9=0;
					if(carreA!="")nbCarreA=carreA*4;
					else nbCarreA=0;
					if(cent!="")nbCent=cent*5;
					else nbCent=0;
					if(cinquante!="")nbCinquante=cinquante*4;
					else nbCinquante=0;
					if(tierce!="")nbTierce=tierce*3;
					else nbTierce=0;
					// calcul du nombre de carte annoncÃ©
					nbCarte=nbCarreV+nbCarre9+nbCarreA+nbCent+nbCinquante+nbTierce;
					// si + de 16 carte = erreur
					if(nbCarte>16)go.menu.document.getElementById("alerte").innerHTML+="Il y a trop d'annonces possibles<br/>";
					else calcul();
				}
				
			}
			else if(preneur=="" || nbPoint==""){
				// si pas de preneur
				if(preneur=="")go.menu.document.getElementById("alerte").innerHTML+="Il n'y a pas de preneur<br/>";
				// si pas de point
				if(nbPoint=="")go.menu.document.getElementById("alerte").innerHTML+="Il n'y a pas de nombre de point<br/>";
			}
		}
		else calcul();
	}
}

histo=new Array;
histoPrint=new Array;
tabScore1=new Array(0,0);
tabScore2=new Array(0,0);
tabLitige=new Array;
var litigePlus;
var victoire;

function calcul(){ //calcul les points

	a=go.menu.document.getElementById("point").value;
	nbPoint=parseInt(a); //récupére le nombre de point effectué
	if(nbPoint>81)contrat="OK"; // si les points sont supérieur à 81 le contrat est rempli
	else if(nbPoint<81)contrat="KO"; // si les points sont inférieur à 81 le contrat n'est pas rempli
	else if(nbPoint=81)contrat="LITIGE"; // sinon il y a litige
	
	score1=tabScore1.slice(-1);
	score2=tabScore2.slice(-1);

	// Calcul des points
	
	if(go.menu.document.getElementById("preneur").value!=""){ // si litige avant 80 points de plus pour le gagnant
		if(tabLitige!="")litigePlus=81;
		else litigePlus=0;
		tabLitige.pop();
	}
	
	for(i=1;i<=2;i++){
		if(i==1)y=parseInt(score1);
		else y=parseInt(score2);
		
		if(a==""){ // si fause donne
			if(go.menu.document.getElementById("donne").value=="J"+i)J1=y;
			else J1=y+162;
		}
		
		else if(a==0 || a==162){ // si capot
			if(go.menu.document.getElementById("preneur").value=="J"+i){ // si preneur
				if(a==0)J1=y;
				else if(a==162)J1=y+252+litigePlus;
			}
			else{ // si defense
				if(a==0)J1=y+252+litigePlus;
				else if(a==162)J1=y;
			}
		}
		
		else if(a==81){ // si litige
			if(go.menu.document.getElementById("preneur").value=="J"+i){ // si preneur
				J1=y+litigePlus;
				litige=81;
				tabLitige.push(litige);
			}
			else{ // si defense
				J1=y+81;
			}
		}
		
		else{ // point normal
			if(go.menu.document.getElementById("preneur").value=="J"+i){ // si preneur
				if(contrat=="OK")J1=y+nbPoint+litigePlus;
				else if(contrat=="KO")J1=y;
			}
			else{ // si defense
				if(contrat=="OK")J1=y+(162-nbPoint);
				else if(contrat=="KO")J1=y+162+litigePlus;
			}
		}
		y=J1;
		
		// si belote et re
		if(go.menu.document.getElementById("beEtRe").value=="J"+i)J1=y+20;
		y=J1;
		
		// si annonces
		if(annonce=="ok"){
			gain=0;
			if(go.menu.document.getElementById("annoncePour").value=="J"+i){
				if(go.menu.document.getElementById("carreV").value!=""){ // carre valet
					facteur=parseInt(go.menu.document.getElementById("carreV").value);
					gain=200*facteur;
				}
				if(go.menu.document.getElementById("carre9").value!=""){ // carre 9
					facteur=parseInt(go.menu.document.getElementById("carre9").value);
					gain+=150*facteur;
				}
				if(go.menu.document.getElementById("carreA").value!=""){ // carre as dame roi et 10
					facteur=parseInt(go.menu.document.getElementById("carreA").value);
					gain+=100*facteur;
				}
				if(go.menu.document.getElementById("cent").value!=""){ // cent
					facteur=parseInt(go.menu.document.getElementById("cent").value);
					gain+=100*facteur;
				}
				if(go.menu.document.getElementById("cinquante").value!=""){ // cinquante
					facteur=parseInt(go.menu.document.getElementById("cinquante").value);
					gain+=50*facteur;
				}
				if(go.menu.document.getElementById("tierce").value!=""){ // tierce
					facteur=parseInt(go.menu.document.getElementById("tierce").value);
					gain+=20*facteur;
				}
				J1=y+gain;
			}
		}
		y=J1;
		
		if(i==1)tabScore1.push(y);
		else if(i==2)tabScore2.push(y);
	}
	
	
	// affichage du détail
	detail="";
	if(go.menu.document.getElementById("preneur").value!=""){
		preneur=go.menu.document.getElementById("preneur").options[go.menu.document.getElementById("preneur").selectedIndex].text;
		detail+="Preneur : "+preneur+", ";
	}
	if(a!="")detail+="Nbre de points : "+a+", ";
	if(litigePlus==81)detail+="81 points du litige prÃ©cÃ©dent en +, ";
	if(go.menu.document.getElementById("beEtRe").value!=""){
		beEtRe=go.menu.document.getElementById("beEtRe").options[go.menu.document.getElementById("beEtRe").selectedIndex].text;
		detail+="Belote et re : "+beEtRe+", ";
	}
	if(annonce=="ok"){
		if(go.menu.document.getElementById("annoncePour").value!=""){
			annoncePour=go.menu.document.getElementById("annoncePour").options[go.menu.document.getElementById("annoncePour").selectedIndex].text;
			detail+="Annonce pour : "+annoncePour+", ";
		}
		if(go.menu.document.getElementById("carreV").value!=""){
			carreV=go.menu.document.getElementById("carreV").options[go.menu.document.getElementById("carreV").selectedIndex].text;
			detail+="CarrÃ© de valet : "+carreV+", ";
		}
		if(go.menu.document.getElementById("carre9").value!=""){
			carre9=go.menu.document.getElementById("carre9").options[go.menu.document.getElementById("carre9").selectedIndex].text;
			detail+="CarrÃ© de 9 : "+carre9+", ";
		}
		if(go.menu.document.getElementById("carreA").value!=""){
			carreA=go.menu.document.getElementById("carreA").options[go.menu.document.getElementById("carreA").selectedIndex].text;
			detail+="CarrÃ© d'as, 10, roi ou dame : "+carreA+", ";
		}
		if(go.menu.document.getElementById("cent").value!=""){
			cent=go.menu.document.getElementById("cent").options[go.menu.document.getElementById("cent").selectedIndex].text;
			detail+="Cent : "+cent+", ";
		}
		if(go.menu.document.getElementById("cinquante").value!=""){
			cinquante=go.menu.document.getElementById("cinquante").options[go.menu.document.getElementById("cinquante").selectedIndex].text;
			detail+="Cinquante : "+cinquante+", ";
		}
		if(go.menu.document.getElementById("tierce").value!=""){
			tierce=go.menu.document.getElementById("tierce").options[go.menu.document.getElementById("tierce").selectedIndex].text;
			detail+="Tierce : "+tierce+", ";
		}
	}
	if(go.menu.document.getElementById("donne").value!=""){
		donne=go.menu.document.getElementById("donne").options[go.menu.document.getElementById("donne").selectedIndex].text;
		detail+="Fausse donne : "+donne+".";
	}
	
	
	// affichage d'une ligne de score
	affichage="<table valign='top' width='730' cellspacing='0' cellpadding='0'>";
	affichage+="<tr>";
	affichage+="<td align='center' class='copyright bordure1 bordure2'>"+detail+"</td>";
	affichage+="<td align='center' width='240' class='score bordure1'>"+tabScore1.slice(-1)+"</td>";
	affichage+="<td align='center' width='240' class='score bordure1'>"+tabScore2.slice(-1)+"</td>";
	affichage+="</tr>";
	affichage+="</table>";
	histo.push(affichage);
	go.score.document.getElementById("score").innerHTML=histo.join("");
	
	// RAJOUTER UNE ALERTE QUAND VICTOIRE
	if(tabScore1.slice(-1)>=1000 || tabScore2.slice(-1)>=1000){
		victoire="ok";
		if(tabScore1.slice(-1)>=1000 && tabScore2.slice(-1)>=1000){
			if(tabScore1.slice(-1)>tabScore2.slice(-1)){
				affichage="<table valign='top' width='730' cellspacing='0' cellpadding='0'>";
				affichage+="<tr>";
				affichage+="<td colspan='3' align='center' class='convert bordure1 bordure2'>"+equipe1+" a gagnÃ© la partie !</td>";
				affichage+="</tr>";
				affichage+="</table>";
				histo.push(affichage);
				go.score.document.getElementById("score").innerHTML=histo.join("");
			}
			else if(tabScore1.slice(-1)<tabScore2.slice(-1)){
				affichage="<table valign='top' width='730' cellspacing='0' cellpadding='0'>";
				affichage+="<tr>";
				affichage+="<td colspan='3' align='center' class='convert bordure1 bordure2'>"+equipe2+" a gagnÃ© la partie !</td>";
				affichage+="</tr>";
				affichage+="</table>";
				histo.push(affichage);
				go.score.document.getElementById("score").innerHTML=histo.join("");
			}
			else if(tabScore1.slice(-1)==tabScore2.slice(-1));
		}
		else{
			if(tabScore1.slice(-1)>=1000){
				affichage="<table valign='top' width='730' cellspacing='0' cellpadding='0'>";
				affichage+="<tr>";
				affichage+="<td colspan='3' align='center' class='convert bordure1 bordure2'>"+equipe1+" a gagnÃ© la partie !</td>";
				affichage+="</tr>";
				affichage+="</table>";
				histo.push(affichage);
				go.score.document.getElementById("score").innerHTML=histo.join("");
				
			}
			if(tabScore2.slice(-1)>=1000){
				affichage="<table valign='top' width='730' cellspacing='0' cellpadding='0'>";
				affichage+="<tr>";
				affichage+="<td colspan='3' align='center' class='convert bordure1 bordure2'>"+equipe2+" a gagnÃ© la partie !</td>";
				affichage+="</tr>";
				affichage+="</table>";
				histo.push(affichage);
				go.score.document.getElementById("score").innerHTML=histo.join("");
			}
		}
	}

	// affichage d'une ligne de score pour impression
	printAffichage="<table valign='top' width='730' cellspacing='0' cellpadding='0'>";
	printAffichage+="<tr align='center'>";
	printAffichage+="<td align='center' width='240' class='scorePrint bordurePrint1 bordurePrint2'>"+tabScore1.slice(-1)+"</td>";
	printAffichage+="<td align='center' width='240' class='scorePrint bordurePrint1'>"+tabScore2.slice(-1)+"</td>";
	printAffichage+="</tr>";
	printAffichage+="</table>";
	histoPrint.push(printAffichage);
	go.haut.document.getElementById("printAffich").innerHTML=histoPrint.join("");
	
	if(tabScore1.slice(-1)>=1000 || tabScore2.slice(-1)>=1000){
		victoire="ok";
		if(tabScore1.slice(-1)>=1000 && tabScore2.slice(-1)>=1000){
			if(tabScore1.slice(-1)>tabScore2.slice(-1)){
				printAffichage="<table valign='top' width='730' cellspacing='0' cellpadding='0'>";
				printAffichage+="<tr>";
				printAffichage+="<td colspan='2' align='center' class='scorePrint bordurePrint1 bordurePrint2'>"+equipe1+" a gagnÃ© la partie !</td>";
				printAffichage+="</tr>";
				printAffichage+="</table>";
				histoPrint.push(printAffichage);
				go.haut.document.getElementById("printAffich").innerHTML=histoPrint.join("");
			}
			else if(tabScore1.slice(-1)<tabScore2.slice(-1)){
				printAffichage="<table valign='top' width='730' cellspacing='0' cellpadding='0'>";
				printAffichage+="<tr>";
				printAffichage+="<td colspan='2' align='center' class='scorePrint bordurePrint1 bordurePrint2'>"+equipe2+" a gagnÃ© la partie !</td>";
				printAffichage+="</tr>";
				printAffichage+="</table>";
				histoPrint.push(printAffichage);
				go.haut.document.getElementById("printAffich").innerHTML=histoPrint.join("");
			}
			else if(tabScore1.slice(-1)==tabScore2.slice(-1));
		}
		else{
			if(tabScore1.slice(-1)>=1000){
				printAffichage="<table valign='top' width='730' cellspacing='0' cellpadding='0'>";
				printAffichage+="<tr>";
				printAffichage+="<td colspan='2' align='center' class='scorePrint bordurePrint1 bordurePrint2'>"+equipe1+" a gagnÃ© la partie !</td>";
				printAffichage+="</tr>";
				printAffichage+="</table>";
				histoPrint.push(printAffichage);
				go.haut.document.getElementById("printAffich").innerHTML=histoPrint.join("");
				
			}
			if(tabScore2.slice(-1)>=1000){
				printAffichage="<table valign='top' width='730' cellspacing='0' cellpadding='0'>";
				printAffichage+="<tr>";
				printAffichage+="<td colspan='2' align='center' class='scorePrint bordurePrint1 bordurePrint2'>"+equipe2+" a gagnÃ© la partie !</td>";
				printAffichage+="</tr>";
				printAffichage+="</table>";
				histoPrint.push(printAffichage);
				go.haut.document.getElementById("printAffich").innerHTML=histoPrint.join("");
			}
		}
	}
	
	//remet à 0 les objet select apres le calcul
	go.menu.document.getElementById("preneur").selectedIndex=0;
	go.menu.document.getElementById("point").selectedIndex=0;
	go.menu.document.getElementById("beEtRe").selectedIndex=0;
	go.menu.document.getElementById("donne").selectedIndex=0;
	if(annonce=="ok"){
		go.menu.document.getElementById("annoncePour").selectedIndex=0;
		go.menu.document.getElementById("carreV").selectedIndex=0;
		go.menu.document.getElementById("carre9").selectedIndex=0;
		go.menu.document.getElementById("carreA").selectedIndex=0;
		go.menu.document.getElementById("cent").selectedIndex=0;
		go.menu.document.getElementById("cinquante").selectedIndex=0;
		go.menu.document.getElementById("tierce").selectedIndex=0;
	}
}


function corriger(){
	if(histo[0]==undefined);
	else if(victoire=="ok"){
		histo.pop();
		histo.pop();
		histoPrint.pop();
		histoPrint.pop();
		tabScore1.pop();
		tabScore2.pop();
		victoire="ko";
		go.score.document.getElementById("score").innerHTML=histo.join("");
		go.haut.document.getElementById("printAffich").innerHTML=histoPrint.join("");
	}
	else{
		histo.pop();
		histoPrint.pop();
		tabScore1.pop();
		tabScore2.pop();
		go.score.document.getElementById("score").innerHTML=histo.join("");
		go.haut.document.getElementById("printAffich").innerHTML=histoPrint.join("");
		
		scoreLitige1=tabScore1.slice(-1)-tabScore1.slice(-2,-1);
		//alert(scoreLitige1);
		scoreLitige2=tabScore2.slice(-1)-tabScore2.slice(-2,-1);
		//alert(scoreLitige2);
		if(tabLitige==81)tabLitige.pop();
		else if(scoreLitige1==81 || scoreLitige2==81){
			litige=81;
			tabLitige.push(litige);
		}
	}
}

function ouvrirPrint(url,nom){
	return window.open(url,nom);
}

function initPrint(){
	go.bas.go1.document.getElementById("print").innerHTML=go.haut.document.getElementById("affichPrint").innerHTML;
}