var IE=(document.all)?1:0
var texte0=(IE)?'<HTML><HEAD><TITLE>&nbsp;</TITLE></HEAD>':'<HTML>';
//...............................
function alerte(msg,coul_font) {
var texte=texte0+'<BODY bgColor="#EFEFEF" STYLE="font-size:10pt;font-family:Arial;" onBlur="self.close()"><b><font face="Arial,Helvetica">'
+'<font color='+coul_font+'><P><BR><DIV ALIGN="center">'+msg+'</DIV></font></font></b></BODY></HTML>'
fen=window.open('','','width=280,height=100,left=100,top=100');
fen.document.open("text/html");fen.document.write(texte);fen.document.close();fen.focus()
}
f="Le courant ne passe pas dans cette branche.<hr>"
dej="Vous avez deja cliqué sur ce fil.<hr>"
dso="Le courant passe bien dans cette branche, mais cliquez sur les fils dans l'ordre o&ugrave; le courant les traverse.<hr>"
ra="Vous n'avez pas cliqué sur un fil. R&eacute;essayez.<hr>"
//.............................
function alerte2(msg,coul_font) {
var texte=texte0+'<BODY bgColor="#EFEFEF" STYLE="font-size:10pt;font-family:Arial;" onBlur="self.close()"><b><font face="Arial,Helvetica">'
+'<font color='+coul_font+'><P><BR><DIV ALIGN="center">'+msg+'</DIV></font></font></b></BODY></HTML>'
fen=window.open('','','width=280,height=130,left=100,top=100');
fen.document.open("text/html");fen.document.write(texte);fen.document.close();fen.focus()
}
//................................
function alerte1(msg) {
var texte=texte0+'<BODY bgColor="#EFEFEF" STYLE="font-size:10pt;font-family:Arial;" onBlur="self.close()"><b><font face="Arial,Helvetica">'
+'<font color="#cc0000"><P><BR><DIV ALIGN="center">'+msg+'</DIV></font></font></b></BODY></HTML>'
fen=window.open('','','width=280,height=100,left=100,top=100');
fen.document.open("text/html");fen.document.write(texte);fen.document.close();fen.focus()
}
function message(h,no) {
if (navigator.appName.charAt(0)=="M") {h+=20}
var dim="width=650,height="+h+",left=100,top=100,scrollbars=yes"
var texte=texte0+'<BODY BGCOLOR="efefef" STYLE="font-size:10pt;font-family:Arial;" onBlur="self.close()">'+mess[no]+'</DIV></BODY></HTML>'
fen=window.open("","",dim);fen.document.open("text/html");fen.document.write(texte);fen.document.close();fen.focus();
}
//..................................
var haut=new Array()
haut[1]=350;haut[2]=350;haut[3]=330;haut[5]=500;haut[6]=370;haut[7]=250;haut[8]=500;haut[9]=250;haut[10]=500;
haut[11]=300;haut[12]=350;
haut[21]=200;haut[22]=210;haut[23]=360;haut[24]=300;haut[25]=520;haut[26]=100;haut[27]=400;haut[28]=430;haut[29]=450;haut[30]=480;
haut[31]=300;haut[32]=260;haut[33]=210;haut[34]=210;
//.............................
function const_rep(q,msg,coul_font,coul) {
if (q==12) {top.d.location='q13.htm';return false}
var typ= 1;
if (q==5) {typ=2}
var h=eval(haut[q])
var larg=650;
if (navigator.appName.charAt(0)=="M") {h=h*1.15;larg+=20};
var dim="width="+larg+",height="+h+",left=20,top=20,scrollbars=yes"
if (typ==1) {
var texte=texte0+'<BODY BACKGROUND="../fond.gif" STYLE="font-size:10pt;font-family:Arial;" onBlur="self.close()" >'
+'<FONT FACE="Arial"><B><FONT COLOR='+coul_font+'><DIV ALIGN="center">'
+msg+'</FONT></B></FONT><HR NOSHADE><BR>'+rep[q]+'</DIV></BODY></HTML>' }
if (typ==2) {
var texte=texte0+'<BODY BACKGROUND="../fond.gif" STYLE="font-size:10pt;font-family:Arial;" onBlur="self.focus()" >'
+'<FONT FACE="Arial"><B><FONT COLOR='+coul_font+'><DIV ALIGN="center">'
+msg+'</FONT></B></FONT><HR NOSHADE><BR>'+rep[q]+'</DIV></BODY></HTML>' }
fen=window.open("","",dim);fen.document.open("text/html");fen.document.write(texte);fen.document.close();fen.focus();
}
/* *****************************  tests  *******************************/
function test(q){
var ncase=0 //nb cases cochées
var nb_cases=document.quest.C.length
for (i=0; i<nb_cases; i++) {
if(document.quest.C[i].checked) {ncase++}}
if (ncase==0) {alerte('&nbsp;&nbsp;Vous devez cliquer au moins une case<HR NOSHADE>','#cc0000');return false}
if (ncase==nb_cases) {alerte('&nbsp;&nbsp;Ne cochez pas toutes les cases!<HR NOSHADE>','#cc0000');return false}
for (i=0; i<nb_cases; i++) {
if(document.quest.C[i].checked) {ncase++}}
var tot_j =0
for (i=0; i<nb_cases; i++) {if (document.quest.C[i].value=="j") {tot_j++}}
var rep_f =0;
var oubli=0;
for (i=0; i<nb_cases; i++) {if ((document.quest.C[i].value=="j")&&(!document.quest.C[i].checked)) {oubli++}}
for (i=0; i<nb_cases; i++) {if ((document.quest.C[i].value!="j")&&(document.quest.C[i].checked)) {rep_f++}}
//var oubli=(tot_j>=2)?(tot_j-rep_j):0
var err=rep_f+oubli
top.t++;	
switch (nb_rep) {
case 1:    //deuxième essai
if (err==0) {top.j++;nb_rep=2;solution();const_rep(q,' Votre réponse est juste.','#408080','#efefef')}  
if (err>=1) {nb_rep=2;solution();const_rep(q,' Votre réponse est fausse.','#cc0000','#efefef')}
break;
case 0:    //premier essai
if ((oubli==0)||(oubli>0&&tot_j==1)) {
if (rep_f==0) {top.j++;nb_rep=2;solution();const_rep(q,' Votre réponse est juste.','#408080','#E3FFE3')}  
if (rep_f>=1) {nb_rep++;alerte('&nbsp;&nbsp;Votre réponse comporte une (ou plusieurs) erreur(s) !<HR NOSHADE>Proposez une autre réponse.','#cc0000');return false}
}
if (oubli>=1&&tot_j>=2) {
if (rep_f==0) {nb_rep++;alerte('&nbsp;&nbsp;Il y a une (ou plusieurs) autre(s) case(s) à cocher ! <HR NOSHADE>Proposez une autre réponse.','#cc0000')}  
if (rep_f>=1) {nb_rep++;alerte('&nbsp;&nbsp;Il y a une (ou plusieurs) autre(s) case(s) à cocher.<BR>Une (ou plusieurs) case(s) ne devrai(en)t pas être cochée(s).','#cc0000');return false}
}
break;
}
}
function correction() {
var nb_cases=document.quest.C.length
for (i=0; i<nb_cases; i++) {
if ((document.quest.C[i].checked)&&(document.quest.C[i].value!="j")) document.quest.C[i].checked=false }
}
function solution() {
var nb_cases=document.quest.C.length
for (i=0; i<nb_cases; i++) {
if (document.quest.C[i].value!="j") document.quest.C[i].checked=false;
if (document.quest.C[i].value=="j") document.quest.C[i].checked=true }
}
function suite(fich) {
if (nb_rep<=1) {alerte('&nbsp;&nbsp;Cette étude n\'est pas terminée!<HR NOSHADE>','#cc0000')}
else { eval('top.d.location="'+fich+'.htm"')}
}

