var memRep;
var AvatarSelectLet="A";
var AvatarScoreObjectif=0;
var AvatarScoreTotal=0;
var ScoreA=0;
var ScoreB=0;
var ScoreC=0;
var ScoreD=0;
function selectTeam(Let){
AvatarSelectLet=Let;
LUDI.nextPage();
}
var counterTimeInt=21;
var GlobalCounterTimeObj;
function resetCounter(){
clearTimeout(GlobalCounterTimeObj);
counterTimeInt=21;
}
function appliCounter(){
if(counterTimeInt>0){
counterTimeInt=counterTimeInt - 1;
LUDI.setValueTxt('countertime',counterTimeInt);
GlobalCounterTimeObj=setTimeout(function(){ appliCounter(); },1100);
}else{
resetCounter();
processWinScore(0);
}
}
function applickTeam(){
$('.score' + AvatarSelectLet).css('background','#5858FA');
$('.score' + AvatarSelectLet).css('color','white');
$('.score' + AvatarSelectLet).css('border-radius','6px');
LUDI.setValueTxt('score' + AvatarSelectLet,AvatarScoreTotal);
if(AvatarSelectLet!='A'){
LUDI.setValueTxt('scoreA',ScoreA);
}
if(AvatarSelectLet!='B'){
LUDI.setValueTxt('scoreB',ScoreB);
}
if(AvatarSelectLet!='C'){
LUDI.setValueTxt('scoreC',ScoreC);
}
if(AvatarSelectLet!='D'){
LUDI.setValueTxt('scoreD',ScoreD);
}
if(AvatarSelectLet=='A'){
LUDI.locationXY('evidenceArrow',220,618);
}
if(AvatarSelectLet=='B'){
LUDI.locationXY('evidenceArrow',354,618);
}
if(AvatarSelectLet=='C'){
LUDI.locationXY('evidenceArrow',495,618);
}
if(AvatarSelectLet=='D'){
LUDI.locationXY('evidenceArrow',638,618);
}
}
function processOtherScore(){
setTimeout(function(){
processOtherScoreAll();
},1000);
}
function processOtherScoreAll(){
var redCol='#F2D7D5';
var greenCol='#A2D9CE';
var orangeCol='#F39C12';
// #F1948A  red
// #D7BDE2 green
setTimeout(function(){
if(AvatarSelectLet!='A'){
var gfc=getFakeCont();
if(gfc==2){
$('.scoreA').css('background',redCol);
}else{
if(ScoreA==6){
LUDI.sound("data/magical3.mp3");
}
ScoreA=ScoreA + 1;
$('.scoreA').css('background',greenCol);
}
if(ScoreA>6){
$('.scoreA').css('background',orangeCol);
}
$('.scoreA').css('color','white');
LUDI.setValueTxt('scoreA',ScoreA);
}
},1300);
setTimeout(function(){
if(AvatarSelectLet!='B'){
var gfc=getFakeCont();
if(gfc==2){
$('.scoreB').css('background',redCol);
}else{
if(ScoreB==6){
LUDI.sound("data/magical3.mp3");
}
ScoreB=ScoreB + 1;
$('.scoreB').css('background',greenCol);
if(ScoreB>6){
$('.scoreB').css('background',orangeCol);
}
}
$('.scoreB').css('color','white');
LUDI.setValueTxt('scoreB',ScoreB);
}
},800);
setTimeout(function(){
if(AvatarSelectLet!='C'){
var gfc=getFakeCont();
if(gfc==2){
$('.scoreC').css('background',redCol);
}else{
if(ScoreC==6){
LUDI.sound("data/magical3.mp3");
}
ScoreC=ScoreC + 1;
$('.scoreC').css('background',greenCol);
if(ScoreC>6){
$('.scoreC').css('background',orangeCol);
}
}
$('.scoreC').css('color','white');
LUDI.setValueTxt('scoreC',ScoreC);
}
},1100);
setTimeout(function(){
if(AvatarSelectLet!='D'){
var gfc=getFakeCont();
if(gfc==2){
$('.scoreD').css('background',redCol);
}else{
if(ScoreD==6){
LUDI.sound("data/magical3.mp3");
}
ScoreD=ScoreD + 1;
$('.scoreD').css('background',greenCol);
if(ScoreD>6){
$('.scoreD').css('background',orangeCol);
}
}
$('.scoreD').css('color','white');
LUDI.setValueTxt('scoreD',ScoreD);
}
},400);
}
function getFakeCont(){
var qcmRandomize=Math.floor(Math.random() * 4);
if(qcmRandomize==3){ qcmRandomize=2;}
return qcmRandomize;
}
function processWinScore(sco){
if(counterTimeInt<1){
sco=0;
}
resetCounter();
if(sco>0){
AvatarScoreObjectif=AvatarScoreTotal + sco;
setTimeout(function(){
if(AvatarScoreTotal<AvatarScoreObjectif){
AvatarScoreTotal++;
$('.score' + AvatarSelectLet).css('background','#2ECC71');
$('.score' + AvatarSelectLet).css('color','white');
LUDI.setValueTxt('score' + AvatarSelectLet,AvatarScoreTotal);
if(AvatarScoreTotal>6){
AvatarScoreTotal=7;
LUDI.sound("data/magical3.mp3");
$('.score' + AvatarSelectLet).css('background','#F39C12');
setTimeout(function(){
$('.score' + AvatarSelectLet).css('background','#D35400');
setTimeout(function(){
$('.score' + AvatarSelectLet).css('background','#F39C12');
setTimeout(function(){
$('.score' + AvatarSelectLet).css('background','#D35400');
setTimeout(function(){
$('.score' + AvatarSelectLet).css('background','#F39C12');
setTimeout(function(){
$('.score' + AvatarSelectLet).css('background','#D35400');
setTimeout(function(){
LUDI.goPage(16);
},2000);
},200);
},200);
},200);
},200);
},200);
}else{
LUDI.sound("data/moneybip.mp3");
setTimeout(function(){
LUDI.nextPage();
},1500);
}
}
},20);
}else{
$('.score' + AvatarSelectLet).css('background','#F1948A');
$('.score' + AvatarSelectLet).css('color','white');
LUDI.sound("data/faux.mp3");
setTimeout(function(){
LUDI.nextPage();
},2000);
}
}
function cflet(string){
return string.charAt(0).toUpperCase() + string.slice(1);
}
function audioElementBack(){
var audioElement=document.createElement('audio');
audioElement.setAttribute('src',"data/mtv11.mp3");
audioElement.setAttribute("id", "mydivbacksound");
audioElement.play();
}


LUDIguid='ehoibpa12566420196';