
var IconsCount=0;
var answered=0;
var UserChoice="star";
var Score=0;
var MaxChapter=9;
var CurrentChapter=0;
var ChapterArray= new Array();
var AnswerArray= new Array("0","0", "2", "2", "3", "0", "0", "1", "1", "2");
var LezandaArray= new Array("Ο Βασιλιάς και η Βασίλισσα, 1952-3","Γυναίκα, 1957-8", " ", "Καθιστή φιγούρα, 1961", "Καθιστή γυναίκα, 1956-7", "Βράχια στο Τέξας, ΗΠΑ", "Βράχος", "Ξαπλωμένη φιγούρα, 1951", "Ξαπλωμένη φιγούρα", "Ο Διόνυσος, 447-433 π.Χ.");

function Init(){
for (var k=0; k<=9; k++) ChapterArray[k]=k;
//ChapterArray.sort(RandomRearange);
CurrentChapter=0;
for (var k=0; k<=3; k++) {document.getElementById("Photo"+k).className="imagenotselected";}
ShowChapter(ChapterArray[CurrentChapter]);
}

function RandomRearange(){
return (Math.round(Math.random())-0.5); 
}

function ShowChapter(ChapterNum){
var CN=CurrentChapter+1;
var del=0;
document.getElementById("RightWrongDIV").innerHTML="<h3><strong>Επιλέξτε ένα από τα τέσσερα</strong></h3>";
document.getElementById("labeling").innerHTML=LezandaArray[CurrentChapter];
for (var k=0; k<=3; k++) {document.getElementById("Photo"+k).className="imagenotselected";}
document.getElementById("QuestionPhoto").src='images/s'+ChapterNum+'.jpg';
var CardsArray=Array("0", "1", "2", "3");
CardsArray.sort(RandomRearange);
for (var k=0; k<=3; k++) {
document.getElementById("Photo"+k).src='images/p'+ChapterNum+'-'+CardsArray[k]+'.jpg';
}
RightAnswerId=AnswerArray[ChapterNum];
del=CardsArray.indexOf(RightAnswerId);
RightAnswerId=del;
document.getElementById("counter").innerHTML="<strong>"+CN+" / 10</strong>";
//document.getElementById("lezanda").innerHTML=LezandaArray[CurrentChapter];
}

function CardClicked(obj){
if (answered!=1) {
for (var k=0; k<=3; k++){
document.getElementById("Photo"+k).className="imagenotselected";
}
obj.className="imageselected";
if (obj.id=='Photo'+RightAnswerId) Win();
else Loose();
answered=1;
}
}

function Win(){
if (answered!=1) {
Score=Score+1;
document.getElementById("RightWrongDIV").innerHTML="<h3><strong>Μπράβο! Σωστά.<br/>Συνέχισε &raquo;</strong></h3>";
}
}

function Loose(){
if (answered!=1) {
document.getElementById("RightWrongDIV").innerHTML="<h3><strong>Ουπς! Λάθος. <br/>Συνέχισε &raquo;</strong></h3>";
}
}

function Next(){
CurrentChapter=CurrentChapter+1;
if (CurrentChapter>MaxChapter) {
document.getElementById("RightWrongDIV").innerHTML="<strong>Τέλος! Σωστές ήταν "+Score+" απαντήσεις'</strong>";
answered=1;
}
if (CurrentChapter<=MaxChapter){
ShowChapter(ChapterArray[CurrentChapter]);
answered=0;
}
}

function CloseHelp(){
var continue_button = document.getElementById("help");
continue_button.style.visibility = 'hidden'; 
}

function ShowHelp(){
var continue_button = document.getElementById("help");
continue_button.style.visibility = 'visible'; 
}


