//Creado con Ardora - www.webardora.net
//bajo licencia Attribution-NonCommercial-NoDerivatives 4.0 International (CC BY-NC-ND 4.0)
//para otros usos contacte con el autor
function initAct(){
if ((tiTime) && (tiButtonTime)){paintButtonTime();}for (i = 0; i < answers.length ; i++) {var nameDiv = "inputTxt" + (i + 1).toString();document.getElementById(nameDiv).value="";}if (tiAval){parent.iniciaActividade()}paintLinePoint();
}
function randomSort() {}
function paintPoints(){var canvas = document.getElementById("ardoraActCanvasAnim"); canvas.style["visibility"]="visible"; canvas.width = canvas.width; var contexto = canvas.getContext("2d");
for (i = 0; i < doneA.length; i++) {contexto.beginPath();contexto.fillStyle=colorButton;contexto.arc(parseInt(panelWords(coorx[i])), parseInt(panelWords(coory[i])), 4, 0, 2 * Math.PI, false);contexto.fill();
contexto.strokeStyle=colorSele;contexto.lineWidth = 2;var x=parseInt(posX[i]);var y=parseInt(posY[i]);contexto.moveTo(parseInt(panelWords(coorx[i])), parseInt(panelWords(coory[i])));contexto.lineTo(x,y);contexto.stroke();
 if (doneA[i] == "0") {} else {var idT=String(i+1);$("#txt"+idT).html("<p>"+answers[i]+"</p>");$("#txt"+idT).addClass("txtCellOk");$("#txt"+idT).css("background","radial-gradient(ellipse at center center,"+colorBack+","+colorSele+")");}
}}
function paintLinePoint(){paintPoints();}
function isCorrect(cell) {for (i=0;i<answers.length;i++) {var correct=true;if (doneA[i]=="0") {var nameTxt="txt"+(i+1).toString();var nameDiv="inputTxt"+(i+1).toString();var respu=$.trim(document.getElementById(nameDiv).value);var solu=$.trim(answers[i]).replace("&#39;","'");
if (tiUD) {if (respu.toUpperCase()!=solu.toUpperCase()) {correct=false;}} else {if (respu!=solu){correct=false;}}
if (correct) {timeAct=timeAct+timeBon;score=score+scoreInc;successes++;doneA[i] ="%&%%";} else {score=score-scoreDec;}}}paintPoints();
if (successes==answers.length) {showMessage("Ok");} else {attempts++;if (tiAttempts) {if (attempts>attemptsMax) {showMessage("Attempts");} else {showMessage("Error");}} else {showMessage("Error");}}
}
function goTime(){showMessage("Time");}
function showSol(oldTypeGame){for (i = 0; i < doneA.length; i++) {doneA[i] = answers[i];}paintPoints(); }
function paintBack(){}
function panelWords(input) {var output = ""; var chr1, chr2, chr3 = ""; var enc1, enc2, enc3, enc4 = "";var i = 0;
var btest = /[^A-Za-z0-9\+\/\=]/g; if (btest.exec(input)) { alert("Invalid characters");} input = input.replace(/[^A-Za-z0-9\+\/\=]/g, "");
do { enc1 = wordsStr.indexOf(input.charAt(i++)); enc2 = wordsStr.indexOf(input.charAt(i++)); enc3 = wordsStr.indexOf(input.charAt(i++)); enc4 = wordsStr.indexOf(input.charAt(i++)); chr1 = (enc1 << 2) | (enc2 >> 4); chr2 = ((enc2 & 15) << 4) | (enc3 >> 2);chr3 = ((enc3 & 3) << 6) | enc4;
output = output + String.fromCharCode(chr1);if (enc3 != 64) {output = output + String.fromCharCode(chr2);} if (enc4 != 64) {output = output + String.fromCharCode(chr3);}
chr1 = chr2 = chr3 = ""; enc1 = enc2 = enc3 = enc4 = "";} while (i < input.length);return unescape(output);}
Array.prototype.in_array=function(){ for(var j in this){ if(this[j]==arguments[0]){return true;}}return false;}
