function ExecuteScript(strId)
{
  switch (strId)
  {
      case "5muqh3I1Pm9":
        Script1();
        break;
      case "5ptUPc2naMA":
        Script2();
        break;
      case "6DuNp54Z863":
        Script3();
        break;
      case "5nm68ULvGdr":
        Script4();
        break;
      case "5kCeQCy1mWI":
        Script5();
        break;
      case "5jZGZ22zyWP":
        Script6();
        break;
      case "6HBAOtkxhzd":
        Script7();
        break;
      case "6eIbsH15XPM":
        Script8();
        break;
      case "5j22CXEHf6a":
        Script9();
        break;
      case "6PsyxsbBFc7":
        Script10();
        break;
      case "6634gqOjo3Y":
        Script11();
        break;
      case "6WaSwUcoypF":
        Script12();
        break;
      case "5qmJuT7ZdlN":
        Script13();
        break;
      case "6dZeZ5rMBMS":
        Script14();
        break;
      case "5jnNGoVNgFW":
        Script15();
        break;
      case "63ARSFv4aJ9":
        Script16();
        break;
      case "6Tq4heNzesL":
        Script17();
        break;
      case "64VOL5Tpdm2":
        Script18();
        break;
      case "6Cf6LllBbr1":
        Script19();
        break;
      case "6Cj5otDora9":
        Script20();
        break;
      case "5WlGGINnG1t":
        Script21();
        break;
      case "6lnHtVIGtRS":
        Script22();
        break;
      case "6JpNyYT9N09":
        Script23();
        break;
      case "6IRQq44DCcL":
        Script24();
        break;
      case "6oN3yFHjZXE":
        Script25();
        break;
      case "6AgAmM3f7Ad":
        Script26();
        break;
      case "5aFkIDjnSjm":
        Script27();
        break;
      case "5hWZpPASPYv":
        Script28();
        break;
      case "6NxHMHWWNEh":
        Script29();
        break;
      case "5i6vP90WlJV":
        Script30();
        break;
      case "6o7oR8zM8Ts":
        Script31();
        break;
      case "6KuHobOhZr3":
        Script32();
        break;
      case "6famne8OCT2":
        Script33();
        break;
      case "5k12i3k8obv":
        Script34();
        break;
      case "5rU1ikPFXJH":
        Script35();
        break;
      case "68jz685PBzt":
        Script36();
        break;
      case "5WgR6R0aDCt":
        Script37();
        break;
      case "6TXJVEJpPC7":
        Script38();
        break;
      case "5c4KwD3U1g2":
        Script39();
        break;
      case "6aSUdEM0MSX":
        Script40();
        break;
      case "5sb7pOxXrIS":
        Script41();
        break;
      case "6Ug9CzSwgfD":
        Script42();
        break;
      case "5ilkniKhyxI":
        Script43();
        break;
      case "5oK0o8zsltj":
        Script44();
        break;
      case "6721rs1bUH3":
        Script45();
        break;
      case "6OyXEYUqL26":
        Script46();
        break;
      case "5WupDo7Xesb":
        Script47();
        break;
      case "5m0hun43JxN":
        Script48();
        break;
      case "6bFKij1wL9B":
        Script49();
        break;
      case "6ERH0iPD9lG":
        Script50();
        break;
      case "6PDwRAulgMg":
        Script51();
        break;
      case "5cyk2fjDK2v":
        Script52();
        break;
      case "6axLK7tt3A1":
        Script53();
        break;
      case "6imUnaRN1iE":
        Script54();
        break;
      case "5Vd4dELoQfK":
        Script55();
        break;
      case "5b10JzottVt":
        Script56();
        break;
      case "6QV6syMl5K0":
        Script57();
        break;
      case "5ZhMOFYqNzF":
        Script58();
        break;
      case "6Tqzut4ti6U":
        Script59();
        break;
      case "67PbvoQJLNb":
        Script60();
        break;
      case "5rlY4zo5M2J":
        Script61();
        break;
      case "6iSoyvhgXXG":
        Script62();
        break;
      case "5WBdHRnqXPT":
        Script63();
        break;
      case "6pzSuCZHiTo":
        Script64();
        break;
      case "5uwnWWle4jV":
        Script65();
        break;
      case "5e4WypFzrgy":
        Script66();
        break;
      case "6FA0rLAGxjM":
        Script67();
        break;
      case "5ibG4zJ0oBq":
        Script68();
        break;
      case "6GDFyxCVseq":
        Script69();
        break;
      case "6oxiJ2gvQHM":
        Script70();
        break;
      case "6g4dg0tTCpA":
        Script71();
        break;
      case "5ZI66LkW6r8":
        Script72();
        break;
      case "62QphNKTKye":
        Script73();
        break;
      case "68Kz3y9VgkN":
        Script74();
        break;
      case "6QwuYYhLasP":
        Script75();
        break;
      case "6PbTzdkBisn":
        Script76();
        break;
      case "5csANTFKcfl":
        Script77();
        break;
      case "6U211Pbye9v":
        Script78();
        break;
      case "6XI1hez7VUS":
        Script79();
        break;
      case "690CyPj3thE":
        Script80();
        break;
      case "65rD0nW6Hh3":
        Script81();
        break;
      case "6aF9wa1LgPp":
        Script82();
        break;
      case "5wMHpxmsb6P":
        Script83();
        break;
      case "6nR59ifV3mw":
        Script84();
        break;
      case "6mQQuyx2HyI":
        Script85();
        break;
      case "6N6MziM8NRW":
        Script86();
        break;
      case "6XP5nHJTraC":
        Script87();
        break;
      case "5m0fuNnouwy":
        Script88();
        break;
      case "6F38LM3gWqt":
        Script89();
        break;
      case "6o3w6Zlfk9g":
        Script90();
        break;
      case "6Qg3Di6YP7O":
        Script91();
        break;
      case "6edVzSubygY":
        Script92();
        break;
      case "5jd6Fr6DpmN":
        Script93();
        break;
      case "6HcI1GKOgCx":
        Script94();
        break;
      case "6p1d9D88CnJ":
        Script95();
        break;
      case "5gjfHCNlfzK":
        Script96();
        break;
      case "6LM2u4VviMf":
        Script97();
        break;
      case "5X2k9uMprsb":
        Script98();
        break;
      case "5hKfRf1MAdQ":
        Script99();
        break;
      case "5aNeFQghcTp":
        Script100();
        break;
      case "68H5c8YNwsB":
        Script101();
        break;
      case "6fMbo2wsToc":
        Script102();
        break;
      case "5pJY3mDuxoV":
        Script103();
        break;
      case "6fCl7C3GuJN":
        Script104();
        break;
      case "6XlWDNzu4ER":
        Script105();
        break;
      case "5ianKmnTU5G":
        Script106();
        break;
      case "5iBXetcSlSv":
        Script107();
        break;
      case "63MyMGmiCfu":
        Script108();
        break;
      case "6qmVMFEft3W":
        Script109();
        break;
      case "6HIP7aYXwcN":
        Script110();
        break;
      case "6LPruBnpiHL":
        Script111();
        break;
      case "6W7HVRdK8lh":
        Script112();
        break;
      case "6nkryC8OGzH":
        Script113();
        break;
      case "5opKy7JQcQb":
        Script114();
        break;
      case "6e9pGXz0V2a":
        Script115();
        break;
      case "6dWXndkUpHl":
        Script116();
        break;
      case "6VAcywnjQ4g":
        Script117();
        break;
      case "5sCLGFsARIK":
        Script118();
        break;
      case "6c6uB2OYd7l":
        Script119();
        break;
      case "5WIRVz4iD9M":
        Script120();
        break;
      case "6Rn9wmZfnSF":
        Script121();
        break;
      case "6Q69xv8mlZX":
        Script122();
        break;
      case "5mRgNuENmW7":
        Script123();
        break;
      case "6mPmtxgaBIr":
        Script124();
        break;
      case "6HxYR8tJeth":
        Script125();
        break;
      case "6ShqcDhzQrD":
        Script126();
        break;
      case "6qogngKz9X6":
        Script127();
        break;
      case "6UH1MuuWiEy":
        Script128();
        break;
      case "6YMaYaWbbEO":
        Script129();
        break;
      case "5bqnxtp5rHA":
        Script130();
        break;
      case "63tnkbwcgLe":
        Script131();
        break;
      case "68eVfKfixQw":
        Script132();
        break;
      case "6FGVJl6ezRI":
        Script133();
        break;
      case "6UkKFTpdEY6":
        Script134();
        break;
      case "5ejY329M96N":
        Script135();
        break;
      case "5X3Zf4mhfKj":
        Script136();
        break;
      case "5gLNeBbs7kl":
        Script137();
        break;
      case "6Co4Cgp3PSm":
        Script138();
        break;
      case "6bRoVONgx9L":
        Script139();
        break;
      case "6RQ2HI8KAZu":
        Script140();
        break;
      case "6CgREGUNx3k":
        Script141();
        break;
      case "6m1V5AiwJTd":
        Script142();
        break;
      case "5t26Ccw89i2":
        Script143();
        break;
      case "6fe6IqzKKLY":
        Script144();
        break;
      case "6PUHV61fJKm":
        Script145();
        break;
      case "6oZ5y3K4UYg":
        Script146();
        break;
      case "6aBkJNjnVrS":
        Script147();
        break;
      case "5tngdnJxg3y":
        Script148();
        break;
      case "67FSpyelbbY":
        Script149();
        break;
      case "678jjiSr3z0":
        Script150();
        break;
      case "5vMDDw0A69w":
        Script151();
        break;
      case "6iGRweG8y3k":
        Script152();
        break;
      case "6XEpIYCslOz":
        Script153();
        break;
      case "5iBdgXuFgox":
        Script154();
        break;
      case "6DZIe8IuwTe":
        Script155();
        break;
      case "5kgWsWofRyu":
        Script156();
        break;
      case "5rqXwzT5May":
        Script157();
        break;
      case "5kXud7vnthB":
        Script158();
        break;
      case "6lHU3JOOY7x":
        Script159();
        break;
      case "614RseaRX79":
        Script160();
        break;
      case "5gb59afAAeJ":
        Script161();
        break;
      case "5kXSNnyI2rL":
        Script162();
        break;
      case "5vSqtZMMHDh":
        Script163();
        break;
      case "6AcgCjhzI1g":
        Script164();
        break;
      case "6NRMG8uGymf":
        Script165();
        break;
      case "6ZQdUPXV8Ow":
        Script166();
        break;
      case "6lIrgfrdZXr":
        Script167();
        break;
      case "5tlrdIAJAc9":
        Script168();
        break;
      case "62cYHel5b7k":
        Script169();
        break;
      case "6QrYY0ktX1Y":
        Script170();
        break;
      case "6BIlY3zivzA":
        Script171();
        break;
      case "6FVo8oviDpN":
        Script172();
        break;
      case "6QOmsqMXTcW":
        Script173();
        break;
      case "5aEtfU5vr6Y":
        Script174();
        break;
      case "6Q1mLU8dldn":
        Script175();
        break;
      case "6aKq19N6ATJ":
        Script176();
        break;
      case "5yfNpNsvt7z":
        Script177();
        break;
      case "5pEanEkezDz":
        Script178();
        break;
      case "5w7mnNUxFPr":
        Script179();
        break;
      case "5VNmrnMOE9O":
        Script180();
        break;
      case "6id836qSYV0":
        Script181();
        break;
      case "6k1gZqcXfc3":
        Script182();
        break;
      case "6J57BFAMtGP":
        Script183();
        break;
      case "6juNtgzTLlB":
        Script184();
        break;
      case "5pFH9hBK6X5":
        Script185();
        break;
      case "6YkPdYQ8eiz":
        Script186();
        break;
      case "6OSh8UmqtgH":
        Script187();
        break;
      case "5izvPRSQWGL":
        Script188();
        break;
      case "6jml6WR3FcQ":
        Script189();
        break;
      case "6GxTIoBq8Zd":
        Script190();
        break;
      case "61y9aNjLjqw":
        Script191();
        break;
      case "6k8ChuCP8mu":
        Script192();
        break;
      case "6cmGk4qXef5":
        Script193();
        break;
      case "5cYlsiI1kyd":
        Script194();
        break;
      case "5ulD51sfyYH":
        Script195();
        break;
      case "5yqfcmD47BA":
        Script196();
        break;
      case "5mt4wOqduZH":
        Script197();
        break;
      case "6SdUqDFOoRD":
        Script198();
        break;
      case "6a6A4L2Cjko":
        Script199();
        break;
      case "6hoTcQrFOJd":
        Script200();
        break;
      case "6nG20L9vN70":
        Script201();
        break;
      case "6lisYjA6fbg":
        Script202();
        break;
      case "68hopoUCusI":
        Script203();
        break;
      case "6PDWMEXFL44":
        Script204();
        break;
      case "6VXUj7UjiiR":
        Script205();
        break;
      case "6hSAXBEO3V2":
        Script206();
        break;
      case "670aX2dCUb4":
        Script207();
        break;
      case "5tdboWP77fs":
        Script208();
        break;
      case "6PaJ4mlenBb":
        Script209();
        break;
      case "5lMhjRr6mov":
        Script210();
        break;
      case "5aHEYoKIQQX":
        Script211();
        break;
      case "6nP7nEXUSlu":
        Script212();
        break;
      case "6rWpGqZyKnG":
        Script213();
        break;
      case "5hUip2JEVa7":
        Script214();
        break;
      case "5f62ZAMnoVR":
        Script215();
        break;
      case "5YQcrMrZkZu":
        Script216();
        break;
      case "5fKZ3JEkuNX":
        Script217();
        break;
      case "6oacWFybEam":
        Script218();
        break;
      case "6ajTpuUGjvf":
        Script219();
        break;
      case "6eYTLN2oBhx":
        Script220();
        break;
      case "61n6g7nGOtT":
        Script221();
        break;
      case "5obQprgftfw":
        Script222();
        break;
      case "6VqSxLHBR3z":
        Script223();
        break;
      case "5aBVPdfyDg5":
        Script224();
        break;
      case "6nRHD258ydH":
        Script225();
        break;
      case "5zbVlX3ROjg":
        Script226();
        break;
      case "6U31B3oxnAG":
        Script227();
        break;
      case "5kuUswznbkt":
        Script228();
        break;
      case "5tPtpEQm3iI":
        Script229();
        break;
      case "6OBT88hcWDA":
        Script230();
        break;
      case "5d3XB1Uoejc":
        Script231();
        break;
      case "6jZXKArwskE":
        Script232();
        break;
      case "5ov4d6blsHj":
        Script233();
        break;
      case "6D7hWE180tW":
        Script234();
        break;
      case "5uRRWTWO3HL":
        Script235();
        break;
      case "6cQp2NP86Eq":
        Script236();
        break;
      case "6JAM1tmfX6F":
        Script237();
        break;
      case "5tZP9xA84Zp":
        Script238();
        break;
      case "6Z7shr3KYpk":
        Script239();
        break;
      case "5a3BV732fCQ":
        Script240();
        break;
      case "5ZoeYrmkV9h":
        Script241();
        break;
      case "6jZaiAGzRpe":
        Script242();
        break;
      case "6LlqSyCoBRg":
        Script243();
        break;
      case "5XNT199ZLAn":
        Script244();
        break;
      case "5wYHMEesMYd":
        Script245();
        break;
      case "5i0lhWLiZLb":
        Script246();
        break;
      case "6IdY1CBMv3Q":
        Script247();
        break;
      case "5wkXbGTvGPY":
        Script248();
        break;
      case "5nfPpGH2Rnr":
        Script249();
        break;
      case "64p3KoDgI7r":
        Script250();
        break;
      case "6d2ZKndVNsU":
        Script251();
        break;
      case "6VbGDAI4C2L":
        Script252();
        break;
      case "5vOHbbuPZNc":
        Script253();
        break;
      case "61NKWeGUzOA":
        Script254();
        break;
      case "6emjxsMInvH":
        Script255();
        break;
      case "5VBEguGL3cx":
        Script256();
        break;
      case "6XL4Dxrk8mz":
        Script257();
        break;
      case "5ld0o1Gj2SD":
        Script258();
        break;
      case "6VswxyKrsVl":
        Script259();
        break;
      case "6o8eeMlHH26":
        Script260();
        break;
  }
}

function Script1()
{
  console.log("GSAP version: "+TweenLite.version);

var player = GetPlayer();

var url=player.GetVar("url");

window.card_array = [];
var who_array = [];
var what_doing_array = [];
var what_array = [];
var where_array = [];
var when_array = [];
var describe_array = [];

var ans_array_numbers, correct_card, card_ans;

var ans_array_str = player.GetVar("AnsArray");
var ans_step_str = player.GetVar("AnsStepArray");


// Convert string values to arrays
var ans_array = ans_array_str.split(",");
var ans_step = ans_step_str.split(",");

if (ans_array_str !== "") {
    // Loop through ans_array
for (var i = 0; i < ans_array.length-1; i++) {

    // Select the corresponding element using data-acc-text attribute
    var card_ans = document.querySelectorAll("[data-acc-text='x" + ans_step[i] + "']");

        var width = card_ans[0].offsetWidth - 8;
        var height = card_ans[0].offsetHeight - 8;
        
        // Apply TweenLite for the current values
        TweenLite.set(card_ans[0], {
            css: {
                backgroundImage: 'url(' + url + 'images/5/' + ans_array[i] + '.png)',
                width: width + 'px',
                height: height + 'px',
                backgroundRepeat: 'no-repeat',
                backgroundSize: '80% 80%',
                backgroundColor: '#fff',
                backgroundPosition: 'center center'
            }
        });

}
}


var item_array=[
["Bird","Who",4,5,6,12],
["Cat","Who",4,5,6],
["Chicken","Who",4,5],
["Crocodile","Who",9,11],
["Dinosaur","Who",2,5,11],
["Dog","Who",5,6,9,10],
["Donkey","Who",11,5],
["Daddy","Who",3,4,17],
["Fish","Who",6,9,12],
["Flamingo","Who",1,5,9,10],
["Girl","Who",3,5,6,17],
["Hippo","Who",2,5,11],
["King","Who",3,4,17],
["Lion","Who",5,9,10,11],
["Mummy","Who",3,4,17],
["Queen","Who",3,4,17],
["Sheep","Who",11,5,9,10],
["Snail","Who",4,6,12],
["Snake","Who",4,6,12],
["Spider","Who",4,6,12],
["Tiger","Who",5,11],
["Eating","WhatDoing",13,14],
["Watching","WhatDoing",13,14],
["Cleaning","WhatDoing",13,14],
["Cooking","WhatDoing",13,14],
["Playing","WhatDoing",13,14],
["Drinking","WhatDoing",13,14],
["Driving","WhatDoing",13,14],
["Giving","WhatDoing",13,14],
["Singing","WhatDoing",13,14],
["Writing","WhatDoing",13,14],
["Flying","WhatDoing",13,14],
["Apple","Eating",1,13,16],
["Banana","Eating",1,13,16],
["Broccoli","Eating",7,16],
["Chips","Eating",1,7,13,16],
["Orange","Eating",1,13,16],
["Pear","Eating",1,13,16],
["Peas","Eating",7,16],
["Pizza","Eating",1,7,13,16],
["Sandwich","Eating",1,7,13,16],
["Boat","Watching",2,5,11,13],
["Train","Watching",2,5,11],
["Lorry","Watching",2,5,11],
["Car","Watching",2,5,11,13],
["Bed","Cleaning",1,11,13],
["Bike","Cleaning",1,5,11],
["Car","Cleaning",1,5,11,13],
["Toys","Cleaning",5,13,14],
["Lorry","Cleaning",1,5,11],
["Sofa","Cleaning",1,11,13],
["Chips","Cooking",1,7,16],
["Peas","Cooking",7,16],
["Pizza","Cooking",1,7,16],
["Broccoli","Cooking",7,16],
["Car","Playing",1,5,11,13],
["Teddy","Playing",1,13,17],
["Lorry","Playing",1,5,11],
["Aeroplane","Playing",1,5,11],
["Boat","Playing",1,5,11,13],
["Computer","Playing",5,13],
["Orange Juice","Drinking",8,13,16],
["Apple Juice","Drinking",8,13,16],
["Fruit Juice","Drinking",8,13,16],
["Pear Juice","Drinking",8,13,16],
["Milk","Drinking",7,8,13,16],
["Water","Drinking",7,8,16],
["Aeroplane","Flying",1,5,11,15],
["Boat","Sailing",2,5,11,13],
["Car","Driving",1,5,11,13],
["Lorry","Driving",1,5,11],
["Train","Driving",2,5,11],
["Present","Giving",11,13,14,15,16],
["Song","Singing",5,6,13,14,15,17],
["Letter","Writing",2,4,17],
["Song","Writing",5,6,13,14,15,17],
["Homework","Writing",2,11],
["Beach","Where",2,7,14],
["Garden","Where",7,8,9,10,14],
["Home","Where",7,14,15],
["School","Where",2,15],
["Police Station","Where",2,15],
["Fire Station","Where",2,15],
["Airport","Where",2,15],
["Park","Where",2,7,8,9,10,14,15],
["Forest","Where",2,7,8,9,10,14],
["Jungle","Where",2,7,9,10,14],
["Grass","Where",3,9,10],
["Hospital","Where",2,15],
["Farm","Where",2,9,15],
["Zoo","Where",7,14,15],
["Flower Beds","Where",7,8,9,10,14],
["Seaside","Where",7,8,9,10,14],
["Garage","Where",7,8,9,10,15],
["Public Garden","Where",7,8,9,10,14],
["Bus Station","Where",7,8,9,10,15],
["Service Station","Where",7,8,9,10,15],


["Dinner Time","When",6,14,16],
["Bed Time","When",6,14],
["Autumn Time","When",8,9],
["Winter Time","When",8,9],
["Summer Time","When",7,10],
["Christmas Time","When",8,13,14,17],
["Day Time","When",7,8,9,10],
["Night Time","When",7,8,9,10],
["Birthday","When",13,14,15,17],
["Breakfast","When",14,16],
["Mother’s Day","When",13,14,17],
["Sunrise","When",7,17],
["Dawn","When",8,9],
["Snack Time","When",13,14,16],
["Party Time","When",13,14,16],
["Monday","When",5,6,7,8,13,15],
["Tuesday","When",5,6,7,8,13,15],
["Wednesday","When",5,6,7,8,13,15],
["Thursday","When",5,6,7,8,13,15],
["Friday","When",5,6,7,8,13,15],
["Sunday","When",5,6,7,8,13,15]
];



who_array[1]='Bird';
who_array[2]='Cat';
who_array[3]='Chicken';
who_array[4]='Cow';
who_array[5]='Crocodile';
who_array[6]='Dinosaur';
who_array[7]='Dog';
who_array[8]='Donkey';
who_array[9]='Fish';
who_array[10]='Flamingo';
who_array[11]='Hippo';
who_array[12]='Lion';
who_array[13]='Sheep';
who_array[14]='Snail';
who_array[15]='Snake';
who_array[16]='Spider';
who_array[17]='Tiger';
who_array[18]='Daddy';
who_array[19]='Mummy';
who_array[20]='Toddler';
who_array[21]='Baby';
who_array[22]='Girl';
who_array[23]='Queen';
who_array[24]='King';


what_doing_array[1]='Looking';
what_doing_array[2]='Washing';
what_doing_array[3]='Drinking';
what_doing_array[4]='Sleeping';
what_doing_array[5]='Jumping';
what_doing_array[6]='Eating';
what_doing_array[7]='Listening';
what_doing_array[8]='Writing';
what_doing_array[9]='Swimming';
what_doing_array[10]='Flying';
what_doing_array[11]='Kicking';
what_doing_array[12]='Watching';
what_doing_array[13]='Surfing';
what_doing_array[14]='Cleaning';
what_doing_array[15]='Cooking';
what_doing_array[16]='Thinking';
what_doing_array[17]='Walking';
what_doing_array[18]='Singing';
what_doing_array[19]='Climbing';
what_doing_array[20]='Crawling';
what_doing_array[21]='Diving';
what_doing_array[22]='Giving';
what_doing_array[23]='Crying';
what_doing_array[24]='Sailing';
what_doing_array[25]='Playing';
what_doing_array[26]='Driving';



what_array[1]='Pizza';
what_array[2]='Boat';
what_array[3]='Chips';
what_array[4]='Peas';
what_array[5]='Banana';
what_array[6]='Orange';
what_array[7]='Orange Juice';
what_array[8]='Apple';
what_array[9]='Pear';
what_array[10]='Toys';
what_array[11]='Broccoli';
what_array[12]='Burger';
what_array[13]='Computer';
what_array[14]='Aeroplane';
what_array[15]='Train';
what_array[16]='Car';
what_array[17]='Television';
what_array[18]='Lorry';
what_array[19]='Bike';
what_array[20]='Sandwich';
what_array[21]='Toilet';
what_array[22]='Bed';
what_array[23]='Sofa';
what_array[24]='Oven';
what_array[25]='Teddy';
what_array[26]='Apple Juice';
what_array[27]='Fruit Juice';
what_array[28]='Pear Juice';
what_array[29]='Milk';
what_array[30]='Water';
what_array[31]='Present';
what_array[32]='Song';
what_array[33]='Letter';
what_array[34]='Homework';


where_array[1]='Beach';
where_array[2]='Garden';
where_array[3]='Home';
where_array[4]='School';
where_array[5]='Police Station';
where_array[6]='Fire Station';
where_array[7]='Airport';
where_array[8]='Road';
where_array[9]='Park';
where_array[10]='Forest';
where_array[11]='Jungle';
where_array[12]='Sky';
where_array[13]='Grass';
where_array[14]='Hospital';
where_array[15]='Farm';
where_array[16]='Petrol Station';
where_array[17]='Zoo';
where_array[19]='Bus Station';
where_array[24]='Flower Beds';
where_array[25]='Seaside';
where_array[26]='Garage';
where_array[27]='Public Garden';
where_array[28]='Service Station';



when_array[1]='Dinner Time';
when_array[2]='Bed Time';
when_array[3]='Autumn Time';
when_array[4]='Winter Time';
when_array[5]='Summer Time';
when_array[6]='Christmas Time';
when_array[7]='Day Time';
when_array[8]='Night Time';
when_array[9]='Morning';
when_array[10]='Birthday';
when_array[11]='Holiday';
when_array[12]='Breakfast';
when_array[13]='Spring';
when_array[14]='Mother’s Day';
when_array[15]='Sunrise';
when_array[16]='Dawn';
when_array[17]='Snack Time';
when_array[18]='Party Time';
when_array[19]='Monday';
when_array[20]='Tuesday';
when_array[21]='Wednesday';
when_array[22]='Thursday';
when_array[23]='Friday';
when_array[24]='Sunday';



describe_array[1]='Large';
describe_array[2]='Huge';
describe_array[3]='Tall';
describe_array[4]='Small';
describe_array[5]='Loud';
describe_array[6]='Quiet';
describe_array[7]='Hot ';
describe_array[8]='Cold';
describe_array[9]='Wet';
describe_array[10]='Dry';
describe_array[11]='Heavy';
describe_array[12]='Light';
describe_array[13]='Best';
describe_array[14]='Brilliant';
describe_array[15]='Noisy';
describe_array[16]='Tasty';
describe_array[17]='Happy';


// Shuffle function to randomly shuffle array elements
function shuffle(array) {
  for (let i = array.length - 1; i > 0; i--) {
    const j = Math.floor(Math.random() * (i + 1));
    [array[i], array[j]] = [array[j], array[i]];
  }
  return array;
}

// Sort routine to keep first two columns intact and randomly sort the rest
item_array.forEach(row => {
  let remainingColumns = row.slice(2); // Extract remaining columns
  remainingColumns = shuffle(remainingColumns); // Randomly shuffle remaining columns
  row.splice(2, remainingColumns.length, ...remainingColumns); // Replace shuffled columns
});

// Group rows by the second column and sort them randomly within each group
const groupedRows = {};
item_array.forEach(row => {
  const group = row[1];
  if (!groupedRows[group]) {
    groupedRows[group] = [];
  }
  groupedRows[group].push(row);
});

Object.values(groupedRows).forEach(group => {
  shuffle(group);
});

// Flatten the grouped and shuffled rows back into item_array
item_array = Object.values(groupedRows).reduce((acc, val) => acc.concat(val), []);

// Update the item_array to contain the filtered results
const groupsProcessed = [];
let whoCount = 0;
item_array = item_array.filter((row, index) => {
  const group = row[1];
  if (group === 'Who') {
    if (whoCount < 2) {
      whoCount++;
      return true;
    } else {
      return false;
    }
  } else {
    if (!groupsProcessed.includes(group)) {
      groupsProcessed.push(group);
      return true;
    } else {
      return false;
    }
  }
});

// New filter based on item_array[2][0]
const categoryToMatch = item_array[2][0];
item_array = item_array.filter((row, index) => {
  if (index >= 2 && index <= 14) {
    return row.includes(categoryToMatch);
  } else {
    return true;
  }
});

// Update item_array to contain only three columns
item_array.forEach(row => {
  row.splice(3); // Remove columns starting from index 3
});


console.log(item_array);


card_array[1] = item_array[0][2];
card_array[2] = who_array.indexOf(item_array[0][0]);

card_array[3] = item_array[1][2];
card_array[4] = who_array.indexOf(item_array[1][0]);

card_array[5] = what_doing_array.indexOf(item_array[2][0]);

card_array[6] = item_array[3][2];
card_array[7] = what_array.indexOf(item_array[3][0]);

card_array[8] = item_array[4][2];
card_array[9] = where_array.indexOf(item_array[4][0]);

card_array[10] = item_array[5][2];
card_array[11] = when_array.indexOf(item_array[5][0]);


for (i = 12; i <= 16; i++) {
do {
rand = Math.floor(Math.random() * 17) + 1;
}
while (card_array.includes(rand));

card_array[i] = rand;

}



window.imageUrls = [
  url + 'images/6/' +card_array[1]+ '.png',
  url + 'images/1/' +card_array[2]+ '.png',

  url + 'images/6/' +card_array[3]+ '.png',
  url + 'images/1/' +card_array[4]+ '.png',

  url + 'images/2/' +card_array[5]+ '.png',
  
  url + 'images/6/' +card_array[6]+ '.png',
  url + 'images/3/' +card_array[7]+ '.png',
  
  url + 'images/6/' +card_array[8]+ '.png',
  url + 'images/4/' +card_array[9]+ '.png',
   
  url + 'images/6/' +card_array[10]+ '.png',
  url + 'images/5/' +card_array[11]+ '.png',
  
  url + 'images/1/' + card_array[12] + '.png',
  url + 'images/2/' + card_array[13] + '.png',
  url + 'images/6/' + card_array[14] + '.png',
  
  url + 'images/3/' + card_array[15] + '.png',
  url + 'images/6/' + card_array[16] + '.png',
    
];


// pre-load

for (var i = 0; i < imageUrls.length; i++) {
  var image = new Image();
  image.src = window.imageUrls[i];
}


// set cards

player.SetVar("Card1", describe_array[card_array[1]]);
player.SetVar("Card2", who_array[card_array[2]]);
player.SetVar("Card3", describe_array[card_array[3]]);
player.SetVar("Card4", who_array[card_array[4]]);
player.SetVar("Card5", what_doing_array[card_array[5]]);
player.SetVar("Card6", describe_array[card_array[6]]);
player.SetVar("Card7", what_array[card_array[7]]);
player.SetVar("Card8", describe_array[card_array[8]]);
player.SetVar("Card9", where_array[card_array[9]]);
player.SetVar("Card10", describe_array[card_array[10]]);
player.SetVar("Card11", when_array[card_array[11]]);
player.SetVar("Card12", who_array[card_array[12]]) 
player.SetVar("Card13", what_doing_array[card_array[13]])
player.SetVar("Card14", describe_array[card_array[14]]);
player.SetVar("Card15", what_array[card_array[15]]);
player.SetVar("Card16", describe_array[card_array[16]]);


}

function Script2()
{
  var player = GetPlayer();

var url = player.GetVar("url");

// update answer array

var ans=player.GetVar("AnsArray");

ans = ans + window.card_array[11] + ",";

player.SetVar("AnsArray",ans);


var ans_step = player.GetVar("AnsStepArray");

ans_step = ans_step + player.GetVar("Counter") + ",";

player.SetVar("AnsStepArray",ans_step);



// who answers

var CardImage2 = document.querySelectorAll("[data-acc-text='CardImage2']")
TweenLite.set(CardImage2[0], {css: {backgroundImage: `url(${window.imageUrls[1]})`, backgroundSize: '100%, 100%'}});

// what doing answer

var CardImage5 = document.querySelectorAll("[data-acc-text='CardImage5']")
TweenLite.set(CardImage5[0], {css: {backgroundImage: `url(${window.imageUrls[4]})`, backgroundSize: '100%, 100%'}});

// what answer

var CardImage7 = document.querySelectorAll("[data-acc-text='CardImage7']")
TweenLite.set(CardImage7[0], {css: {backgroundImage: `url(${window.imageUrls[6]})`, backgroundSize: '100%, 100%'}});

// where answers

var CardImage9 = document.querySelectorAll("[data-acc-text='CardImage9']")
TweenLite.set(CardImage9[0], {css: {backgroundImage: `url(${window.imageUrls[8]})`, backgroundSize: '100%, 100%'}});

// when answers

var CardImage11 = document.querySelectorAll("[data-acc-text='CardImage11']")
TweenLite.set(CardImage11[0], {css: {backgroundImage: `url(${window.imageUrls[10]})`, backgroundSize: '100%, 100%'}});


// describe answers

var CardImage1 = document.querySelectorAll("[data-acc-text='CardImage1']")
TweenLite.set(CardImage1[0], {css: {backgroundImage: `url(${window.imageUrls[0]})`, backgroundSize: '100%, 100%'}});

var CardImage6 = document.querySelectorAll("[data-acc-text='CardImage6']")
TweenLite.set(CardImage6[0], {css: {backgroundImage: `url(${window.imageUrls[5]})`, backgroundSize: '100%, 100%'}});

var CardImage8 = document.querySelectorAll("[data-acc-text='CardImage8']")
TweenLite.set(CardImage8[0], {css: {backgroundImage: `url(${window.imageUrls[7]})`, backgroundSize: '100%, 100%'}});

var CardImage10 = document.querySelectorAll("[data-acc-text='CardImage10']")
TweenLite.set(CardImage10[0], {css: {backgroundImage: `url(${window.imageUrls[9]})`, backgroundSize: '100%, 100%'}});


// incorrect answers

var CardImage12 = document.querySelectorAll("[data-acc-text='CardImage12']")
TweenLite.set(CardImage12[0], {css: {backgroundImage: `url(${window.imageUrls[11]})`, backgroundSize: '100%, 100%'}});

var CardImage13 = document.querySelectorAll("[data-acc-text='CardImage13']")
TweenLite.set(CardImage13[0], {css: {backgroundImage: `url(${window.imageUrls[12]})`, backgroundSize: '100%, 100%'}});

var CardImage14 = document.querySelectorAll("[data-acc-text='CardImage14']")
TweenLite.set(CardImage14[0], {css: {backgroundImage: `url(${window.imageUrls[13]})`, backgroundSize: '100%, 100%'}});



// audio

window.CardAudio1 = new Audio(url + 'audio/6/' +card_array[1]+'.mp3');
window.CardAudio2 = new Audio(url + 'audio/1/' +card_array[2]+'.mp3');
window.CardAudio5 = new Audio(url + 'audio/2/' +card_array[5]+'.mp3');
window.CardAudio6 = new Audio(url + 'audio/6/' +card_array[6]+'.mp3');
window.CardAudio7 = new Audio(url + 'audio/3/' +card_array[7]+'.mp3');
window.CardAudio8 = new Audio(url + 'audio/6/' +card_array[8]+'.mp3');
window.CardAudio9 = new Audio(url + 'audio/4/' +card_array[9]+'.mp3');
window.CardAudio10 = new Audio(url + 'audio/6/' +card_array[10]+'.mp3');
window.CardAudio11 = new Audio(url + 'audio/5/' +card_array[11]+'.mp3');

window.CardAudio12 = new Audio(url + 'audio/1/' +card_array[12]+'.mp3');
window.CardAudio13 = new Audio(url + 'audio/2/' +card_array[13]+'.mp3');
window.CardAudio14 = new Audio(url + 'audio/6/' +card_array[14]+'.mp3');


window.the = new Audio(url+'audio/0/the.mp3');
window.withthe = new Audio(url+'audio/0/withthe.mp3');
window.is = new Audio(url+'audio/0/is.mp3');
window.atthe = new Audio(url+'audio/0/atthe.mp3');
window.something = new Audio(url+'audio/0/something.mp3');
window.each = new Audio(url+'audio/0/each.mp3');


window.sequences = [
    url + 'audio/0/the.mp3', 
    url + 'audio/6/' + card_array[1] + '.mp3', 
    url + 'audio/1/' + card_array[2] + '.mp3', 
    url + 'audio/0/is.mp3', 
    url + 'audio/2/' + card_array[5] + '.mp3',
    (window.card_array[5] == '25') ? url + 'audio/0/withthe.mp3' : url + 'audio/0/the.mp3', 
    url + 'audio/6/' + card_array[6] + '.mp3', 
    url + 'audio/0/something.mp3',
    url + 'audio/0/atthe.mp3', 
    url + 'audio/6/' + card_array[8] + '.mp3', 
    url + 'audio/0/something.mp3',
    url + 'audio/0/each.mp3', 
    url + 'audio/6/' + card_array[10] + '.mp3', 
    url + 'audio/0/something.mp3'
    
    
];


var title = "The <b style='color: #7030A0;'>" + player.GetVar("Card1").toLowerCase() + "</b> <b style='color: #FF7E02;'>" + player.GetVar("Card2").toLowerCase() + "</b>" +
  " is <b style='color: #FFC004;'>" +  player.GetVar("Card5").toLowerCase()  + "</b>"

if (window.card_array[5] == '25')
title = title + " with the ";
else 
title = title + " the ";


title = title +"<b style='color: #7030A0;'>" + player.GetVar("Card6").toLowerCase() + "</b> <b style='color: #77933F;'>  ???? </b>" +
  " at the <b style='color: #7030A0;'>" + player.GetVar("Card8").toLowerCase() + "</b> <b style='color: #0471C0;'> ???? </b>" +
" each <b style='color: #7030A0;'>" + player.GetVar("Card10").toLowerCase() + "</b> <b style='color: #C25E0C;'> ???? </b>";


var titleComplete = document.querySelectorAll("[data-acc-text='title_complete']")[0];

// Function to dynamically adjust font size
function adjustFontSize() {
    var screenWidth = window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth;

    // Calculate the desired font size based on the screen width
    var fontSize = Math.max(16, screenWidth / 50); // You can adjust the ratio as needed

    // Apply the font size to the titleComplete element
    titleComplete.style.fontSize = fontSize + 'px';
}

// Initial adjustment when the page loads
adjustFontSize();

// Event listener for resizing
window.addEventListener('resize', adjustFontSize);

titleComplete.innerHTML = "<div style='text-align: center; color: #fff; font-family: \"Open Sans\", sans-serif;'>" + title + "</div>";

}

function Script3()
{
  function playAudio(src) {
  var audioElement = new Audio(src);
  audioElement.play();
  return audioElement
}

var player = GetPlayer();

player.SetVar("SpeakerSwitch",'1');

let index = 0

const audioElement = playAudio(sequences[index])
audioElement.addEventListener('ended', (e) => {
  index++
  if (index < sequences.length) {
    audioElement.src = sequences[index]
    audioElement.play();
  }
else
    player.SetVar("SpeakerSwitch",'0');

})
}

function Script4()
{
  CardAudio14.play();
}

function Script5()
{
  console.log("GSAP version: " + gsap.version);

CardAudio14.play();

var player = GetPlayer();

var drop_counter = 0;

var myElement, card, slide;

for (i = 5; i <= 14; i++) {
  card = "data-acc-text='CardImage" + (i) + "'";
  myElement = document.querySelector("[" + card + "]");

  slide = document.getElementById("slide");
  var elementRect = myElement.getBoundingClientRect();
  var elXPos = elementRect.left - slide.getBoundingClientRect().left;
  var elYPos = elementRect.top - slide.getBoundingClientRect().top;

  elXPos = Math.round((elXPos / slide.clientWidth) * 100);
  elYPos = Math.round((elYPos / slide.clientHeight) * 100);
  
  if (elXPos == 79 || elXPos == 40 || elXPos == 70)
  drop_counter = drop_counter + 1;
    
}

player.SetVar("DropCounter",drop_counter);

}

function Script6()
{
  CardAudio13.play();
}

function Script7()
{
  console.log("GSAP version: " + gsap.version);

CardAudio13.play();

var player = GetPlayer();

var drop_counter = 0;

var myElement, card, slide;

for (i = 5; i <= 14; i++) {
  card = "data-acc-text='CardImage" + (i) + "'";
  myElement = document.querySelector("[" + card + "]");

  slide = document.getElementById("slide");
  var elementRect = myElement.getBoundingClientRect();
  var elXPos = elementRect.left - slide.getBoundingClientRect().left;
  var elYPos = elementRect.top - slide.getBoundingClientRect().top;

  elXPos = Math.round((elXPos / slide.clientWidth) * 100);
  elYPos = Math.round((elYPos / slide.clientHeight) * 100);
  
  if (elXPos == 79 || elXPos == 40 || elXPos == 70)
  drop_counter = drop_counter + 1;
    
}

player.SetVar("DropCounter",drop_counter);

}

function Script8()
{
  CardAudio12.play();
}

function Script9()
{
  console.log("GSAP version: " + gsap.version);

CardAudio12.play();

var player = GetPlayer();

var drop_counter = 0;

var myElement, card, slide;

for (i = 5; i <= 14; i++) {
  card = "data-acc-text='CardImage" + (i) + "'";
  myElement = document.querySelector("[" + card + "]");

  slide = document.getElementById("slide");
  var elementRect = myElement.getBoundingClientRect();
  var elXPos = elementRect.left - slide.getBoundingClientRect().left;
  var elYPos = elementRect.top - slide.getBoundingClientRect().top;

  elXPos = Math.round((elXPos / slide.clientWidth) * 100);
  elYPos = Math.round((elYPos / slide.clientHeight) * 100);
  
  if (elXPos == 79 || elXPos == 40 || elXPos == 70)
  drop_counter = drop_counter + 1;
    
}

player.SetVar("DropCounter",drop_counter);

}

function Script10()
{
  CardAudio11.play();
}

function Script11()
{
  console.log("GSAP version: " + gsap.version);

CardAudio11.play();

var player = GetPlayer();

var drop_counter = 0;

var myElement, card, slide;

for (i = 5; i <= 14; i++) {
  card = "data-acc-text='CardImage" + (i) + "'";
  myElement = document.querySelector("[" + card + "]");

  slide = document.getElementById("slide");
  var elementRect = myElement.getBoundingClientRect();
  var elXPos = elementRect.left - slide.getBoundingClientRect().left;
  var elYPos = elementRect.top - slide.getBoundingClientRect().top;

  elXPos = Math.round((elXPos / slide.clientWidth) * 100);
  elYPos = Math.round((elYPos / slide.clientHeight) * 100);
  
  if (elXPos == 79 || elXPos == 40 || elXPos == 70)
  drop_counter = drop_counter + 1;
    
}

player.SetVar("DropCounter",drop_counter);

}

function Script12()
{
  CardAudio9.play();
}

function Script13()
{
  console.log("GSAP version: " + gsap.version);

CardAudio9.play();

var player = GetPlayer();

var drop_counter = 0;

var myElement, card, slide;

for (i = 5; i <= 14; i++) {
  card = "data-acc-text='CardImage" + (i) + "'";
  myElement = document.querySelector("[" + card + "]");

  slide = document.getElementById("slide");
  var elementRect = myElement.getBoundingClientRect();
  var elXPos = elementRect.left - slide.getBoundingClientRect().left;
  var elYPos = elementRect.top - slide.getBoundingClientRect().top;

  elXPos = Math.round((elXPos / slide.clientWidth) * 100);
  elYPos = Math.round((elYPos / slide.clientHeight) * 100);
  
  if (elXPos == 79 || elXPos == 40 || elXPos == 70)
  drop_counter = drop_counter + 1;
    
}

player.SetVar("DropCounter",drop_counter);

}

function Script14()
{
  CardAudio7.play();
}

function Script15()
{
  console.log("GSAP version: " + gsap.version);

CardAudio7.play();

var player = GetPlayer();

var drop_counter = 0;

var myElement, card, slide;

for (i = 5; i <= 14; i++) {
  card = "data-acc-text='CardImage" + (i) + "'";
  myElement = document.querySelector("[" + card + "]");

  slide = document.getElementById("slide");
  var elementRect = myElement.getBoundingClientRect();
  var elXPos = elementRect.left - slide.getBoundingClientRect().left;
  var elYPos = elementRect.top - slide.getBoundingClientRect().top;

  elXPos = Math.round((elXPos / slide.clientWidth) * 100);
  elYPos = Math.round((elYPos / slide.clientHeight) * 100);
  
  if (elXPos == 79 || elXPos == 40 || elXPos == 70)
  drop_counter = drop_counter + 1;
    
}


player.SetVar("DropCounter",drop_counter);

}

function Script16()
{
  CardAudio8.play();
}

function Script17()
{
  atthe.play();
}

function Script18()
{
  CardAudio10.play();
}

function Script19()
{
  each.play();
}

function Script20()
{
  
if (window.card_array[5] == '25')
withthe.play();
else 
the.play();
}

function Script21()
{
  is.play();
}

function Script22()
{
  CardAudio2.play();
}

function Script23()
{
  CardAudio1.play();
}

function Script24()
{
  the.play();
}

function Script25()
{
  var player = GetPlayer();

var drop_counter = 0;
player.SetVar("DropCounter",drop_counter);
}

function Script26()
{
  var player = GetPlayer();

console.log("GSAP version: "+TweenLite.version);

var player = GetPlayer();

var CardImageCorrect5 = document.querySelectorAll("[data-acc-text='CardImageCorrect5']")
TweenLite.set(CardImageCorrect5[0], {css: {backgroundImage: `url(${window.imageUrls[4]})`, backgroundSize: '100%, 100%'}});

var CardImageCorrect9 = document.querySelectorAll("[data-acc-text='CardImageCorrect9']")
TweenLite.set(CardImageCorrect9[0], {css: {backgroundImage: `url(${window.imageUrls[8]})`, backgroundSize: '100%, 100%'}});


var CardImageCorrect11 = document.querySelectorAll("[data-acc-text='CardImageCorrect11']")
TweenLite.set(CardImageCorrect11[0], {css: {backgroundImage: `url(${window.imageUrls[10]})`, backgroundSize: '100%, 100%'}});


var drop_counter = 0;
player.SetVar("DropCounter",drop_counter);
}

function Script27()
{
  var player = GetPlayer();

console.log("GSAP version: "+TweenLite.version);

var CardImageCorrect1 = document.querySelectorAll("[data-acc-text='CardImageCorrect1']")
TweenLite.set(CardImageCorrect1[0], {css: {backgroundImage: `url(${window.imageUrls[0]})`, backgroundSize: '100%, 100%'}});

var CardImageCorrect2 = document.querySelectorAll("[data-acc-text='CardImageCorrect2']")
TweenLite.set(CardImageCorrect2[0], {css: {backgroundImage: `url(${window.imageUrls[1]})`, backgroundSize: '100%, 100%'}});

var CardImageCorrect5 = document.querySelectorAll("[data-acc-text='CardImageCorrect5']")
TweenLite.set(CardImageCorrect5[0], {css: {backgroundImage: `url(${window.imageUrls[4]})`, backgroundSize: '100%, 100%'}});

var CardImageCorrect6 = document.querySelectorAll("[data-acc-text='CardImageCorrect6']")
TweenLite.set(CardImageCorrect6[0], {css: {backgroundImage: `url(${window.imageUrls[5]})`, backgroundSize: '100%, 100%'}});

var CardImageCorrect7 = document.querySelectorAll("[data-acc-text='CardImageCorrect7']")
TweenLite.set(CardImageCorrect7[0], {css: {backgroundImage: `url(${window.imageUrls[6]})`, backgroundSize: '100%, 100%'}});

var CardImageCorrect8 = document.querySelectorAll("[data-acc-text='CardImageCorrect8']")
TweenLite.set(CardImageCorrect8[0], {css: {backgroundImage: `url(${window.imageUrls[7]})`, backgroundSize: '100%, 100%'}});

var CardImageCorrect9 = document.querySelectorAll("[data-acc-text='CardImageCorrect9']")
TweenLite.set(CardImageCorrect9[0], {css: {backgroundImage: `url(${window.imageUrls[8]})`, backgroundSize: '100%, 100%'}});

var CardImageCorrect10 = document.querySelectorAll("[data-acc-text='CardImageCorrect10']")
TweenLite.set(CardImageCorrect10[0], {css: {backgroundImage: `url(${window.imageUrls[9]})`, backgroundSize: '100%, 100%'}});

var CardImageCorrect11 = document.querySelectorAll("[data-acc-text='CardImageCorrect11']")
TweenLite.set(CardImageCorrect11[0], {css: {backgroundImage: `url(${window.imageUrls[10]})`, backgroundSize: '100%, 100%'}});



var drop_counter = 0;
player.SetVar("DropCounter",drop_counter);




}

function Script28()
{
  the.play();
}

function Script29()
{
  var player = GetPlayer();

var url = player.GetVar("url");

// update answer array

var ans=player.GetVar("AnsArray");

ans = ans + window.card_array[11] + ",";

player.SetVar("AnsArray",ans);


var ans_step = player.GetVar("AnsStepArray");

ans_step = ans_step + player.GetVar("Counter") + ",";

player.SetVar("AnsStepArray",ans_step);


// who answers

var CardImage2 = document.querySelectorAll("[data-acc-text='CardImage2']")
TweenLite.set(CardImage2[0], {css: {backgroundImage: `url(${window.imageUrls[1]})`, backgroundSize: '100%, 100%'}});

var CardImage4 = document.querySelectorAll("[data-acc-text='CardImage4']")
TweenLite.set(CardImage4[0], {css: {backgroundImage: `url(${window.imageUrls[3]})`, backgroundSize: '100%, 100%'}});


// what doing answer

var CardImage5 = document.querySelectorAll("[data-acc-text='CardImage5']")
TweenLite.set(CardImage5[0], {css: {backgroundImage: `url(${window.imageUrls[4]})`, backgroundSize: '100%, 100%'}});

// what answer

var CardImage7 = document.querySelectorAll("[data-acc-text='CardImage7']")
TweenLite.set(CardImage7[0], {css: {backgroundImage: `url(${window.imageUrls[6]})`, backgroundSize: '100%, 100%'}});

// where answers

var CardImage9 = document.querySelectorAll("[data-acc-text='CardImage9']")
TweenLite.set(CardImage9[0], {css: {backgroundImage: `url(${window.imageUrls[8]})`, backgroundSize: '100%, 100%'}});

// when answers

var CardImage11 = document.querySelectorAll("[data-acc-text='CardImage11']")
TweenLite.set(CardImage11[0], {css: {backgroundImage: `url(${window.imageUrls[10]})`, backgroundSize: '100%, 100%'}});


// describe answers

var CardImage1 = document.querySelectorAll("[data-acc-text='CardImage1']")
TweenLite.set(CardImage1[0], {css: {backgroundImage: `url(${window.imageUrls[0]})`, backgroundSize: '100%, 100%'}});

var CardImage3 = document.querySelectorAll("[data-acc-text='CardImage3']")
TweenLite.set(CardImage3[0], {css: {backgroundImage: `url(${window.imageUrls[2]})`, backgroundSize: '100%, 100%'}});

var CardImage6 = document.querySelectorAll("[data-acc-text='CardImage6']")
TweenLite.set(CardImage6[0], {css: {backgroundImage: `url(${window.imageUrls[5]})`, backgroundSize: '100%, 100%'}});

var CardImage8 = document.querySelectorAll("[data-acc-text='CardImage8']")
TweenLite.set(CardImage8[0], {css: {backgroundImage: `url(${window.imageUrls[7]})`, backgroundSize: '100%, 100%'}});

var CardImage10 = document.querySelectorAll("[data-acc-text='CardImage10']")
TweenLite.set(CardImage10[0], {css: {backgroundImage: `url(${window.imageUrls[9]})`, backgroundSize: '100%, 100%'}});


// incorrect answers


var CardImage12 = document.querySelectorAll("[data-acc-text='CardImage12']")
TweenLite.set(CardImage12[0], {css: {backgroundImage: `url(${window.imageUrls[11]})`, backgroundSize: '100%, 100%'}});

var CardImage13 = document.querySelectorAll("[data-acc-text='CardImage13']")
TweenLite.set(CardImage13[0], {css: {backgroundImage: `url(${window.imageUrls[12]})`, backgroundSize: '100%, 100%'}});

var CardImage14 = document.querySelectorAll("[data-acc-text='CardImage14']")
TweenLite.set(CardImage14[0], {css: {backgroundImage: `url(${window.imageUrls[13]})`, backgroundSize: '100%, 100%'}});

var CardImage15 = document.querySelectorAll("[data-acc-text='CardImage15']")
TweenLite.set(CardImage15[0], {css: {backgroundImage: `url(${window.imageUrls[14]})`, backgroundSize: '100%, 100%'}});

var CardImage16 = document.querySelectorAll("[data-acc-text='CardImage16']")
TweenLite.set(CardImage16[0], {css: {backgroundImage: `url(${window.imageUrls[15]})`, backgroundSize: '100%, 100%'}});





// audio

window.CardAudio1 = new Audio(url + 'audio/6/' +card_array[1]+'.mp3');
window.CardAudio2 = new Audio(url + 'audio/1/' +card_array[2]+'.mp3');
window.CardAudio3 = new Audio(url + 'audio/6/' +card_array[3]+'.mp3');
window.CardAudio4 = new Audio(url + 'audio/1/' +card_array[4]+'.mp3');
window.CardAudio5 = new Audio(url + 'audio/2/' +card_array[5]+'.mp3');
window.CardAudio6 = new Audio(url + 'audio/6/' +card_array[6]+'.mp3');
window.CardAudio7 = new Audio(url + 'audio/3/' +card_array[7]+'.mp3');
window.CardAudio8 = new Audio(url + 'audio/6/' +card_array[8]+'.mp3');
window.CardAudio9 = new Audio(url + 'audio/4/' +card_array[9]+'.mp3');
window.CardAudio10 = new Audio(url + 'audio/6/' +card_array[10]+'.mp3');
window.CardAudio11 = new Audio(url + 'audio/5/' +card_array[11]+'.mp3');

window.CardAudio12 = new Audio(url + 'audio/1/' +card_array[12]+'.mp3');
window.CardAudio13 = new Audio(url + 'audio/2/' +card_array[13]+'.mp3');
window.CardAudio14 = new Audio(url + 'audio/6/' +card_array[14]+'.mp3');

window.CardAudio15 = new Audio(url + 'audio/3/' +card_array[15]+'.mp3');
window.CardAudio16 = new Audio(url + 'audio/6/' +card_array[16]+'.mp3');





window.the = new Audio(url+'audio/0/the.mp3');
window.withthe = new Audio(url+'audio/0/withthe.mp3');
window.is = new Audio(url+'audio/0/is.mp3');
window.atthe = new Audio(url+'audio/0/atthe.mp3');
window.something = new Audio(url+'audio/0/something.mp3');
window.each = new Audio(url+'audio/0/each.mp3');
window.and = new Audio(url+'audio/0/and.mp3');
window.are = new Audio(url+'audio/0/are.mp3');


window.sequences = [
    url + 'audio/0/the.mp3', 
    url + 'audio/6/' + card_array[1] + '.mp3', 
    url + 'audio/1/' + card_array[2] + '.mp3', 
    url + 'audio/0/and.mp3', 
    url + 'audio/6/' + card_array[3] + '.mp3', 
    url + 'audio/0/something.mp3',
    url + 'audio/0/are.mp3', 
    url + 'audio/0/something.mp3',
    (window.card_array[5] == '25') ? url + 'audio/0/withthe.mp3' : url + 'audio/0/the.mp3', 
    url + 'audio/6/' + card_array[6] + '.mp3', 
    url + 'audio/3/' + card_array[7] + '.mp3', 
    url + 'audio/0/atthe.mp3', 
    url + 'audio/6/' + card_array[8] + '.mp3', 
    url + 'audio/0/something.mp3',
    url + 'audio/0/each.mp3', 
    url + 'audio/6/' + card_array[10] + '.mp3', 
    url + 'audio/0/something.mp3'    
];


var title = "The <b style='color: #7030A0;'>" + player.GetVar("Card1").toLowerCase() + "</b> <b style='color: #FF7E02;'>" + player.GetVar("Card2").toLowerCase() + "</b>" +
  " and <b style='color: #7030A0;'>" + player.GetVar("Card3").toLowerCase() + "</b> <b style='color: #FF7E02;'> ???? </b>" +
  " are <b style='color: #FFC004;'> ???? </b>"

if (window.card_array[5] == '25')
title = title + " with the ";
else 
title = title + " the ";


title = title +"<b style='color: #7030A0;'>" + player.GetVar("Card6").toLowerCase() + "</b> <b style='color: #77933F;'> " + player.GetVar("Card7").toLowerCase() + "</b>" +
  " at the <b style='color: #7030A0;'>" + player.GetVar("Card8").toLowerCase() + "</b> <b style='color: #0471C0;'> ???? </b>" +
" each <b style='color: #7030A0;'>" + player.GetVar("Card10").toLowerCase() + "</b> <b style='color: #C25E0C;'> ???? </b>";

var titleComplete = document.querySelectorAll("[data-acc-text='title_complete']")[0];

// Function to dynamically adjust font size
function adjustFontSize() {
    var screenWidth = window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth;

    // Calculate the desired font size based on the screen width
    var fontSize = Math.max(16, screenWidth / 50); // You can adjust the ratio as needed

    // Apply the font size to the titleComplete element
    titleComplete.style.fontSize = fontSize + 'px';
}

// Initial adjustment when the page loads
adjustFontSize();

// Event listener for resizing
window.addEventListener('resize', adjustFontSize);

titleComplete.innerHTML = "<div style='text-align: center; color: #fff; font-family: \"Open Sans\", sans-serif;'>" + title + "</div>";

}

function Script30()
{
  CardAudio14.play();
}

function Script31()
{
  console.log("GSAP version: " + gsap.version);

CardAudio14.play();

var player = GetPlayer();

var drop_counter = 0;

var myElement, card, slide;

for (i = 4; i <= 16; i = i === 11 ? 14 : i + 1) {
  card = "data-acc-text='CardImage" + (i) + "'";
  myElement = document.querySelector("[" + card + "]");

  slide = document.getElementById("slide");
  var elementRect = myElement.getBoundingClientRect();
  var elXPos = elementRect.left - slide.getBoundingClientRect().left;
  var elYPos = elementRect.top - slide.getBoundingClientRect().top;

  elXPos = Math.round((elXPos / slide.clientWidth) * 100);
  elYPos = Math.round((elYPos / slide.clientHeight) * 100);
  
  if (elXPos == 59 || elXPos == 77 || elXPos == 54 || elXPos == 83)
  drop_counter = drop_counter + 1;
    
}

player.SetVar("DropCounter",drop_counter);

}

function Script32()
{
  CardAudio16.play();
}

function Script33()
{
  console.log("GSAP version: " + gsap.version);

CardAudio16.play();

var player = GetPlayer();

var drop_counter = 0;

var myElement, card, slide;

for (i = 4; i <= 16; i = i === 11 ? 14 : i + 1) {
  card = "data-acc-text='CardImage" + (i) + "'";
  myElement = document.querySelector("[" + card + "]");

  slide = document.getElementById("slide");
  var elementRect = myElement.getBoundingClientRect();
  var elXPos = elementRect.left - slide.getBoundingClientRect().left;
  var elYPos = elementRect.top - slide.getBoundingClientRect().top;

  elXPos = Math.round((elXPos / slide.clientWidth) * 100);
  elYPos = Math.round((elYPos / slide.clientHeight) * 100);
  
  if (elXPos == 59 || elXPos == 77 || elXPos == 54 || elXPos == 83)
  drop_counter = drop_counter + 1;
    
}

player.SetVar("DropCounter",drop_counter);

}

function Script34()
{
  CardAudio15.play();
}

function Script35()
{
  console.log("GSAP version: " + gsap.version);

CardAudio15.play();

var player = GetPlayer();

var drop_counter = 0;

var myElement, card, slide;

for (i = 4; i <= 16; i = i === 11 ? 14 : i + 1) {
  card = "data-acc-text='CardImage" + (i) + "'";
  myElement = document.querySelector("[" + card + "]");

  slide = document.getElementById("slide");
  var elementRect = myElement.getBoundingClientRect();
  var elXPos = elementRect.left - slide.getBoundingClientRect().left;
  var elYPos = elementRect.top - slide.getBoundingClientRect().top;

  elXPos = Math.round((elXPos / slide.clientWidth) * 100);
  elYPos = Math.round((elYPos / slide.clientHeight) * 100);
  
  if (elXPos == 59 || elXPos == 77 || elXPos == 54 || elXPos == 83)
  drop_counter = drop_counter + 1;

}


player.SetVar("DropCounter",drop_counter);

}

function Script36()
{
  CardAudio11.play();
}

function Script37()
{
  console.log("GSAP version: " + gsap.version);

CardAudio11.play();

var player = GetPlayer();

var drop_counter = 0;

var myElement, card, slide;

for (i = 4; i <= 16; i = i === 11 ? 14 : i + 1) {
  card = "data-acc-text='CardImage" + (i) + "'";
  myElement = document.querySelector("[" + card + "]");

  slide = document.getElementById("slide");
  var elementRect = myElement.getBoundingClientRect();
  var elXPos = elementRect.left - slide.getBoundingClientRect().left;
  var elYPos = elementRect.top - slide.getBoundingClientRect().top;

  elXPos = Math.round((elXPos / slide.clientWidth) * 100);
  elYPos = Math.round((elYPos / slide.clientHeight) * 100);
  
  if (elXPos == 59 || elXPos == 77 || elXPos == 54 || elXPos == 83)
  drop_counter = drop_counter + 1;
  
}

player.SetVar("DropCounter",drop_counter);

}

function Script38()
{
  CardAudio9.play();
}

function Script39()
{
  console.log("GSAP version: " + gsap.version);

CardAudio9.play();

var player = GetPlayer();

var drop_counter = 0;

var myElement, card, slide;

for (i = 4; i <= 16; i = i === 11 ? 14 : i + 1) {
  card = "data-acc-text='CardImage" + (i) + "'";
  myElement = document.querySelector("[" + card + "]");

  slide = document.getElementById("slide");
  var elementRect = myElement.getBoundingClientRect();
  var elXPos = elementRect.left - slide.getBoundingClientRect().left;
  var elYPos = elementRect.top - slide.getBoundingClientRect().top;

  elXPos = Math.round((elXPos / slide.clientWidth) * 100);
  elYPos = Math.round((elYPos / slide.clientHeight) * 100);
  
  if (elXPos == 59 || elXPos == 77 || elXPos == 54 || elXPos == 83)
  drop_counter = drop_counter + 1;
  
}

player.SetVar("DropCounter",drop_counter);

}

function Script40()
{
  CardAudio5.play();
}

function Script41()
{
  console.log("GSAP version: " + gsap.version);

CardAudio5.play();

var player = GetPlayer();

var drop_counter = 0;

var myElement, card, slide;

for (i = 4; i <= 16; i = i === 11 ? 14 : i + 1) {
  card = "data-acc-text='CardImage" + (i) + "'";
  myElement = document.querySelector("[" + card + "]");

  slide = document.getElementById("slide");
  var elementRect = myElement.getBoundingClientRect();
  var elXPos = elementRect.left - slide.getBoundingClientRect().left;
  var elYPos = elementRect.top - slide.getBoundingClientRect().top;

  elXPos = Math.round((elXPos / slide.clientWidth) * 100);
  elYPos = Math.round((elYPos / slide.clientHeight) * 100);
  
  if (elXPos == 59 || elXPos == 77 || elXPos == 54 || elXPos == 83)
  drop_counter = drop_counter + 1;

}

player.SetVar("DropCounter",drop_counter);

}

function Script42()
{
  CardAudio4.play();
}

function Script43()
{
  console.log("GSAP version: " + gsap.version);

CardAudio4.play();

var player = GetPlayer();

var drop_counter = 0;

var myElement, card, slide;

for (i = 4; i <= 16; i = i === 11 ? 14 : i + 1) {
  card = "data-acc-text='CardImage" + (i) + "'";
  myElement = document.querySelector("[" + card + "]");

  slide = document.getElementById("slide");
  var elementRect = myElement.getBoundingClientRect();
  var elXPos = elementRect.left - slide.getBoundingClientRect().left;
  var elYPos = elementRect.top - slide.getBoundingClientRect().top;

  elXPos = Math.round((elXPos / slide.clientWidth) * 100);
  elYPos = Math.round((elYPos / slide.clientHeight) * 100);
  
  if (elXPos == 59 || elXPos == 77 || elXPos == 54 || elXPos == 83)
  drop_counter = drop_counter + 1;

}

player.SetVar("DropCounter",drop_counter);

}

function Script44()
{
  CardAudio10.play();
}

function Script45()
{
  each.play();
}

function Script46()
{
  CardAudio8.play();
}

function Script47()
{
  atthe.play();
}

function Script48()
{
  CardAudio7.play();
}

function Script49()
{
  CardAudio6.play();
}

function Script50()
{
  
if (window.card_array[5] == '25')
withthe.play();
else 
the.play();
}

function Script51()
{
  function playAudio(src) {
  var audioElement = new Audio(src);
  audioElement.play();
  return audioElement
}

var player = GetPlayer();

player.SetVar("SpeakerSwitch",'1');

let index = 0

const audioElement = playAudio(sequences[index])
audioElement.addEventListener('ended', (e) => {
  index++
  if (index < sequences.length) {
    audioElement.src = sequences[index]
    audioElement.play();
  }
else
    player.SetVar("SpeakerSwitch",'0');

})
}

function Script52()
{
  are.play();
}

function Script53()
{
  CardAudio3.play();
}

function Script54()
{
  and.play();
}

function Script55()
{
  CardAudio2.play();
}

function Script56()
{
  CardAudio1.play();
}

function Script57()
{
  the.play();
}

function Script58()
{
  var player = GetPlayer();

var drop_counter = 0;
player.SetVar("DropCounter",drop_counter);
}

function Script59()
{
  var player = GetPlayer();

console.log("GSAP version: "+TweenLite.version);

var player = GetPlayer();


var CardImageCorrect4 = document.querySelectorAll("[data-acc-text='CardImageCorrect4']")
TweenLite.set(CardImageCorrect4[0], {css: {backgroundImage: `url(${window.imageUrls[3]})`, backgroundSize: '100%, 100%'}});


var CardImageCorrect5 = document.querySelectorAll("[data-acc-text='CardImageCorrect5']")
TweenLite.set(CardImageCorrect5[0], {css: {backgroundImage: `url(${window.imageUrls[4]})`, backgroundSize: '100%, 100%'}});


var CardImageCorrect9 = document.querySelectorAll("[data-acc-text='CardImageCorrect9']")
TweenLite.set(CardImageCorrect9[0], {css: {backgroundImage: `url(${window.imageUrls[8]})`, backgroundSize: '100%, 100%'}});


var CardImageCorrect11 = document.querySelectorAll("[data-acc-text='CardImageCorrect11']")
TweenLite.set(CardImageCorrect11[0], {css: {backgroundImage: `url(${window.imageUrls[10]})`, backgroundSize: '100%, 100%'}});






var drop_counter = 0;
player.SetVar("DropCounter",drop_counter);
}

function Script60()
{
  var player = GetPlayer();

console.log("GSAP version: "+TweenLite.version);

var CardImageCorrect1 = document.querySelectorAll("[data-acc-text='CardImageCorrect1']")
TweenLite.set(CardImageCorrect1[0], {css: {backgroundImage: `url(${window.imageUrls[0]})`, backgroundSize: '100%, 100%'}});

var CardImageCorrect2 = document.querySelectorAll("[data-acc-text='CardImageCorrect2']")
TweenLite.set(CardImageCorrect2[0], {css: {backgroundImage: `url(${window.imageUrls[1]})`, backgroundSize: '100%, 100%'}});

var CardImageCorrect3 = document.querySelectorAll("[data-acc-text='CardImageCorrect3']")
TweenLite.set(CardImageCorrect3[0], {css: {backgroundImage: `url(${window.imageUrls[2]})`, backgroundSize: '100%, 100%'}});

var CardImageCorrect4 = document.querySelectorAll("[data-acc-text='CardImageCorrect4']")
TweenLite.set(CardImageCorrect4[0], {css: {backgroundImage: `url(${window.imageUrls[3]})`, backgroundSize: '100%, 100%'}});

var CardImageCorrect5 = document.querySelectorAll("[data-acc-text='CardImageCorrect5']")
TweenLite.set(CardImageCorrect5[0], {css: {backgroundImage: `url(${window.imageUrls[4]})`, backgroundSize: '100%, 100%'}});

var CardImageCorrect6 = document.querySelectorAll("[data-acc-text='CardImageCorrect6']")
TweenLite.set(CardImageCorrect6[0], {css: {backgroundImage: `url(${window.imageUrls[5]})`, backgroundSize: '100%, 100%'}});

var CardImageCorrect7 = document.querySelectorAll("[data-acc-text='CardImageCorrect7']")
TweenLite.set(CardImageCorrect7[0], {css: {backgroundImage: `url(${window.imageUrls[6]})`, backgroundSize: '100%, 100%'}});

var CardImageCorrect8 = document.querySelectorAll("[data-acc-text='CardImageCorrect8']")
TweenLite.set(CardImageCorrect8[0], {css: {backgroundImage: `url(${window.imageUrls[7]})`, backgroundSize: '100%, 100%'}});

var CardImageCorrect9 = document.querySelectorAll("[data-acc-text='CardImageCorrect9']")
TweenLite.set(CardImageCorrect9[0], {css: {backgroundImage: `url(${window.imageUrls[8]})`, backgroundSize: '100%, 100%'}});

var CardImageCorrect10 = document.querySelectorAll("[data-acc-text='CardImageCorrect10']")
TweenLite.set(CardImageCorrect10[0], {css: {backgroundImage: `url(${window.imageUrls[9]})`, backgroundSize: '100%, 100%'}});

var CardImageCorrect11 = document.querySelectorAll("[data-acc-text='CardImageCorrect11']")
TweenLite.set(CardImageCorrect11[0], {css: {backgroundImage: `url(${window.imageUrls[10]})`, backgroundSize: '100%, 100%'}});

var drop_counter = 0;
player.SetVar("DropCounter",drop_counter);




}

function Script61()
{
  console.log("GSAP version: "+TweenLite.version);

var player = GetPlayer();

var url=player.GetVar("url");

window.card_array = [];
var who_array = [];
var what_doing_array = [];
var what_array = [];
var where_array = [];
var when_array = [];
var describe_array = [];

var ans_array_numbers, correct_card, card_ans;

var ans_array_str = player.GetVar("AnsArray");
var ans_step_str = player.GetVar("AnsStepArray");


// Convert string values to arrays
var ans_array = ans_array_str.split(",");
var ans_step = ans_step_str.split(",");

if (ans_array_str !== "") {
    // Loop through ans_array
for (var i = 0; i < ans_array.length-1; i++) {

    // Select the corresponding element using data-acc-text attribute
    var card_ans = document.querySelectorAll("[data-acc-text='x" + ans_step[i] + "']");

        var width = card_ans[0].offsetWidth - 8;
        var height = card_ans[0].offsetHeight - 8;
        
        // Apply TweenLite for the current values
        TweenLite.set(card_ans[0], {
            css: {
                backgroundImage: 'url(' + url + 'images/4/' + ans_array[i] + '.png)',
                width: width + 'px',
                height: height + 'px',
                backgroundRepeat: 'no-repeat',
                backgroundSize: '80% 80%',
                backgroundColor: '#fff',
                backgroundPosition: 'center center'
            }
        });

}
}


var item_array=[
["Bird","Who",4,5,6,12],
["Cat","Who",4,5,6],
["Chicken","Who",4,5],
["Crocodile","Who",9,11],
["Dinosaur","Who",2,5,11],
["Dog","Who",5,6,9,10],
["Donkey","Who",11,5],
["Daddy","Who",3,4,17],
["Fish","Who",6,9,12],
["Flamingo","Who",1,5,9,10],
["Girl","Who",3,5,6,17],
["Hippo","Who",2,5,11],
["King","Who",3,4,17],
["Lion","Who",5,9,10,11],
["Mummy","Who",3,4,17],
["Queen","Who",3,4,17],
["Sheep","Who",11,5,9,10],
["Snail","Who",4,6,12],
["Snake","Who",4,6,12],
["Spider","Who",4,6,12],
["Tiger","Who",5,11],
["Eating","WhatDoing",13,14],
["Watching","WhatDoing",13,14],
["Cleaning","WhatDoing",13,14],
["Cooking","WhatDoing",13,14],
["Playing","WhatDoing",13,14],
["Drinking","WhatDoing",13,14],
["Driving","WhatDoing",13,14],
["Giving","WhatDoing",13,14],
["Singing","WhatDoing",13,14],
["Writing","WhatDoing",13,14],
["Flying","WhatDoing",13,14],
["Apple","Eating",1,13,16],
["Banana","Eating",1,13,16],
["Broccoli","Eating",7,16],
["Chips","Eating",1,7,13,16],
["Orange","Eating",1,13,16],
["Pear","Eating",1,13,16],
["Peas","Eating",7,16],
["Pizza","Eating",1,7,13,16],
["Sandwich","Eating",1,7,13,16],
["Boat","Watching",2,5,11,13],
["Train","Watching",2,5,11],
["Lorry","Watching",2,5,11],
["Car","Watching",2,5,11,13],
["Bed","Cleaning",1,11,13],
["Bike","Cleaning",1,5,11],
["Car","Cleaning",1,5,11,13],
["Toys","Cleaning",5,13,14],
["Lorry","Cleaning",1,5,11],
["Sofa","Cleaning",1,11,13],
["Chips","Cooking",1,7,16],
["Peas","Cooking",7,16],
["Pizza","Cooking",1,7,16],
["Broccoli","Cooking",7,16],
["Car","Playing",1,5,11,13],
["Teddy","Playing",1,13,17],
["Lorry","Playing",1,5,11],
["Aeroplane","Playing",1,5,11],
["Boat","Playing",1,5,11,13],
["Computer","Playing",5,13],
["Orange Juice","Drinking",8,13,16],
["Apple Juice","Drinking",8,13,16],
["Fruit Juice","Drinking",8,13,16],
["Pear Juice","Drinking",8,13,16],
["Milk","Drinking",7,8,13,16],
["Water","Drinking",7,8,16],
["Aeroplane","Flying",1,5,11,15],
["Boat","Sailing",2,5,11,13],
["Car","Driving",1,5,11,13],
["Lorry","Driving",1,5,11],
["Train","Driving",2,5,11],
["Present","Giving",11,13,14,15,16],
["Song","Singing",5,6,13,14,15,17],
["Letter","Writing",2,4,17],
["Song","Writing",5,6,13,14,15,17],
["Homework","Writing",2,11],
["Beach","Where",2,7,14],
["Garden","Where",7,8,9,10,14],
["Home","Where",7,14,15],
["School","Where",2,15],
["Police Station","Where",2,15],
["Fire Station","Where",2,15],
["Airport","Where",2,15],
["Park","Where",2,7,8,9,10,14,15],
["Forest","Where",2,7,8,9,10,14],
["Jungle","Where",2,7,9,10,14],
["Grass","Where",3,9,10],
["Hospital","Where",2,15],
["Farm","Where",2,9,15],
["Zoo","Where",7,14,15],
["Flower Beds","Where",7,8,9,10,14],
["Seaside","Where",7,8,9,10,14],
["Garage","Where",7,8,9,10,15],
["Public Garden","Where",7,8,9,10,14],
["Bus Station","Where",7,8,9,10,15],
["Service Station","Where",7,8,9,10,15],
["Dinner Time","When",6,14,16],
["Bed Time","When",6,14],
["Autumn Time","When",8,9],
["Winter Time","When",8,9],
["Summer Time","When",7,10],
["Christmas Time","When",8,13,14,17],
["Day Time","When",7,8,9,10],
["Night Time","When",7,8,9,10],
["Birthday","When",13,14,15,17],
["Breakfast","When",14,16],
["Mother’s Day","When",13,14,17]
];



who_array[1]='Bird';
who_array[2]='Cat';
who_array[3]='Chicken';
who_array[4]='Cow';
who_array[5]='Crocodile';
who_array[6]='Dinosaur';
who_array[7]='Dog';
who_array[8]='Donkey';
who_array[9]='Fish';
who_array[10]='Flamingo';
who_array[11]='Hippo';
who_array[12]='Lion';
who_array[13]='Sheep';
who_array[14]='Snail';
who_array[15]='Snake';
who_array[16]='Spider';
who_array[17]='Tiger';
who_array[18]='Daddy';
who_array[19]='Mummy';
who_array[20]='Toddler';
who_array[21]='Baby';
who_array[22]='Girl';
who_array[23]='Queen';
who_array[24]='King';


what_doing_array[1]='Looking';
what_doing_array[2]='Washing';
what_doing_array[3]='Drinking';
what_doing_array[4]='Sleeping';
what_doing_array[5]='Jumping';
what_doing_array[6]='Eating';
what_doing_array[7]='Listening';
what_doing_array[8]='Writing';
what_doing_array[9]='Swimming';
what_doing_array[10]='Flying';
what_doing_array[11]='Kicking';
what_doing_array[12]='Watching';
what_doing_array[13]='Surfing';
what_doing_array[14]='Cleaning';
what_doing_array[15]='Cooking';
what_doing_array[16]='Thinking';
what_doing_array[17]='Walking';
what_doing_array[18]='Singing';
what_doing_array[19]='Climbing';
what_doing_array[20]='Crawling';
what_doing_array[21]='Diving';
what_doing_array[22]='Giving';
what_doing_array[23]='Crying';
what_doing_array[24]='Sailing';
what_doing_array[25]='Playing';
what_doing_array[26]='Driving';



what_array[1]='Pizza';
what_array[2]='Boat';
what_array[3]='Chips';
what_array[4]='Peas';
what_array[5]='Banana';
what_array[6]='Orange';
what_array[7]='Orange Juice';
what_array[8]='Apple';
what_array[9]='Pear';
what_array[10]='Toys';
what_array[11]='Broccoli';
what_array[12]='Burger';
what_array[13]='Computer';
what_array[14]='Aeroplane';
what_array[15]='Train';
what_array[16]='Car';
what_array[17]='Television';
what_array[18]='Lorry';
what_array[19]='Bike';
what_array[20]='Sandwich';
what_array[21]='Toilet';
what_array[22]='Bed';
what_array[23]='Sofa';
what_array[24]='Oven';
what_array[25]='Teddy';
what_array[26]='Apple Juice';
what_array[27]='Fruit Juice';
what_array[28]='Pear Juice';
what_array[29]='Milk';
what_array[30]='Water';
what_array[31]='Present';
what_array[32]='Song';
what_array[33]='Letter';
what_array[34]='Homework';


where_array[1]='Beach';
where_array[2]='Garden';
where_array[3]='Home';
where_array[4]='School';
where_array[5]='Police Station';
where_array[6]='Fire Station';
where_array[7]='Airport';
where_array[8]='Road';
where_array[9]='Park';
where_array[10]='Forest';
where_array[11]='Jungle';
where_array[12]='Sky';
where_array[13]='Grass';
where_array[14]='Hospital';
where_array[15]='Farm';
where_array[16]='Petrol Station';
where_array[17]='Zoo';
where_array[19]='Bus Station';
where_array[24]='Flower Beds';
where_array[25]='Seaside';
where_array[26]='Garage';
where_array[27]='Public Garden';
where_array[28]='Service Station';



when_array[1]='Dinner Time';
when_array[2]='Bed Time';
when_array[3]='Autumn Time';
when_array[4]='Winter Time';
when_array[5]='Summer Time';
when_array[6]='Christmas Time';
when_array[7]='Day Time';
when_array[8]='Night Time';
when_array[9]='Morning';
when_array[10]='Birthday';
when_array[11]='Holiday';
when_array[12]='Breakfast';
when_array[13]='Spring';
when_array[14]='Mother’s Day';


describe_array[1]='Large';
describe_array[2]='Huge';
describe_array[3]='Tall';
describe_array[4]='Small';
describe_array[5]='Loud';
describe_array[6]='Quiet';
describe_array[7]='Hot ';
describe_array[8]='Cold';
describe_array[9]='Wet';
describe_array[10]='Dry';
describe_array[11]='Heavy';
describe_array[12]='Light';
describe_array[13]='Best';
describe_array[14]='Brilliant';
describe_array[15]='Noisy';
describe_array[16]='Tasty';
describe_array[17]='Happy';


// Shuffle function to randomly shuffle array elements
function shuffle(array) {
  for (let i = array.length - 1; i > 0; i--) {
    const j = Math.floor(Math.random() * (i + 1));
    [array[i], array[j]] = [array[j], array[i]];
  }
  return array;
}

// Sort routine to keep first two columns intact and randomly sort the rest
item_array.forEach(row => {
  let remainingColumns = row.slice(2); // Extract remaining columns
  remainingColumns = shuffle(remainingColumns); // Randomly shuffle remaining columns
  row.splice(2, remainingColumns.length, ...remainingColumns); // Replace shuffled columns
});

// Group rows by the second column and sort them randomly within each group
const groupedRows = {};
item_array.forEach(row => {
  const group = row[1];
  if (!groupedRows[group]) {
    groupedRows[group] = [];
  }
  groupedRows[group].push(row);
});

Object.values(groupedRows).forEach(group => {
  shuffle(group);
});

// Flatten the grouped and shuffled rows back into item_array
item_array = Object.values(groupedRows).reduce((acc, val) => acc.concat(val), []);

// Update the item_array to contain the filtered results
const groupsProcessed = [];
let whoCount = 0;
item_array = item_array.filter((row, index) => {
  const group = row[1];
  if (group === 'Who') {
    if (whoCount < 2) {
      whoCount++;
      return true;
    } else {
      return false;
    }
  } else {
    if (!groupsProcessed.includes(group)) {
      groupsProcessed.push(group);
      return true;
    } else {
      return false;
    }
  }
});

// New filter based on item_array[2][0]
const categoryToMatch = item_array[2][0];
item_array = item_array.filter((row, index) => {
  if (index >= 2 && index <= 14) {
    return row.includes(categoryToMatch);
  } else {
    return true;
  }
});

// Update item_array to contain only three columns
item_array.forEach(row => {
  row.splice(3); // Remove columns starting from index 3
});


console.log(item_array);


card_array[1] = item_array[0][2];
card_array[2] = who_array.indexOf(item_array[0][0]);

card_array[3] = item_array[1][2];
card_array[4] = who_array.indexOf(item_array[1][0]);

card_array[5] = what_doing_array.indexOf(item_array[2][0]);

card_array[6] = item_array[3][2];
card_array[7] = what_array.indexOf(item_array[3][0]);

card_array[8] = item_array[4][2];
card_array[9] = where_array.indexOf(item_array[4][0]);


for (i = 10; i <= 12; i++) {
do {
rand = Math.floor(Math.random() * 14) + 1;
}
while (card_array.includes(rand));

card_array[i] = rand;

}



window.imageUrls = [
  url + 'images/6/' +card_array[1]+ '.png',
  url + 'images/1/' +card_array[2]+ '.png',

  url + 'images/6/' +card_array[3]+ '.png',
  url + 'images/1/' +card_array[4]+ '.png',

  url + 'images/2/' +card_array[5]+ '.png',
  
  url + 'images/6/' +card_array[6]+ '.png',
  url + 'images/3/' +card_array[7]+ '.png',
  
  url + 'images/6/' +card_array[8]+ '.png',
  url + 'images/4/' +card_array[9]+ '.png',
   
  url + 'images/3/' +card_array[10]+ '.png',
  url + 'images/5/' +card_array[11]+ '.png',
  url + 'images/6/' +card_array[12]+ '.png'
];


// pre-load

for (var i = 0; i < imageUrls.length; i++) {
  var image = new Image();
  image.src = window.imageUrls[i];
}


// set cards

player.SetVar("Card1", describe_array[card_array[1]]);
player.SetVar("Card2", who_array[card_array[2]]);
player.SetVar("Card3", describe_array[card_array[3]]);
player.SetVar("Card4", who_array[card_array[4]]);
player.SetVar("Card5", what_doing_array[card_array[5]]);
player.SetVar("Card6", describe_array[card_array[6]]);
player.SetVar("Card7", what_array[card_array[7]]);
player.SetVar("Card8", describe_array[card_array[8]]);
player.SetVar("Card9", where_array[card_array[9]]);
player.SetVar("Card10", what_array[card_array[10]]);
player.SetVar("Card11", when_array[card_array[11]]);
player.SetVar("Card12", describe_array[card_array[12]]);



}

function Script62()
{
  var player = GetPlayer();

var url = player.GetVar("url");

// update answer array

var ans=player.GetVar("AnsArray");

ans = ans + window.card_array[9] + ",";

player.SetVar("AnsArray",ans);


var ans_step = player.GetVar("AnsStepArray");

ans_step = ans_step + player.GetVar("Counter") + ",";

player.SetVar("AnsStepArray",ans_step);



// who answers

var CardImage2 = document.querySelectorAll("[data-acc-text='CardImage2']")
TweenLite.set(CardImage2[0], {css: {backgroundImage: `url(${window.imageUrls[1]})`, backgroundSize: '100%, 100%'}});

var CardImage4 = document.querySelectorAll("[data-acc-text='CardImage4']")
TweenLite.set(CardImage4[0], {css: {backgroundImage: `url(${window.imageUrls[3]})`, backgroundSize: '100%, 100%'}});


// what doing answer

var CardImage5 = document.querySelectorAll("[data-acc-text='CardImage5']")
TweenLite.set(CardImage5[0], {css: {backgroundImage: `url(${window.imageUrls[4]})`, backgroundSize: '100%, 100%'}});

// what answer

var CardImage7 = document.querySelectorAll("[data-acc-text='CardImage7']")
TweenLite.set(CardImage7[0], {css: {backgroundImage: `url(${window.imageUrls[6]})`, backgroundSize: '100%, 100%'}});

// where answers

var CardImage9 = document.querySelectorAll("[data-acc-text='CardImage9']")
TweenLite.set(CardImage9[0], {css: {backgroundImage: `url(${window.imageUrls[8]})`, backgroundSize: '100%, 100%'}});

// describe answers

var CardImage3 = document.querySelectorAll("[data-acc-text='CardImage3']")
TweenLite.set(CardImage3[0], {css: {backgroundImage: `url(${window.imageUrls[2]})`, backgroundSize: '100%, 100%'}});

var CardImage1 = document.querySelectorAll("[data-acc-text='CardImage1']")
TweenLite.set(CardImage1[0], {css: {backgroundImage: `url(${window.imageUrls[0]})`, backgroundSize: '100%, 100%'}});

var CardImage6 = document.querySelectorAll("[data-acc-text='CardImage6']")
TweenLite.set(CardImage6[0], {css: {backgroundImage: `url(${window.imageUrls[5]})`, backgroundSize: '100%, 100%'}});

var CardImage8 = document.querySelectorAll("[data-acc-text='CardImage8']")
TweenLite.set(CardImage8[0], {css: {backgroundImage: `url(${window.imageUrls[7]})`, backgroundSize: '100%, 100%'}});


// incorrect answers


var CardImage10 = document.querySelectorAll("[data-acc-text='CardImage10']")
TweenLite.set(CardImage10[0], {css: {backgroundImage: `url(${window.imageUrls[9]})`, backgroundSize: '100%, 100%'}});

var CardImage11 = document.querySelectorAll("[data-acc-text='CardImage11']")
TweenLite.set(CardImage11[0], {css: {backgroundImage: `url(${window.imageUrls[10]})`, backgroundSize: '100%, 100%'}});

// audio

window.CardAudio1 = new Audio(url + 'audio/6/' +card_array[1]+'.mp3');
window.CardAudio2 = new Audio(url + 'audio/1/' +card_array[2]+'.mp3');
window.CardAudio3 = new Audio(url + 'audio/6/' +card_array[3]+'.mp3');
window.CardAudio4 = new Audio(url + 'audio/1/' +card_array[4]+'.mp3');
window.CardAudio5 = new Audio(url + 'audio/2/' +card_array[5]+'.mp3');
window.CardAudio6 = new Audio(url + 'audio/6/' +card_array[6]+'.mp3');
window.CardAudio7 = new Audio(url + 'audio/3/' +card_array[7]+'.mp3');
window.CardAudio8 = new Audio(url + 'audio/6/' +card_array[8]+'.mp3');
window.CardAudio9 = new Audio(url + 'audio/4/' +card_array[9]+'.mp3');

window.CardAudio10 = new Audio(url + 'audio/3/' +card_array[10]+'.mp3');
window.CardAudio11 = new Audio(url + 'audio/5/' +card_array[11]+'.mp3');


window.the = new Audio(url+'audio/0/the.mp3');
window.withthe = new Audio(url+'audio/0/withthe.mp3');
window.and = new Audio(url+'audio/0/and.mp3');
window.are = new Audio(url+'audio/0/are.mp3');
window.atthe = new Audio(url+'audio/0/atthe.mp3');
window.something = new Audio(url+'audio/0/something.mp3');


window.sequences = [
    url+'audio/0/the.mp3', 
    url+'audio/6/'+card_array[1]+'.mp3', 
    url+'audio/1/'+card_array[2]+'.mp3', 
    url+'audio/0/and.mp3', 
    url+'audio/6/'+card_array[3]+'.mp3', 
    url+'audio/0/something.mp3', 
    url+'audio/0/are.mp3', 
    url+'audio/0/something.mp3',
    (window.card_array[5] == '25') ? url + 'audio/0/withthe.mp3' : url + 'audio/0/the.mp3', 
    url+'audio/6/'+card_array[6]+'.mp3', 
    url+'audio/3/'+card_array[7]+'.mp3',
    url+'audio/0/atthe.mp3', 
    url+'audio/6/'+card_array[8]+'.mp3', 
    url+'audio/0/something.mp3'
];

var title = "The <b style='color: #7030A0;'>" + player.GetVar("Card1").toLowerCase() + "</b> <b style='color: #FF7E02;'>" + player.GetVar("Card2").toLowerCase() + "</b>" +
  " and <b style='color: #7030A0;'>" + player.GetVar("Card3").toLowerCase() + "</b> <b style='color: #FF7E02;'> ???? </b>" +
  " are <b style='color: #FFC004;'> ???? </b> ";
  
  if (window.card_array[5] == '25')
  title = title + " with the ";
  else 
  title = title + " the ";
    
  title = title + "<b style='color: #7030A0;'>" + player.GetVar("Card6").toLowerCase() + "</b> <b style='color: #77933F;'> " + player.GetVar("Card7").toLowerCase() + " </b>" +
  " at the <b style='color: #7030A0;'>" + player.GetVar("Card8").toLowerCase() + "</b> <b style='color: #0471C0;'> ???? </b>";

var titleComplete = document.querySelectorAll("[data-acc-text='title_complete']")[0];

// Function to dynamically adjust font size
function adjustFontSize() {
    var screenWidth = window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth;

    // Calculate the desired font size based on the screen width
    var fontSize = Math.max(16, screenWidth / 50); // You can adjust the ratio as needed

    // Apply the font size to the titleComplete element
    titleComplete.style.fontSize = fontSize + 'px';
}

// Initial adjustment when the page loads
adjustFontSize();

// Event listener for resizing
window.addEventListener('resize', adjustFontSize);

titleComplete.innerHTML = "<div style='text-align: center; color: #fff; font-family: \"Open Sans\", sans-serif;'>" + title + "</div>";

}

function Script63()
{
  function playAudio(src) {
  var audioElement = new Audio(src);
  audioElement.play();
  return audioElement
}

var player = GetPlayer();

player.SetVar("SpeakerSwitch",'1');

let index = 0

const audioElement = playAudio(sequences[index])
audioElement.addEventListener('ended', (e) => {
  index++
  if (index < sequences.length) {
    audioElement.src = sequences[index]
    audioElement.play();
  }
else
    player.SetVar("SpeakerSwitch",'0');

})
}

function Script64()
{
  CardAudio11.play();
}

function Script65()
{
  console.log("GSAP version: " + gsap.version);

CardAudio11.play();

var player = GetPlayer();

var drop_counter = 0;

var myElement, card, slide;

for (i = 4; i <= 11; i++) {
  card = "data-acc-text='CardImage" + (i) + "'";
  myElement = document.querySelector("[" + card + "]");

  slide = document.getElementById("slide");
  var elementRect = myElement.getBoundingClientRect();
  var elXPos = elementRect.left - slide.getBoundingClientRect().left;
  var elYPos = elementRect.top - slide.getBoundingClientRect().top;

  elXPos = Math.round((elXPos / slide.clientWidth) * 100);
  elYPos = Math.round((elYPos / slide.clientHeight) * 100);
  
  if (elXPos == 59 || elXPos == 69 || elXPos == 77)
  drop_counter = drop_counter + 1;

}

player.SetVar("DropCounter",drop_counter);

}

function Script66()
{
  CardAudio10.play();
}

function Script67()
{
  console.log("GSAP version: " + gsap.version);

CardAudio10.play();

var player = GetPlayer();

var drop_counter = 0;

var myElement, card, slide;

for (i = 4; i <= 11; i++) {
  card = "data-acc-text='CardImage" + (i) + "'";
  myElement = document.querySelector("[" + card + "]");

  slide = document.getElementById("slide");
  var elementRect = myElement.getBoundingClientRect();
  var elXPos = elementRect.left - slide.getBoundingClientRect().left;
  var elYPos = elementRect.top - slide.getBoundingClientRect().top;

  elXPos = Math.round((elXPos / slide.clientWidth) * 100);
  elYPos = Math.round((elYPos / slide.clientHeight) * 100);
  
  if (elXPos == 59 || elXPos == 69 || elXPos == 77)
  drop_counter = drop_counter + 1;
  
}

player.SetVar("DropCounter",drop_counter);

}

function Script68()
{
  CardAudio9.play();
}

function Script69()
{
  console.log("GSAP version: " + gsap.version);

CardAudio9.play();

var player = GetPlayer();

var drop_counter = 0;

var myElement, card, slide;

for (i = 4; i <= 11; i++) {
  card = "data-acc-text='CardImage" + (i) + "'";
  myElement = document.querySelector("[" + card + "]");

  slide = document.getElementById("slide");
  var elementRect = myElement.getBoundingClientRect();
  var elXPos = elementRect.left - slide.getBoundingClientRect().left;
  var elYPos = elementRect.top - slide.getBoundingClientRect().top;

  elXPos = Math.round((elXPos / slide.clientWidth) * 100);
  elYPos = Math.round((elYPos / slide.clientHeight) * 100);
  
  if (elXPos == 59 || elXPos == 69 || elXPos == 77)
  drop_counter = drop_counter + 1;
  
}

player.SetVar("DropCounter",drop_counter);

}

function Script70()
{
  CardAudio5.play();
}

function Script71()
{
  console.log("GSAP version: " + gsap.version);

CardAudio5.play();

var player = GetPlayer();

var drop_counter = 0;

var myElement, card, slide;

for (i = 4; i <= 11; i++) {
  card = "data-acc-text='CardImage" + (i) + "'";
  myElement = document.querySelector("[" + card + "]");

  slide = document.getElementById("slide");
  var elementRect = myElement.getBoundingClientRect();
  var elXPos = elementRect.left - slide.getBoundingClientRect().left;
  var elYPos = elementRect.top - slide.getBoundingClientRect().top;

  elXPos = Math.round((elXPos / slide.clientWidth) * 100);
  elYPos = Math.round((elYPos / slide.clientHeight) * 100);
  
  if (elXPos == 59 || elXPos == 69 || elXPos == 77)
  drop_counter = drop_counter + 1;

}

player.SetVar("DropCounter",drop_counter);

}

function Script72()
{
  CardAudio4.play();
}

function Script73()
{
  console.log("GSAP version: " + gsap.version);

CardAudio4.play();

var player = GetPlayer();

var drop_counter = 0;

var myElement, card, slide;

for (i = 4; i <= 11; i++) {
  card = "data-acc-text='CardImage" + (i) + "'";
  myElement = document.querySelector("[" + card + "]");

  slide = document.getElementById("slide");
  var elementRect = myElement.getBoundingClientRect();
  var elXPos = elementRect.left - slide.getBoundingClientRect().left;
  var elYPos = elementRect.top - slide.getBoundingClientRect().top;

  elXPos = Math.round((elXPos / slide.clientWidth) * 100);
  elYPos = Math.round((elYPos / slide.clientHeight) * 100);
  
  if (elXPos == 59 || elXPos == 69 || elXPos == 77)
  drop_counter = drop_counter + 1;

}

player.SetVar("DropCounter",drop_counter);

}

function Script74()
{
  CardAudio8.play();
}

function Script75()
{
  atthe.play();
}

function Script76()
{
  CardAudio7.play();
}

function Script77()
{
  CardAudio6.play();
}

function Script78()
{
  
if (window.card_array[5] == '25')
withthe.play();
else 
the.play();
}

function Script79()
{
  are.play();
}

function Script80()
{
  CardAudio3.play();
}

function Script81()
{
  and.play();
}

function Script82()
{
  CardAudio2.play();
}

function Script83()
{
  CardAudio1.play();
}

function Script84()
{
  the.play();
}

function Script85()
{
  var player = GetPlayer();

var drop_counter = 0;
player.SetVar("DropCounter",drop_counter);
}

function Script86()
{
  var player = GetPlayer();

console.log("GSAP version: "+TweenLite.version);

var player = GetPlayer();


var CardImageCorrect4 = document.querySelectorAll("[data-acc-text='CardImageCorrect4']")
TweenLite.set(CardImageCorrect4[0], {css: {backgroundImage: `url(${window.imageUrls[3]})`, backgroundSize: '100%, 100%'}});


var CardImageCorrect5 = document.querySelectorAll("[data-acc-text='CardImageCorrect5']")
TweenLite.set(CardImageCorrect5[0], {css: {backgroundImage: `url(${window.imageUrls[4]})`, backgroundSize: '100%, 100%'}});


var CardImageCorrect9 = document.querySelectorAll("[data-acc-text='CardImageCorrect9']")
TweenLite.set(CardImageCorrect9[0], {css: {backgroundImage: `url(${window.imageUrls[8]})`, backgroundSize: '100%, 100%'}});

var drop_counter = 0;
player.SetVar("DropCounter",drop_counter);
}

function Script87()
{
  var player = GetPlayer();

console.log("GSAP version: "+TweenLite.version);

var CardImageCorrect1 = document.querySelectorAll("[data-acc-text='CardImageCorrect1']")
TweenLite.set(CardImageCorrect1[0], {css: {backgroundImage: `url(${window.imageUrls[0]})`, backgroundSize: '100%, 100%'}});

var CardImageCorrect2 = document.querySelectorAll("[data-acc-text='CardImageCorrect2']")
TweenLite.set(CardImageCorrect2[0], {css: {backgroundImage: `url(${window.imageUrls[1]})`, backgroundSize: '100%, 100%'}});

var CardImageCorrect3 = document.querySelectorAll("[data-acc-text='CardImageCorrect3']")
TweenLite.set(CardImageCorrect3[0], {css: {backgroundImage: `url(${window.imageUrls[2]})`, backgroundSize: '100%, 100%'}});

var CardImageCorrect4 = document.querySelectorAll("[data-acc-text='CardImageCorrect4']")
TweenLite.set(CardImageCorrect4[0], {css: {backgroundImage: `url(${window.imageUrls[3]})`, backgroundSize: '100%, 100%'}});

var CardImageCorrect5 = document.querySelectorAll("[data-acc-text='CardImageCorrect5']")
TweenLite.set(CardImageCorrect5[0], {css: {backgroundImage: `url(${window.imageUrls[4]})`, backgroundSize: '100%, 100%'}});

var CardImageCorrect6 = document.querySelectorAll("[data-acc-text='CardImageCorrect6']")
TweenLite.set(CardImageCorrect6[0], {css: {backgroundImage: `url(${window.imageUrls[5]})`, backgroundSize: '100%, 100%'}});

var CardImageCorrect7 = document.querySelectorAll("[data-acc-text='CardImageCorrect7']")
TweenLite.set(CardImageCorrect7[0], {css: {backgroundImage: `url(${window.imageUrls[6]})`, backgroundSize: '100%, 100%'}});

var CardImageCorrect8 = document.querySelectorAll("[data-acc-text='CardImageCorrect8']")
TweenLite.set(CardImageCorrect8[0], {css: {backgroundImage: `url(${window.imageUrls[7]})`, backgroundSize: '100%, 100%'}});

var CardImageCorrect9 = document.querySelectorAll("[data-acc-text='CardImageCorrect9']")
TweenLite.set(CardImageCorrect9[0], {css: {backgroundImage: `url(${window.imageUrls[8]})`, backgroundSize: '100%, 100%'}});



var drop_counter = 0;
player.SetVar("DropCounter",drop_counter);




}

function Script88()
{
  var player = GetPlayer();

var url = player.GetVar("url");

// update answer array

var ans=player.GetVar("AnsArray");

ans = ans + window.card_array[9] + ",";

player.SetVar("AnsArray",ans);


var ans_step = player.GetVar("AnsStepArray");

ans_step = ans_step + player.GetVar("Counter") + ",";

player.SetVar("AnsStepArray",ans_step);



// who answers

var CardImage2 = document.querySelectorAll("[data-acc-text='CardImage2']")
TweenLite.set(CardImage2[0], {css: {backgroundImage: `url(${window.imageUrls[1]})`, backgroundSize: '100%, 100%'}});

// what doing answer

var CardImage5 = document.querySelectorAll("[data-acc-text='CardImage5']")
TweenLite.set(CardImage5[0], {css: {backgroundImage: `url(${window.imageUrls[4]})`, backgroundSize: '100%, 100%'}});

// what answer

var CardImage7 = document.querySelectorAll("[data-acc-text='CardImage7']")
TweenLite.set(CardImage7[0], {css: {backgroundImage: `url(${window.imageUrls[6]})`, backgroundSize: '100%, 100%'}});

// where answers

var CardImage9 = document.querySelectorAll("[data-acc-text='CardImage9']")
TweenLite.set(CardImage9[0], {css: {backgroundImage: `url(${window.imageUrls[8]})`, backgroundSize: '100%, 100%'}});

// describe answers

var CardImage1 = document.querySelectorAll("[data-acc-text='CardImage1']")
TweenLite.set(CardImage1[0], {css: {backgroundImage: `url(${window.imageUrls[0]})`, backgroundSize: '100%, 100%'}});

var CardImage6 = document.querySelectorAll("[data-acc-text='CardImage6']")
TweenLite.set(CardImage6[0], {css: {backgroundImage: `url(${window.imageUrls[5]})`, backgroundSize: '100%, 100%'}});

var CardImage8 = document.querySelectorAll("[data-acc-text='CardImage8']")
TweenLite.set(CardImage8[0], {css: {backgroundImage: `url(${window.imageUrls[7]})`, backgroundSize: '100%, 100%'}});


// incorrect answers


var CardImage10 = document.querySelectorAll("[data-acc-text='CardImage10']")
TweenLite.set(CardImage10[0], {css: {backgroundImage: `url(${window.imageUrls[9]})`, backgroundSize: '100%, 100%'}});

var CardImage11 = document.querySelectorAll("[data-acc-text='CardImage11']")
TweenLite.set(CardImage11[0], {css: {backgroundImage: `url(${window.imageUrls[10]})`, backgroundSize: '100%, 100%'}});

var CardImage12 = document.querySelectorAll("[data-acc-text='CardImage12']")
TweenLite.set(CardImage12[0], {css: {backgroundImage: `url(${window.imageUrls[11]})`, backgroundSize: '100%, 100%'}});

// audio

window.CardAudio1 = new Audio(url + 'audio/6/' +card_array[1]+'.mp3');
window.CardAudio2 = new Audio(url + 'audio/1/' +card_array[2]+'.mp3');
window.CardAudio5 = new Audio(url + 'audio/2/' +card_array[5]+'.mp3');
window.CardAudio6 = new Audio(url + 'audio/6/' +card_array[6]+'.mp3');
window.CardAudio7 = new Audio(url + 'audio/3/' +card_array[7]+'.mp3');
window.CardAudio8 = new Audio(url + 'audio/6/' +card_array[8]+'.mp3');
window.CardAudio9 = new Audio(url + 'audio/4/' +card_array[9]+'.mp3');

window.CardAudio10 = new Audio(url + 'audio/3/' +card_array[10]+'.mp3');
window.CardAudio11 = new Audio(url + 'audio/5/' +card_array[11]+'.mp3');
window.CardAudio12 = new Audio(url + 'audio/6/' +card_array[12]+'.mp3');


window.the = new Audio(url+'audio/0/the.mp3');
window.withthe = new Audio(url+'audio/0/withthe.mp3');
window.is = new Audio(url+'audio/0/is.mp3');
window.atthe = new Audio(url+'audio/0/atthe.mp3');
window.something = new Audio(url+'audio/0/something.mp3');


window.sequences = [
    url + 'audio/0/the.mp3', 
    url + 'audio/6/' + card_array[1] + '.mp3', 
    url + 'audio/1/' + card_array[2] + '.mp3', 
    url + 'audio/0/is.mp3', 
    url + 'audio/0/something.mp3',
    (window.card_array[5] == '25') ? url + 'audio/0/withthe.mp3' : url + 'audio/0/the.mp3', 
    url + 'audio/6/' + card_array[6] + '.mp3', 
    url + 'audio/3/' + card_array[7] + '.mp3',
    url + 'audio/0/atthe.mp3', 
    url + 'audio/6/' + card_array[8] + '.mp3', 
    url + 'audio/0/something.mp3'
];


var title = "The <b style='color: #7030A0;'>" + player.GetVar("Card1").toLowerCase() + "</b> <b style='color: #FF7E02;'>" + player.GetVar("Card2").toLowerCase() + "</b>" +
  " is <b style='color: #FFC004;'> ???? </b>"

if (window.card_array[5] == '25')
title = title + " with the ";
else 
title = title + " the ";

title = title +"<b style='color: #7030A0;'>" + player.GetVar("Card6").toLowerCase() + "</b> <b style='color: #77933F;'> " + player.GetVar("Card7").toLowerCase() + " </b>" +
  " at the <b style='color: #7030A0;'>" + player.GetVar("Card8").toLowerCase() + "</b> <b style='color: #0471C0;'> ???? </b>";

var titleComplete = document.querySelectorAll("[data-acc-text='title_complete']")[0];

// Function to dynamically adjust font size
function adjustFontSize() {
    var screenWidth = window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth;

    // Calculate the desired font size based on the screen width
    var fontSize = Math.max(16, screenWidth / 50); // You can adjust the ratio as needed

    // Apply the font size to the titleComplete element
    titleComplete.style.fontSize = fontSize + 'px';
}

// Initial adjustment when the page loads
adjustFontSize();

// Event listener for resizing
window.addEventListener('resize', adjustFontSize);

titleComplete.innerHTML = "<div style='text-align: center; color: #fff; font-family: \"Open Sans\", sans-serif;'>" + title + "</div>";

}

function Script89()
{
  function playAudio(src) {
  var audioElement = new Audio(src);
  audioElement.play();
  return audioElement
}

var player = GetPlayer();

player.SetVar("SpeakerSwitch",'1');

let index = 0

const audioElement = playAudio(sequences[index])
audioElement.addEventListener('ended', (e) => {
  index++
  if (index < sequences.length) {
    audioElement.src = sequences[index]
    audioElement.play();
  }
else
    player.SetVar("SpeakerSwitch",'0');

})
}

function Script90()
{
  CardAudio12.play();
}

function Script91()
{
  console.log("GSAP version: " + gsap.version);

CardAudio12.play();

var player = GetPlayer();

var drop_counter = 0;

var myElement, card, slide;

for (i = 5; i <= 12; i++) {
  card = "data-acc-text='CardImage" + (i) + "'";
  myElement = document.querySelector("[" + card + "]");

  slide = document.getElementById("slide");
  var elementRect = myElement.getBoundingClientRect();
  var elXPos = elementRect.left - slide.getBoundingClientRect().left;
  var elYPos = elementRect.top - slide.getBoundingClientRect().top;

  elXPos = Math.round((elXPos / slide.clientWidth) * 100);
  elYPos = Math.round((elYPos / slide.clientHeight) * 100);
  
  if (elXPos == 50 || elXPos == 55)
  drop_counter = drop_counter + 1;
  
}

player.SetVar("DropCounter",drop_counter);

}

function Script92()
{
  CardAudio11.play();
}

function Script93()
{
  console.log("GSAP version: " + gsap.version);

CardAudio11.play();

var player = GetPlayer();

var drop_counter = 0;

var myElement, card, slide;

for (i = 5; i <= 12; i++) {
  card = "data-acc-text='CardImage" + (i) + "'";
  myElement = document.querySelector("[" + card + "]");

  slide = document.getElementById("slide");
  var elementRect = myElement.getBoundingClientRect();
  var elXPos = elementRect.left - slide.getBoundingClientRect().left;
  var elYPos = elementRect.top - slide.getBoundingClientRect().top;

  elXPos = Math.round((elXPos / slide.clientWidth) * 100);
  elYPos = Math.round((elYPos / slide.clientHeight) * 100);
  
  if (elXPos == 50 || elXPos == 55)
  drop_counter = drop_counter + 1;
  
}

player.SetVar("DropCounter",drop_counter);

}

function Script94()
{
  CardAudio10.play();
}

function Script95()
{
  console.log("GSAP version: " + gsap.version);

CardAudio10.play();

var player = GetPlayer();

var drop_counter = 0;

var myElement, card, slide;

for (i = 5; i <= 12; i++) {
  card = "data-acc-text='CardImage" + (i) + "'";
  myElement = document.querySelector("[" + card + "]");

  slide = document.getElementById("slide");
  var elementRect = myElement.getBoundingClientRect();
  var elXPos = elementRect.left - slide.getBoundingClientRect().left;
  var elYPos = elementRect.top - slide.getBoundingClientRect().top;

  elXPos = Math.round((elXPos / slide.clientWidth) * 100);
  elYPos = Math.round((elYPos / slide.clientHeight) * 100);
  
  if (elXPos == 50 || elXPos == 55)
  drop_counter = drop_counter + 1;
  
}

player.SetVar("DropCounter",drop_counter);

}

function Script96()
{
  CardAudio9.play();
}

function Script97()
{
  console.log("GSAP version: " + gsap.version);

CardAudio9.play();

var player = GetPlayer();

var drop_counter = 0;

var myElement, card, slide;

for (i = 5; i <= 12; i++) {
  card = "data-acc-text='CardImage" + (i) + "'";
  myElement = document.querySelector("[" + card + "]");

  slide = document.getElementById("slide");
  var elementRect = myElement.getBoundingClientRect();
  var elXPos = elementRect.left - slide.getBoundingClientRect().left;
  var elYPos = elementRect.top - slide.getBoundingClientRect().top;

  elXPos = Math.round((elXPos / slide.clientWidth) * 100);
  elYPos = Math.round((elYPos / slide.clientHeight) * 100);
  
  if (elXPos == 50 || elXPos == 55)
  drop_counter = drop_counter + 1;
  
}

player.SetVar("DropCounter",drop_counter);

}

function Script98()
{
  CardAudio5.play();
}

function Script99()
{
  console.log("GSAP version: " + gsap.version);

CardAudio5.play();

var player = GetPlayer();

var drop_counter = 0;

var myElement, card, slide;

for (i = 5; i <= 12; i++) {
  card = "data-acc-text='CardImage" + (i) + "'";
  myElement = document.querySelector("[" + card + "]");

  slide = document.getElementById("slide");
  var elementRect = myElement.getBoundingClientRect();
  var elXPos = elementRect.left - slide.getBoundingClientRect().left;
  var elYPos = elementRect.top - slide.getBoundingClientRect().top;

  elXPos = Math.round((elXPos / slide.clientWidth) * 100);
  elYPos = Math.round((elYPos / slide.clientHeight) * 100);
  
  if (elXPos == 50 || elXPos == 55)
  drop_counter = drop_counter + 1;
  
}

player.SetVar("DropCounter",drop_counter);

}

function Script100()
{
  CardAudio8.play();
}

function Script101()
{
  atthe.play();
}

function Script102()
{
  CardAudio7.play();
}

function Script103()
{
  CardAudio6.play();
}

function Script104()
{
  
if (window.card_array[5] == '25')
withthe.play();
else 
the.play();
}

function Script105()
{
  is.play();
}

function Script106()
{
  CardAudio2.play();
}

function Script107()
{
  CardAudio1.play();
}

function Script108()
{
  the.play();
}

function Script109()
{
  var player = GetPlayer();

var drop_counter = 0;
player.SetVar("DropCounter",drop_counter);
}

function Script110()
{
  var player = GetPlayer();

console.log("GSAP version: "+TweenLite.version);

var player = GetPlayer();

var CardImageCorrect5 = document.querySelectorAll("[data-acc-text='CardImageCorrect5']")
TweenLite.set(CardImageCorrect5[0], {css: {backgroundImage: `url(${window.imageUrls[4]})`, backgroundSize: '100%, 100%'}});


var CardImageCorrect9 = document.querySelectorAll("[data-acc-text='CardImageCorrect9']")
TweenLite.set(CardImageCorrect9[0], {css: {backgroundImage: `url(${window.imageUrls[8]})`, backgroundSize: '100%, 100%'}});

var drop_counter = 0;
player.SetVar("DropCounter",drop_counter);
}

function Script111()
{
  var player = GetPlayer();

console.log("GSAP version: "+TweenLite.version);

var CardImageCorrect1 = document.querySelectorAll("[data-acc-text='CardImageCorrect1']")
TweenLite.set(CardImageCorrect1[0], {css: {backgroundImage: `url(${window.imageUrls[0]})`, backgroundSize: '100%, 100%'}});

var CardImageCorrect2 = document.querySelectorAll("[data-acc-text='CardImageCorrect2']")
TweenLite.set(CardImageCorrect2[0], {css: {backgroundImage: `url(${window.imageUrls[1]})`, backgroundSize: '100%, 100%'}});

var CardImageCorrect5 = document.querySelectorAll("[data-acc-text='CardImageCorrect5']")
TweenLite.set(CardImageCorrect5[0], {css: {backgroundImage: `url(${window.imageUrls[4]})`, backgroundSize: '100%, 100%'}});

var CardImageCorrect6 = document.querySelectorAll("[data-acc-text='CardImageCorrect6']")
TweenLite.set(CardImageCorrect6[0], {css: {backgroundImage: `url(${window.imageUrls[5]})`, backgroundSize: '100%, 100%'}});

var CardImageCorrect7 = document.querySelectorAll("[data-acc-text='CardImageCorrect7']")
TweenLite.set(CardImageCorrect7[0], {css: {backgroundImage: `url(${window.imageUrls[6]})`, backgroundSize: '100%, 100%'}});

var CardImageCorrect8 = document.querySelectorAll("[data-acc-text='CardImageCorrect8']")
TweenLite.set(CardImageCorrect8[0], {css: {backgroundImage: `url(${window.imageUrls[7]})`, backgroundSize: '100%, 100%'}});

var CardImageCorrect9 = document.querySelectorAll("[data-acc-text='CardImageCorrect9']")
TweenLite.set(CardImageCorrect9[0], {css: {backgroundImage: `url(${window.imageUrls[8]})`, backgroundSize: '100%, 100%'}});



var drop_counter = 0;
player.SetVar("DropCounter",drop_counter);




}

function Script112()
{
  the.play();
}

function Script113()
{
  console.log("GSAP version: "+TweenLite.version);

var player = GetPlayer();

var url=player.GetVar("url");

window.card_array = [];
var who_array = [];
var what_doing_array = [];
var what_array = [];
var where_array = [];
var when_array = [];
var describe_array = [];

var ans_array_numbers, correct_card, card_ans;

var ans_array_str = player.GetVar("AnsArray");
var ans_step_str = player.GetVar("AnsStepArray");


// Convert string values to arrays
var ans_array = ans_array_str.split(",");
var ans_step = ans_step_str.split(",");

if (ans_array_str !== "") {
    // Loop through ans_array
for (var i = 0; i < ans_array.length-1; i++) {

    // Select the corresponding element using data-acc-text attribute
    var card_ans = document.querySelectorAll("[data-acc-text='x" + ans_step[i] + "']");

        var width = card_ans[0].offsetWidth - 8;
        var height = card_ans[0].offsetHeight - 8;
        
        // Apply TweenLite for the current values
        TweenLite.set(card_ans[0], {
            css: {
                backgroundImage: 'url(' + url + 'images/3/' + ans_array[i] + '.png)',
                width: width + 'px',
                height: height + 'px',
                backgroundRepeat: 'no-repeat',
                backgroundSize: '80% 80%',
                backgroundColor: '#fff',
                backgroundPosition: 'center center'
            }
        });

}
}

var item_array=[
["Bird","Who",4,5,6,12],
["Cat","Who",4,5,6],
["Chicken","Who",4,5],
["Crocodile","Who",9,11],
["Dinosaur","Who",2,5,11],
["Dog","Who",5,6,9,10],
["Donkey","Who",11,5],
["Daddy","Who",3,4,17],
["Fish","Who",6,9,12],
["Flamingo","Who",1,5,9,10],
["Girl","Who",3,5,6,17],
["Hippo","Who",2,5,11],
["King","Who",3,4,17],
["Lion","Who",5,9,10,11],
["Mummy","Who",3,4,17],
["Queen","Who",3,4,17],
["Sheep","Who",11,5,9,10],
["Snail","Who",4,6,12],
["Snake","Who",4,6,12],
["Spider","Who",4,6,12],
["Tiger","Who",5,11],
["Eating","WhatDoing",13,14],
["Watching","WhatDoing",13,14],
["Cleaning","WhatDoing",13,14],
["Cooking","WhatDoing",13,14],
["Playing","WhatDoing",13,14],
["Drinking","WhatDoing",13,14],
["Driving","WhatDoing",13,14],
["Giving","WhatDoing",13,14],
["Singing","WhatDoing",13,14],
["Writing","WhatDoing",13,14],
["Flying","WhatDoing",13,14],
["Apple","Eating",1,13,16],
["Banana","Eating",1,13,16],
["Broccoli","Eating",7,16],
["Chips","Eating",1,7,13,16],
["Orange","Eating",1,13,16],
["Pear","Eating",1,13,16],
["Peas","Eating",7,16],
["Pizza","Eating",1,7,13,16],
["Sandwich","Eating",1,7,13,16],
["Boat","Watching",2,5,11,13],
["Train","Watching",2,5,11],
["Lorry","Watching",2,5,11],
["Car","Watching",2,5,11,13],
["Bed","Cleaning",1,11,13],
["Bike","Cleaning",1,5,11],
["Car","Cleaning",1,5,11,13],
["Toys","Cleaning",5,13,14],
["Lorry","Cleaning",1,5,11],
["Sofa","Cleaning",1,11,13],
["Chips","Cooking",1,7,16],
["Peas","Cooking",7,16],
["Pizza","Cooking",1,7,16],
["Broccoli","Cooking",7,16],
["Car","Playing",1,5,11,13],
["Teddy","Playing",1,13,17],
["Lorry","Playing",1,5,11],
["Aeroplane","Playing",1,5,11],
["Boat","Playing",1,5,11,13],
["Computer","Playing",5,13],
["Orange Juice","Drinking",8,13,16],
["Apple Juice","Drinking",8,13,16],
["Fruit Juice","Drinking",8,13,16],
["Pear Juice","Drinking",8,13,16],
["Milk","Drinking",7,8,13,16],
["Water","Drinking",7,8,16],
["Aeroplane","Flying",1,5,11,15],
["Boat","Sailing",2,5,11,13],
["Car","Driving",1,5,11,13],
["Lorry","Driving",1,5,11],
["Train","Driving",2,5,11],
["Present","Giving",11,13,14,15,16],
["Song","Singing",5,6,13,14,15,17],
["Letter","Writing",2,4,17],
["Song","Writing",5,6,13,14,15,17],
["Homework","Writing",2,11],
["Beach","Where",2,7,14],
["Garden","Where",7,8,9,10,14],
["Home","Where",7,14,15],
["School","Where",2,15],
["Police Station","Where",2,15],
["Fire Station","Where",2,15],
["Airport","Where",2,15],
["Park","Where",2,7,8,9,10,14,15],
["Forest","Where",2,7,8,9,10,14],
["Jungle","Where",2,7,9,10,14],
["Grass","Where",3,9,10],
["Hospital","Where",2,15],
["Farm","Where",2,9,15],
["Dinner Time","When",6,14,16],
["Bed Time","When",6,14],
["Autumn Time","When",8,9],
["Winter Time","When",8,9],
["Summer Time","When",7,10],
["Christmas Time","When",8,13,14,17],
["Day Time","When",7,8,9,10],
["Night Time","When",7,8,9,10],
["Birthday","When",13,14,15,17],
["Breakfast","When",14,16],
["Mother’s Day","When",13,14,17]
];



who_array[1]='Bird';
who_array[2]='Cat';
who_array[3]='Chicken';
who_array[4]='Cow';
who_array[5]='Crocodile';
who_array[6]='Dinosaur';
who_array[7]='Dog';
who_array[8]='Donkey';
who_array[9]='Fish';
who_array[10]='Flamingo';
who_array[11]='Hippo';
who_array[12]='Lion';
who_array[13]='Sheep';
who_array[14]='Snail';
who_array[15]='Snake';
who_array[16]='Spider';
who_array[17]='Tiger';
who_array[18]='Daddy';
who_array[19]='Mummy';
who_array[20]='Toddler';
who_array[21]='Baby';
who_array[22]='Girl';
who_array[23]='Queen';
who_array[24]='King';


what_doing_array[1]='Looking';
what_doing_array[2]='Washing';
what_doing_array[3]='Drinking';
what_doing_array[4]='Sleeping';
what_doing_array[5]='Jumping';
what_doing_array[6]='Eating';
what_doing_array[7]='Listening';
what_doing_array[8]='Writing';
what_doing_array[9]='Swimming';
what_doing_array[10]='Flying';
what_doing_array[11]='Kicking';
what_doing_array[12]='Watching';
what_doing_array[13]='Surfing';
what_doing_array[14]='Cleaning';
what_doing_array[15]='Cooking';
what_doing_array[16]='Thinking';
what_doing_array[17]='Walking';
what_doing_array[18]='Singing';
what_doing_array[19]='Climbing';
what_doing_array[20]='Crawling';
what_doing_array[21]='Diving';
what_doing_array[22]='Giving';
what_doing_array[23]='Crying';
what_doing_array[24]='Sailing';
what_doing_array[25]='Playing';
what_doing_array[26]='Driving';



what_array[1]='Pizza';
what_array[2]='Boat';
what_array[3]='Chips';
what_array[4]='Peas';
what_array[5]='Banana';
what_array[6]='Orange';
what_array[7]='Orange Juice';
what_array[8]='Apple';
what_array[9]='Pear';
what_array[10]='Toys';
what_array[11]='Broccoli';
what_array[12]='Burger';
what_array[13]='Computer';
what_array[14]='Aeroplane';
what_array[15]='Train';
what_array[16]='Car';
what_array[17]='Television';
what_array[18]='Lorry';
what_array[19]='Bike';
what_array[20]='Sandwich';
what_array[21]='Toilet';
what_array[22]='Bed';
what_array[23]='Sofa';
what_array[24]='Oven';
what_array[25]='Teddy';
what_array[26]='Apple Juice';
what_array[27]='Fruit Juice';
what_array[28]='Pear Juice';
what_array[29]='Milk';
what_array[30]='Water';
what_array[31]='Present';
what_array[32]='Song';
what_array[33]='Letter';
what_array[34]='Homework';


where_array[1]='Beach';
where_array[2]='Garden';
where_array[3]='Home';
where_array[4]='School';
where_array[5]='Police Station';
where_array[6]='Fire Station';
where_array[7]='Airport';
where_array[8]='Road';
where_array[9]='Park';
where_array[10]='Forest';
where_array[11]='Jungle';
where_array[12]='Sky';
where_array[13]='Grass';
where_array[14]='Hospital';
where_array[15]='Farm';

when_array[1]='Dinner Time';
when_array[2]='Bed Time';
when_array[3]='Autumn Time';
when_array[4]='Winter Time';
when_array[5]='Summer Time';
when_array[6]='Christmas Time';
when_array[7]='Day Time';
when_array[8]='Night Time';
when_array[9]='Morning';
when_array[10]='Birthday';
when_array[11]='Holiday';
when_array[12]='Breakfast';
when_array[13]='Spring';
when_array[14]='Mother’s Day';


describe_array[1]='Large';
describe_array[2]='Huge';
describe_array[3]='Tall';
describe_array[4]='Small';
describe_array[5]='Loud';
describe_array[6]='Quiet';
describe_array[7]='Hot ';
describe_array[8]='Cold';
describe_array[9]='Wet';
describe_array[10]='Dry';
describe_array[11]='Heavy';
describe_array[12]='Light';
describe_array[13]='Best';
describe_array[14]='Brilliant';
describe_array[15]='Noisy';
describe_array[16]='Tasty';
describe_array[17]='Happy';


// Shuffle function to randomly shuffle array elements
function shuffle(array) {
  for (let i = array.length - 1; i > 0; i--) {
    const j = Math.floor(Math.random() * (i + 1));
    [array[i], array[j]] = [array[j], array[i]];
  }
  return array;
}

// Sort routine to keep first two columns intact and randomly sort the rest
item_array.forEach(row => {
  let remainingColumns = row.slice(2); // Extract remaining columns
  remainingColumns = shuffle(remainingColumns); // Randomly shuffle remaining columns
  row.splice(2, remainingColumns.length, ...remainingColumns); // Replace shuffled columns
});

// Group rows by the second column and sort them randomly within each group
const groupedRows = {};
item_array.forEach(row => {
  const group = row[1];
  if (!groupedRows[group]) {
    groupedRows[group] = [];
  }
  groupedRows[group].push(row);
});

Object.values(groupedRows).forEach(group => {
  shuffle(group);
});

// Flatten the grouped and shuffled rows back into item_array
item_array = Object.values(groupedRows).reduce((acc, val) => acc.concat(val), []);

// Update the item_array to contain the filtered results
const groupsProcessed = [];
let whoCount = 0;
item_array = item_array.filter((row, index) => {
  const group = row[1];
  if (group === 'Who') {
    if (whoCount < 2) {
      whoCount++;
      return true;
    } else {
      return false;
    }
  } else {
    if (!groupsProcessed.includes(group)) {
      groupsProcessed.push(group);
      return true;
    } else {
      return false;
    }
  }
});

// New filter based on item_array[2][0]
const categoryToMatch = item_array[2][0];
item_array = item_array.filter((row, index) => {
  if (index >= 2 && index <= 14) {
    return row.includes(categoryToMatch);
  } else {
    return true;
  }
});

// Update item_array to contain only three columns
item_array.forEach(row => {
  row.splice(3); // Remove columns starting from index 3
});


console.log(item_array);



card_array[1] = item_array[0][2];
card_array[2] = who_array.indexOf(item_array[0][0]);
card_array[3] = item_array[1][2];
card_array[4] = who_array.indexOf(item_array[1][0]);
card_array[5] = what_doing_array.indexOf(item_array[2][0]);
card_array[6] = item_array[3][2];
card_array[7] = what_array.indexOf(item_array[3][0]);


for (i = 8; i <= 10; i++) {
do {
rand = Math.floor(Math.random() * 14) + 1;
}
while (card_array.includes(rand));

card_array[i] = rand;

}



window.imageUrls = [
  url + 'images/6/' +card_array[1]+ '.png',
  url + 'images/1/' +card_array[2]+ '.png',
  url + 'images/6/' +card_array[3]+ '.png',
  url + 'images/1/' +card_array[4]+ '.png',
  url + 'images/2/' +card_array[5]+ '.png',
  url + 'images/6/' +card_array[6]+ '.png',
  url + 'images/3/' +card_array[7]+ '.png',
  url + 'images/5/' +card_array[8]+ '.png',
  url + 'images/5/' +card_array[9]+ '.png',
  url + 'images/5/' +card_array[10]+ '.png'
];


// pre-load

for (var i = 0; i < imageUrls.length; i++) {
  var image = new Image();
  image.src = window.imageUrls[i];
}


// set cards


player.SetVar("Card1", describe_array[card_array[1]]);
player.SetVar("Card2", who_array[card_array[2]]);
player.SetVar("Card3", describe_array[card_array[3]]);
player.SetVar("Card4", who_array[card_array[4]]);
player.SetVar("Card5", what_doing_array[card_array[5]]);
player.SetVar("Card6", describe_array[card_array[6]]);
player.SetVar("Card7", what_array[card_array[7]]);

player.SetVar("Card8", when_array [card_array[8]]);
player.SetVar("Card9", when_array [card_array[9]]);
player.SetVar("Card10", when_array [card_array[10]]);



}

function Script114()
{
  var player = GetPlayer();

var url = player.GetVar("url");

// update answer array

var ans=player.GetVar("AnsArray");

ans = ans + window.card_array[7] + ",";

player.SetVar("AnsArray",ans);


var ans_step = player.GetVar("AnsStepArray");

ans_step = ans_step + player.GetVar("Counter") + ",";

player.SetVar("AnsStepArray",ans_step);



// who answers

var CardImage2 = document.querySelectorAll("[data-acc-text='CardImage2']")
TweenLite.set(CardImage2[0], {css: {backgroundImage: `url(${window.imageUrls[1]})`, backgroundSize: '100%, 100%'}});

var CardImage4 = document.querySelectorAll("[data-acc-text='CardImage4']")
TweenLite.set(CardImage4[0], {css: {backgroundImage: `url(${window.imageUrls[3]})`, backgroundSize: '100%, 100%'}});

// what doing answer

var CardImage5 = document.querySelectorAll("[data-acc-text='CardImage5']")
TweenLite.set(CardImage5[0], {css: {backgroundImage: `url(${window.imageUrls[4]})`, backgroundSize: '100%, 100%'}});

// what answer

var CardImage7 = document.querySelectorAll("[data-acc-text='CardImage7']")
TweenLite.set(CardImage7[0], {css: {backgroundImage: `url(${window.imageUrls[6]})`, backgroundSize: '100%, 100%'}});

// describe answers

var CardImage1 = document.querySelectorAll("[data-acc-text='CardImage1']")
TweenLite.set(CardImage1[0], {css: {backgroundImage: `url(${window.imageUrls[0]})`, backgroundSize: '100%, 100%'}});

var CardImage3 = document.querySelectorAll("[data-acc-text='CardImage3']")
TweenLite.set(CardImage3[0], {css: {backgroundImage: `url(${window.imageUrls[2]})`, backgroundSize: '100%, 100%'}});

var CardImage6 = document.querySelectorAll("[data-acc-text='CardImage6']")
TweenLite.set(CardImage6[0], {css: {backgroundImage: `url(${window.imageUrls[5]})`, backgroundSize: '100%, 100%'}});


// incorrect answers


var CardImage8 = document.querySelectorAll("[data-acc-text='CardImage8']")
TweenLite.set(CardImage8[0], {css: {backgroundImage: `url(${window.imageUrls[7]})`, backgroundSize: '100%, 100%'}});

var CardImage9 = document.querySelectorAll("[data-acc-text='CardImage9']")
TweenLite.set(CardImage9[0], {css: {backgroundImage: `url(${window.imageUrls[8]})`, backgroundSize: '100%, 100%'}});


var CardImage10 = document.querySelectorAll("[data-acc-text='CardImage10']")
TweenLite.set(CardImage10[0], {css: {backgroundImage: `url(${window.imageUrls[9]})`, backgroundSize: '100%, 100%'}});

// audio

window.CardAudio1 = new Audio(url + 'audio/6/' +card_array[1]+'.mp3');
window.CardAudio2 = new Audio(url + 'audio/1/' +card_array[2]+'.mp3');
window.CardAudio3 = new Audio(url + 'audio/6/' +card_array[3]+'.mp3');
window.CardAudio4 = new Audio(url + 'audio/1/' +card_array[4]+'.mp3');
window.CardAudio5 = new Audio(url + 'audio/2/' +card_array[5]+'.mp3');
window.CardAudio6 = new Audio(url + 'audio/6/' +card_array[6]+'.mp3');
window.CardAudio7 = new Audio(url + 'audio/3/' +card_array[7]+'.mp3');
window.CardAudio8 = new Audio(url + 'audio/5/' +card_array[8]+'.mp3');
window.CardAudio9 = new Audio(url + 'audio/5/' +card_array[9]+'.mp3');
window.CardAudio10 = new Audio(url + 'audio/5/' +card_array[10]+'.mp3');


window.and = new Audio(url+'audio/0/and.mp3');
window.the = new Audio(url+'audio/0/the.mp3');
window.are = new Audio(url+'audio/0/are.mp3');
window.something = new Audio(url+'audio/0/something.mp3');


window.sequences = [
    url+'audio/0/the.mp3', 
    url+'audio/6/'+card_array[1]+'.mp3', 
    url+'audio/1/'+card_array[2]+'.mp3', 
    url+'audio/0/and.mp3', 
    url+'audio/6/'+card_array[3]+'.mp3', 
    url+'audio/0/something.mp3',
    url+'audio/0/are.mp3', 
    url+'audio/2/'+card_array[5]+'.mp3',
    url+'audio/0/the.mp3', 
    url+'audio/6/'+card_array[6]+'.mp3', 
    url+'audio/0/something.mp3'
];

var title = "The <b style='color: #7030A0;'>" + player.GetVar("Card1").toLowerCase() + "</b> <b style='color: #FF7E02;'>" + player.GetVar("Card2").toLowerCase() + "</b>" +
  " and <b style='color: #7030A0;'>" + player.GetVar("Card3").toLowerCase() + "</b> <b style='color: #FF7E02;'> ???? </b>" +
  " are <b style='color: #FFC004;'>" + player.GetVar("Card5").toLowerCase() + "</b>" +
  " the <b style='color: #7030A0;'>" + player.GetVar("Card6").toLowerCase() + "</b> <b style='color: #77933F;'> ???? </b>";

var titleComplete = document.querySelectorAll("[data-acc-text='title_complete']")[0];

// Function to dynamically adjust font size
function adjustFontSize() {
    var screenWidth = window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth;

    // Calculate the desired font size based on the screen width
    var fontSize = Math.max(16, screenWidth / 50); // You can adjust the ratio as needed

    // Apply the font size to the titleComplete element
    titleComplete.style.fontSize = fontSize + 'px';
}

// Initial adjustment when the page loads
adjustFontSize();

// Event listener for resizing
window.addEventListener('resize', adjustFontSize);

titleComplete.innerHTML = "<div style='text-align: center; color: #fff; font-family: \"Open Sans\", sans-serif;'>" + title + "</div>";

}

function Script115()
{
  function playAudio(src) {
  var audioElement = new Audio(src);
  audioElement.play();
  return audioElement
}

var player = GetPlayer();

player.SetVar("SpeakerSwitch",'1');

let index = 0

const audioElement = playAudio(sequences[index])
audioElement.addEventListener('ended', (e) => {
  index++
  if (index < sequences.length) {
    audioElement.src = sequences[index]
    audioElement.play();
  }
else
    player.SetVar("SpeakerSwitch",'0');

})
}

function Script116()
{
  CardAudio10.play();
}

function Script117()
{
  console.log("GSAP version: " + gsap.version);

CardAudio10.play();

var player = GetPlayer();

var drop_counter = 0;

var myElement, card, slide;
player.SetVar("DropCounter",drop_counter);

for (i = 4; i <= 10; i++) {
  card = "data-acc-text='CardImage" + (i) + "'";
  myElement = document.querySelector("[" + card + "]");

  slide = document.getElementById("slide");
  var elementRect = myElement.getBoundingClientRect();
  var elXPos = elementRect.left - slide.getBoundingClientRect().left;
  var elYPos = elementRect.top - slide.getBoundingClientRect().top;

  elXPos = Math.round((elXPos / slide.clientWidth) * 100);
  elYPos = Math.round((elYPos / slide.clientHeight) * 100);
  
  if (elXPos == 68 || elXPos == 63)
  drop_counter = drop_counter + 1;
  
}

player.SetVar("DropCounter",drop_counter);
}

function Script118()
{
  CardAudio9.play();
}

function Script119()
{
  console.log("GSAP version: " + gsap.version);

CardAudio9.play();

var player = GetPlayer();

var drop_counter = 0;

var myElement, card, slide;

for (i = 4; i <= 10; i++) {
  card = "data-acc-text='CardImage" + (i) + "'";
  myElement = document.querySelector("[" + card + "]");

  slide = document.getElementById("slide");
  var elementRect = myElement.getBoundingClientRect();
  var elXPos = elementRect.left - slide.getBoundingClientRect().left;
  var elYPos = elementRect.top - slide.getBoundingClientRect().top;

  elXPos = Math.round((elXPos / slide.clientWidth) * 100);
  elYPos = Math.round((elYPos / slide.clientHeight) * 100);
  
  if (elXPos == 68 || elXPos == 63)
  drop_counter = drop_counter + 1;
  
}

player.SetVar("DropCounter",drop_counter);

}

function Script120()
{
  CardAudio8.play();
}

function Script121()
{
  console.log("GSAP version: " + gsap.version);

CardAudio8.play();

var player = GetPlayer();

var drop_counter = 0;

var myElement, card, slide;

for (i = 4; i <= 10; i++) {
  card = "data-acc-text='CardImage" + (i) + "'";
  myElement = document.querySelector("[" + card + "]");

  slide = document.getElementById("slide");
  var elementRect = myElement.getBoundingClientRect();
  var elXPos = elementRect.left - slide.getBoundingClientRect().left;
  var elYPos = elementRect.top - slide.getBoundingClientRect().top;

  elXPos = Math.round((elXPos / slide.clientWidth) * 100);
  elYPos = Math.round((elYPos / slide.clientHeight) * 100);
  
  if (elXPos == 68 || elXPos == 63)
  drop_counter = drop_counter + 1;
  
}

player.SetVar("DropCounter",drop_counter);

}

function Script122()
{
  CardAudio7.play();
}

function Script123()
{
  console.log("GSAP version: " + gsap.version);

CardAudio7.play();

var player = GetPlayer();

var drop_counter = 0;

var myElement, card, slide;

for (i = 4; i <= 10; i++) {
  card = "data-acc-text='CardImage" + (i) + "'";
  myElement = document.querySelector("[" + card + "]");

  slide = document.getElementById("slide");
  var elementRect = myElement.getBoundingClientRect();
  var elXPos = elementRect.left - slide.getBoundingClientRect().left;
  var elYPos = elementRect.top - slide.getBoundingClientRect().top;

  elXPos = Math.round((elXPos / slide.clientWidth) * 100);
  elYPos = Math.round((elYPos / slide.clientHeight) * 100);
  
  if (elXPos == 68 || elXPos == 63)
  drop_counter = drop_counter + 1;
  
}

player.SetVar("DropCounter",drop_counter);

}

function Script124()
{
  CardAudio4.play();
}

function Script125()
{
  console.log("GSAP version: " + gsap.version);

CardAudio4.play();

var player = GetPlayer();

var drop_counter = 0;

var myElement, card, slide;

for (i = 4; i <= 10; i++) {
  card = "data-acc-text='CardImage" + (i) + "'";
  myElement = document.querySelector("[" + card + "]");

  slide = document.getElementById("slide");
  var elementRect = myElement.getBoundingClientRect();
  var elXPos = elementRect.left - slide.getBoundingClientRect().left;
  var elYPos = elementRect.top - slide.getBoundingClientRect().top;

  elXPos = Math.round((elXPos / slide.clientWidth) * 100);
  elYPos = Math.round((elYPos / slide.clientHeight) * 100);
  
  if (elXPos == 68 || elXPos == 63)
  drop_counter = drop_counter + 1;
  
}

player.SetVar("DropCounter",drop_counter);

}

function Script126()
{
  CardAudio6.play();
}

function Script127()
{
  the.play();
}

function Script128()
{
  CardAudio5.play();
}

function Script129()
{
  are.play();
}

function Script130()
{
  CardAudio3.play();
}

function Script131()
{
  and.play();
}

function Script132()
{
  CardAudio2.play();
}

function Script133()
{
  CardAudio1.play();
}

function Script134()
{
  the.play();
}

function Script135()
{
  var player = GetPlayer();

var drop_counter = 0;
player.SetVar("DropCounter",drop_counter);
}

function Script136()
{
  var player = GetPlayer();

console.log("GSAP version: "+TweenLite.version);

var player = GetPlayer();

var CardImageCorrect1 = document.querySelectorAll("[data-acc-text='CardImageCorrect1']")
TweenLite.set(CardImageCorrect1[0], {css: {backgroundImage: `url(${window.imageUrls[4]})`, backgroundSize: '100%, 100%'}});


var CardImageCorrect2 = document.querySelectorAll("[data-acc-text='CardImageCorrect2']")
TweenLite.set(CardImageCorrect2[0], {css: {backgroundImage: `url(${window.imageUrls[7]})`, backgroundSize: '100%, 100%'}});

var drop_counter = 0;
player.SetVar("DropCounter",drop_counter);
}

function Script137()
{
  var player = GetPlayer();

console.log("GSAP version: "+TweenLite.version);

var CardImageCorrect1 = document.querySelectorAll("[data-acc-text='CardImageCorrect1']")
TweenLite.set(CardImageCorrect1[0], {css: {backgroundImage: `url(${window.imageUrls[0]})`, backgroundSize: '100%, 100%'}});

var CardImageCorrect2 = document.querySelectorAll("[data-acc-text='CardImageCorrect2']")
TweenLite.set(CardImageCorrect2[0], {css: {backgroundImage: `url(${window.imageUrls[1]})`, backgroundSize: '100%, 100%'}});

var CardImageCorrect3 = document.querySelectorAll("[data-acc-text='CardImageCorrect3']")
TweenLite.set(CardImageCorrect3[0], {css: {backgroundImage: `url(${window.imageUrls[2]})`, backgroundSize: '100%, 100%'}});

var CardImageCorrect4 = document.querySelectorAll("[data-acc-text='CardImageCorrect4']")
TweenLite.set(CardImageCorrect4[0], {css: {backgroundImage: `url(${window.imageUrls[3]})`, backgroundSize: '100%, 100%'}});

var CardImageCorrect5 = document.querySelectorAll("[data-acc-text='CardImageCorrect5']")
TweenLite.set(CardImageCorrect5[0], {css: {backgroundImage: `url(${window.imageUrls[4]})`, backgroundSize: '100%, 100%'}});

var CardImageCorrect6 = document.querySelectorAll("[data-acc-text='CardImageCorrect6']")
TweenLite.set(CardImageCorrect6[0], {css: {backgroundImage: `url(${window.imageUrls[5]})`, backgroundSize: '100%, 100%'}});

var CardImageCorrect7 = document.querySelectorAll("[data-acc-text='CardImageCorrect7']")
TweenLite.set(CardImageCorrect7[0], {css: {backgroundImage: `url(${window.imageUrls[6]})`, backgroundSize: '100%, 100%'}});

var drop_counter = 0;
player.SetVar("DropCounter",drop_counter);




}

function Script138()
{
  var player = GetPlayer();

var url = player.GetVar("url");

// update answer array

var ans=player.GetVar("AnsArray");

ans = ans + window.card_array[7] + ",";

player.SetVar("AnsArray",ans);


var ans_step = player.GetVar("AnsStepArray");

ans_step = ans_step + player.GetVar("Counter") + ",";

player.SetVar("AnsStepArray",ans_step);



// who answers

var CardImage2 = document.querySelectorAll("[data-acc-text='CardImage2']")
TweenLite.set(CardImage2[0], {css: {backgroundImage: `url(${window.imageUrls[1]})`, backgroundSize: '100%, 100%'}});

// what doing answer

var CardImage5 = document.querySelectorAll("[data-acc-text='CardImage5']")
TweenLite.set(CardImage5[0], {css: {backgroundImage: `url(${window.imageUrls[4]})`, backgroundSize: '100%, 100%'}});

// what answer

var CardImage7 = document.querySelectorAll("[data-acc-text='CardImage7']")
TweenLite.set(CardImage7[0], {css: {backgroundImage: `url(${window.imageUrls[6]})`, backgroundSize: '100%, 100%'}});

// describe answers

var CardImage1 = document.querySelectorAll("[data-acc-text='CardImage1']")
TweenLite.set(CardImage1[0], {css: {backgroundImage: `url(${window.imageUrls[0]})`, backgroundSize: '100%, 100%'}});

var CardImage6 = document.querySelectorAll("[data-acc-text='CardImage6']")
TweenLite.set(CardImage6[0], {css: {backgroundImage: `url(${window.imageUrls[5]})`, backgroundSize: '100%, 100%'}});


// incorrect answers


var CardImage8 = document.querySelectorAll("[data-acc-text='CardImage8']")
TweenLite.set(CardImage8[0], {css: {backgroundImage: `url(${window.imageUrls[7]})`, backgroundSize: '100%, 100%'}});

var CardImage9 = document.querySelectorAll("[data-acc-text='CardImage9']")
TweenLite.set(CardImage9[0], {css: {backgroundImage: `url(${window.imageUrls[8]})`, backgroundSize: '100%, 100%'}});


var CardImage10 = document.querySelectorAll("[data-acc-text='CardImage10']")
TweenLite.set(CardImage10[0], {css: {backgroundImage: `url(${window.imageUrls[9]})`, backgroundSize: '100%, 100%'}});

// audio

window.CardAudio1 = new Audio(url + 'audio/6/' +card_array[1]+'.mp3');
window.CardAudio2 = new Audio(url + 'audio/1/' +card_array[2]+'.mp3');
window.CardAudio5 = new Audio(url + 'audio/2/' +card_array[5]+'.mp3');
window.CardAudio6 = new Audio(url + 'audio/6/' +card_array[6]+'.mp3');
window.CardAudio7 = new Audio(url + 'audio/3/' +card_array[7]+'.mp3');
window.CardAudio8 = new Audio(url + 'audio/5/' +card_array[8]+'.mp3');
window.CardAudio9 = new Audio(url + 'audio/5/' +card_array[9]+'.mp3');
window.CardAudio10 = new Audio(url + 'audio/5/' +card_array[10]+'.mp3');


window.and = new Audio(url+'audio/0/and.mp3');
window.the = new Audio(url+'audio/0/the.mp3');
window.is = new Audio(url+'audio/0/is.mp3');
window.something = new Audio(url+'audio/0/something.mp3');


window.sequences = [
    url+'audio/0/the.mp3', 
    url+'audio/6/'+card_array[1]+'.mp3', 
    url+'audio/1/'+card_array[2]+'.mp3', 
    url+'audio/0/is.mp3', 
    url+'audio/2/'+card_array[5]+'.mp3',
    url+'audio/0/the.mp3', 
    url+'audio/6/'+card_array[6]+'.mp3', 
    url+'audio/0/something.mp3'
];

var title = "The <b style='color: #7030A0;'>" + player.GetVar("Card1").toLowerCase() + "</b> <b style='color: #FF7E02;'>" + player.GetVar("Card2").toLowerCase() + "</b>" +
  " is <b style='color: #FFC004;'>" + player.GetVar("Card5").toLowerCase() + "</b>" +
  " the <b style='color: #7030A0;'>" + player.GetVar("Card6").toLowerCase() + "</b> <b style='color: #77933F;'> ???? </b>";

var titleComplete = document.querySelectorAll("[data-acc-text='title_complete']")[0];

// Function to dynamically adjust font size
function adjustFontSize() {
    var screenWidth = window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth;

    // Calculate the desired font size based on the screen width
    var fontSize = Math.max(16, screenWidth / 50); // You can adjust the ratio as needed

    // Apply the font size to the titleComplete element
    titleComplete.style.fontSize = fontSize + 'px';
}

// Initial adjustment when the page loads
adjustFontSize();

// Event listener for resizing
window.addEventListener('resize', adjustFontSize);

titleComplete.innerHTML = "<div style='text-align: center; color: #fff; font-family: \"Open Sans\", sans-serif;'>" + title + "</div>";

}

function Script139()
{
  function playAudio(src) {
  var audioElement = new Audio(src);
  audioElement.play();
  return audioElement
}

var player = GetPlayer();

player.SetVar("SpeakerSwitch",'1');

let index = 0

const audioElement = playAudio(sequences[index])
audioElement.addEventListener('ended', (e) => {
  index++
  if (index < sequences.length) {
    audioElement.src = sequences[index]
    audioElement.play();
  }
else
    player.SetVar("SpeakerSwitch",'0');

})
}

function Script140()
{
  CardAudio10.play();
}

function Script141()
{
  console.log("GSAP version: " + gsap.version);

CardAudio10.play();

var player = GetPlayer();

var drop_counter = 0;

var myElement, card, slide;

  myElement = document.querySelector("[data-acc-text='CardImage10']");

  slide = document.getElementById("slide");
  var elementRect = myElement.getBoundingClientRect();
  var elXPos = elementRect.left - slide.getBoundingClientRect().left;

  elXPos = Math.round((elXPos / slide.clientWidth) * 100);
  
  if (elXPos == 77)
  drop_counter = drop_counter + 1;
  


player.SetVar("DropCounter",drop_counter);
}

function Script142()
{
  CardAudio9.play();
}

function Script143()
{
  console.log("GSAP version: " + gsap.version);

CardAudio9.play();

var player = GetPlayer();

var drop_counter = 0;

var myElement, card, slide;

  myElement = document.querySelector("[data-acc-text='CardImage9']");

  slide = document.getElementById("slide");
  var elementRect = myElement.getBoundingClientRect();
  var elXPos = elementRect.left - slide.getBoundingClientRect().left;

  elXPos = Math.round((elXPos / slide.clientWidth) * 100);
  
  if (elXPos == 77)
  drop_counter = drop_counter + 1;
  


player.SetVar("DropCounter",drop_counter);
}

function Script144()
{
  CardAudio8.play();
}

function Script145()
{
  console.log("GSAP version: " + gsap.version);

CardAudio8.play();

var player = GetPlayer();

var drop_counter = 0;

var myElement, card, slide;

  myElement = document.querySelector("[data-acc-text='CardImage8']");

  slide = document.getElementById("slide");
  var elementRect = myElement.getBoundingClientRect();
  var elXPos = elementRect.left - slide.getBoundingClientRect().left;

  elXPos = Math.round((elXPos / slide.clientWidth) * 100);
  
  if (elXPos == 77)
  drop_counter = drop_counter + 1;
  

player.SetVar("DropCounter",drop_counter);

}

function Script146()
{
  CardAudio7.play();
}

function Script147()
{
  console.log("GSAP version: " + gsap.version);

CardAudio7.play();

var player = GetPlayer();

var drop_counter = 0;

var myElement, card, slide;

  myElement = document.querySelector("[data-acc-text='CardImage7']");

  slide = document.getElementById("slide");
  var elementRect = myElement.getBoundingClientRect();
  var elXPos = elementRect.left - slide.getBoundingClientRect().left;

  elXPos = Math.round((elXPos / slide.clientWidth) * 100);
  
  if (elXPos == 77)
  drop_counter = drop_counter + 1;
  


player.SetVar("DropCounter",drop_counter);

}

function Script148()
{
  CardAudio6.play();
}

function Script149()
{
  the.play();
}

function Script150()
{
  CardAudio5.play();
}

function Script151()
{
  is.play();
}

function Script152()
{
  CardAudio2.play();
}

function Script153()
{
  CardAudio1.play();
}

function Script154()
{
  the.play();
}

function Script155()
{
  var player = GetPlayer();

var drop_counter = 0;
player.SetVar("DropCounter",drop_counter);
}

function Script156()
{
  var player = GetPlayer();

console.log("GSAP version: "+TweenLite.version);

var player = GetPlayer();

var CardImageCorrect7 = document.querySelectorAll("[data-acc-text='CardImageCorrect7']")
TweenLite.set(CardImageCorrect7[0], {css: {backgroundImage: `url(${window.imageUrls[6]})`, backgroundSize: '100%, 100%'}});

var drop_counter = 0;
player.SetVar("DropCounter",drop_counter);
}

function Script157()
{
  var player = GetPlayer();

console.log("GSAP version: "+TweenLite.version);

var CardImageCorrect1 = document.querySelectorAll("[data-acc-text='CardImageCorrect1']")
TweenLite.set(CardImageCorrect1[0], {css: {backgroundImage: `url(${window.imageUrls[0]})`, backgroundSize: '100%, 100%'}});

var CardImageCorrect2 = document.querySelectorAll("[data-acc-text='CardImageCorrect2']")
TweenLite.set(CardImageCorrect2[0], {css: {backgroundImage: `url(${window.imageUrls[1]})`, backgroundSize: '100%, 100%'}});

var CardImageCorrect5 = document.querySelectorAll("[data-acc-text='CardImageCorrect5']")
TweenLite.set(CardImageCorrect5[0], {css: {backgroundImage: `url(${window.imageUrls[4]})`, backgroundSize: '100%, 100%'}});

var CardImageCorrect6 = document.querySelectorAll("[data-acc-text='CardImageCorrect6']")
TweenLite.set(CardImageCorrect6[0], {css: {backgroundImage: `url(${window.imageUrls[5]})`, backgroundSize: '100%, 100%'}});

var CardImageCorrect7 = document.querySelectorAll("[data-acc-text='CardImageCorrect7']")
TweenLite.set(CardImageCorrect7[0], {css: {backgroundImage: `url(${window.imageUrls[6]})`, backgroundSize: '100%, 100%'}});

var drop_counter = 0;
player.SetVar("DropCounter",drop_counter);




}

function Script158()
{
  console.log("GSAP version: "+TweenLite.version);

var player = GetPlayer();

var url=player.GetVar("url");

window.card_array = [];
var who_array = [];
var what_doing_array = [];
var what_array = [];
var where_array = [];
var when_array = [];
var describe_array = [];

var ans_array_numbers, correct_card, card_ans;

var ans_array_str = player.GetVar("AnsArray");
var ans_step_str = player.GetVar("AnsStepArray");


// Convert string values to arrays
var ans_array = ans_array_str.split(",");
var ans_step = ans_step_str.split(",");

if (ans_array_str !== "") {
    // Loop through ans_array
for (var i = 0; i < ans_array.length-1; i++) {

    // Select the corresponding element using data-acc-text attribute
    var card_ans = document.querySelectorAll("[data-acc-text='x" + ans_step[i] + "']");

        var width = card_ans[0].offsetWidth - 8;
        var height = card_ans[0].offsetHeight - 8;
        
        // Apply TweenLite for the current values
        TweenLite.set(card_ans[0], {
            css: {
                backgroundImage: 'url(' + url + 'images/2/' + ans_array[i] + '.png)',
                width: width + 'px',
                height: height + 'px',
                backgroundRepeat: 'no-repeat',
                backgroundSize: '80% 80%',
                backgroundColor: '#fff',
                backgroundPosition: 'center center'
            }
        });

}
}

var item_array=[
["Bird",4,5,6,12],
["Cat",4,5,6],
["Chicken",4,5],
["Cow",1,4],
["Crocodile",1,11],
["Dinosaur",2,5,11],
["Dog",1,5,6],
["Donkey",1,5],
["Daddy",3,17],
["Fish",6,12],
["Flamingo",1,5],
["Girl",3,5,6,17],
["Hippo",2,5,11],
["King",3,17],
["Lion",1,5],
["Baby",4,5,17],
["Mummy",3,17],
["Queen",3,17],
["Sheep",1,5],
["Snail",4,6,12],
["Snake",4,6,12],
["Spider",4,6,12],
["Tiger",1,5,11],
["Toddler",4,5,17],
];

who_array[1]='Bird';
who_array[2]='Cat';
who_array[3]='Chicken';
who_array[4]='Cow';
who_array[5]='Crocodile';
who_array[6]='Dinosaur';
who_array[7]='Dog';
who_array[8]='Donkey';
who_array[9]='Fish';
who_array[10]='Flamingo';
who_array[11]='Hippo';
who_array[12]='Lion';
who_array[13]='Sheep';
who_array[14]='Snail';
who_array[15]='Snake';
who_array[16]='Spider';
who_array[17]='Tiger';
who_array[18]='Daddy';
who_array[19]='Mummy';
who_array[20]='Toddler';
who_array[21]='Baby';
who_array[22]='Girl';
who_array[23]='Queen';
who_array[24]='King';


what_doing_array[1]='Looking';
what_doing_array[2]='Washing';
what_doing_array[3]='Drinking';
what_doing_array[4]='Sleeping';
what_doing_array[5]='Jumping';
what_doing_array[6]='Eating';
what_doing_array[7]='Listening';
what_doing_array[8]='Writing';
what_doing_array[9]='Swimming';
what_doing_array[10]='Flying';
what_doing_array[11]='Kicking';
what_doing_array[12]='Watching';
what_doing_array[13]='Surfing';
what_doing_array[14]='Cleaning';
what_doing_array[15]='Cooking';
what_doing_array[16]='Thinking';
what_doing_array[17]='Walking';
what_doing_array[18]='Singing';
what_doing_array[19]='Climbing';
what_doing_array[20]='Crawling';
what_doing_array[21]='Diving';
what_doing_array[22]='Giving';
what_doing_array[23]='Crying';
what_doing_array[24]='Sailing';



what_array[1]='Pizza';
what_array[2]='Boat';
what_array[3]='Chips';
what_array[4]='Peas';
what_array[5]='Banana';
what_array[6]='Orange';
what_array[7]='Orange Juice';
what_array[8]='Apple';
what_array[9]='Pear';
what_array[10]='Toys';
what_array[11]='Broccoli';
what_array[12]='Burger';
what_array[13]='Computer';
what_array[14]='Aeroplane';
what_array[15]='Train';
what_array[16]='Car';
what_array[17]='Television';
what_array[18]='Lorry';
what_array[19]='Bike';
what_array[20]='Sandwich';
what_array[21]='Toilet';
what_array[22]='Bed';
what_array[23]='Sofa';
what_array[24]='Oven';
what_array[25]='Teddy';


where_array[1]='Beach';
where_array[2]='Garden';
where_array[3]='Home';
where_array[4]='School';
where_array[5]='Police Station';
where_array[6]='Fire Station';
where_array[7]='Airport';
where_array[8]='Road';
where_array[9]='Park';
where_array[10]='Forest';
where_array[11]='Jungle';
where_array[12]='Sky';
where_array[13]='Grass';
where_array[14]='Hospital';


when_array[1]='Dinner Time';
when_array[2]='Bed Time';
when_array[3]='Autumn';
when_array[4]='Winter';
when_array[5]='Summer';
when_array[6]='Christmas';
when_array[7]='Day';
when_array[8]='Night';
when_array[9]='Morning';
when_array[10]='Birthday';
when_array[11]='Holiday';
when_array[12]='Breakfast';
when_array[13]='Spring';
when_array[14]='Mother’s Day';


describe_array[1]='Large';
describe_array[2]='Huge';
describe_array[3]='Tall';
describe_array[4]='Small';
describe_array[5]='Loud';
describe_array[6]='Quiet';
describe_array[7]='Hot ';
describe_array[8]='Cold';
describe_array[9]='Wet';
describe_array[10]='Dry';
describe_array[11]='Heavy';
describe_array[12]='Light';
describe_array[13]='Best';
describe_array[14]='Brilliant';
describe_array[15]='Noisy';
describe_array[16]='Tasty';
describe_array[17]='Happy';


let uniqueSecondColumnValues = new Set();

// Keep shuffling until unique values are found
while (true) {
    // Random sorting within each row
    item_array = item_array.map(row => [row[0], ...row.slice(1).sort(() => Math.random() - 0.5)]);

    // Random shuffling of rows
    item_array = item_array.sort(() => Math.random() - 0.5);

    // Clear the set for each iteration
    uniqueSecondColumnValues.clear();

    // Filter and break the loop if unique values are found
    const uniqueRows = item_array.filter(row => {
        const value = row[1];
        if (!uniqueSecondColumnValues.has(value)) {
            uniqueSecondColumnValues.add(value);
            return true;
        }
        return false;
    });

    // Break the loop if there are at least 2 unique rows
    if (uniqueRows.length >= 2) {
        item_array = uniqueRows.slice(0, 2);
        break;
    }
}

// Keeping only the first two columns
item_array = item_array.map(row => row.slice(0, 2));

var rand_what_doing = Math.floor(Math.random() * 24) + 1;
item_array.push([what_doing_array[rand_what_doing], rand_what_doing]);

console.log(item_array);



card_array[1] = item_array[0][1];
card_array[2] = who_array.indexOf(item_array[0][0]);
card_array[3] = item_array[1][1];
card_array[4] = who_array.indexOf(item_array[1][0]);
card_array[5] = what_doing_array.indexOf(item_array[2][0]);


for (i = 6; i <= 9; i++) {
do {
rand = Math.floor(Math.random() * 14) + 1;
}
while (card_array.includes(rand));

card_array[i] = rand;

}



window.imageUrls = [
  url + 'images/6/' +card_array[1]+ '.png',
  url + 'images/1/' +card_array[2]+ '.png',
  url + 'images/6/' +card_array[3]+ '.png',
  url + 'images/1/' +card_array[4]+ '.png',
  url + 'images/2/' +card_array[5]+ '.png',
  url + 'images/1/' +card_array[6]+ '.png',
  url + 'images/3/' +card_array[7]+ '.png',
  url + 'images/4/' +card_array[8]+ '.png',
  url + 'images/5/' +card_array[9]+ '.png'
];


// pre-load

for (var i = 0; i < imageUrls.length; i++) {
  var image = new Image();
  image.src = window.imageUrls[i];
}


// set cards


player.SetVar("Card1", describe_array[card_array[1]]);
player.SetVar("Card2", who_array[card_array[2]]);
player.SetVar("Card3", describe_array[card_array[3]]);
player.SetVar("Card4", who_array[card_array[4]]);
player.SetVar("Card5", what_doing_array[card_array[5]]);

player.SetVar("Card6", who_array[card_array[6]]);
player.SetVar("Card7", what_array [card_array[7]]);
player.SetVar("Card8", where_array [card_array[8]]);
player.SetVar("Card9", when_array [card_array[9]]);



}

function Script159()
{
  var player = GetPlayer();

var url=player.GetVar("url");
var card_colour = 1


var CorrectCardImage1 = document.querySelectorAll("[data-acc-text='CorrectCardImage1']")

TweenLite.set(CorrectCardImage1[0], {css:{backgroundImage:'url('+url+'images/'+card_colour+'/'+window.card_array[0]+'.png)', backgroundSize:'100%, 100%'}});


var CorrectCardImage2 = document.querySelectorAll("[data-acc-text='CorrectCardImage2']")

TweenLite.set(CorrectCardImage2[0], {css:{backgroundImage:'url('+url+'images/'+card_colour+'/'+window.card_array[1]+'.png)', backgroundSize:'100%, 100%'}});


var CorrectCardImage3 = document.querySelectorAll("[data-acc-text='CorrectCardImage3']")

TweenLite.set(CorrectCardImage3[0], {css:{backgroundImage:'url('+url+'images/'+card_colour+'/'+window.card_array[2]+'.png)', backgroundSize:'100%, 100%'}});

var CorrectCardImage4 = document.querySelectorAll("[data-acc-text='CorrectCardImage4']")

TweenLite.set(CorrectCardImage4[0], {css:{backgroundImage:'url('+url+'images/'+card_colour+'/'+window.card_array[3]+'.png)', backgroundSize:'100%, 100%'}});
}

function Script160()
{
  CardAudio4.play();
}

function Script161()
{
  CardAudio3.play();
}

function Script162()
{
  CardAudio2.play();
}

function Script163()
{
  CardAudio1.play();
}

function Script164()
{
  and.play();
}

function Script165()
{
  and.play();
}

function Script166()
{
  and.play();
}

function Script167()
{
  the.play();
}

function Script168()
{
  var player = GetPlayer();

var url=player.GetVar("url");
var card_colour = 1


var CorrectCardImage1 = document.querySelectorAll("[data-acc-text='CorrectCardImage1']")

TweenLite.set(CorrectCardImage1[0], {css:{backgroundImage:'url('+url+'images/'+card_colour+'/'+window.card_array[0]+'.png)', backgroundSize:'100%, 100%'}});


var CorrectCardImage2 = document.querySelectorAll("[data-acc-text='CorrectCardImage2']")

TweenLite.set(CorrectCardImage2[0], {css:{backgroundImage:'url('+url+'images/'+card_colour+'/'+window.card_array[1]+'.png)', backgroundSize:'100%, 100%'}});


var CorrectCardImage3 = document.querySelectorAll("[data-acc-text='CorrectCardImage3']")

TweenLite.set(CorrectCardImage3[0], {css:{backgroundImage:'url('+url+'images/'+card_colour+'/'+window.card_array[2]+'.png)', backgroundSize:'100%, 100%'}});

var CorrectCardImage4 = document.querySelectorAll("[data-acc-text='CorrectCardImage4']")

TweenLite.set(CorrectCardImage4[0], {css:{backgroundImage:'url('+url+'images/'+card_colour+'/'+window.card_array[3]+'.png)', backgroundSize:'100%, 100%'}});
}

function Script169()
{
   console.log("GSAP version: "+TweenLite.version);

var player = GetPlayer();

var url=player.GetVar("url");

window.card_array = [];
var rand = 0;
var max_num = 24;

var card_colour = 1;

var title= "";

var title_complete = "";

card_array[0] = 1;


for (i = 1; i < 7; i++) {
do {
rand = Math.floor(Math.random() * max_num) + 1;
}
while (card_array.includes(rand));

card_array[i] = rand;

}

var title_array = [];


title_array[1]='Bird';
title_array[2]='Cat';
title_array[3]='Chicken';
title_array[4]='Cow';
title_array[5]='Crocodile';
title_array[6]='Dinosaur';
title_array[7]='Dog';
title_array[8]='Donkey';
title_array[9]='Fish';
title_array[10]='Flamingo';
title_array[11]='Hippo';
title_array[12]='Lion';
title_array[13]='Sheep';
title_array[14]='Snail';
title_array[15]='Snake';
title_array[16]='Spider';
title_array[17]='Tiger';
title_array[18]='Daddy';
title_array[19]='Mummy';
title_array[20]='Toddler';
title_array[21]='Baby';
title_array[22]='Girl';
title_array[23]='Queen';
title_array[24]='King';


//title = "The <b style='color:#FF7F02!important;'>" + title_array[card_array[0]].toLowerCase() + "</b> and <b style='color:#FF7F02!important;'>" + title_array[card_array[1]].toLowerCase() + "</b> and <b style='color:#FF7F02!important;'>????</b> ";

//title = "The <b><span style='color:#FF7F02!important;'>" + title_array[card_array[0]].toLowerCase() + "</span></b> and <b>" + title_array[card_array[1]].toLowerCase() + "</b> and <b>????</b> ";

//player.SetVar("Title",title);

//title_complete = "The <b style='color:#FF7F02!important;'>" + title_array[card_array[0]].toLowerCase() + "</b> and <b style='color:#FF7F02!important;'>" + title_array[card_array[1]].toLowerCase() + "</b> and <b style='color:#FF7F02!important;'>" + title_array[card_array[2]].toLowerCase() + "</b>";

//player.SetVar("TitleComplete",title_complete);


player.SetVar("Card1", title_array[card_array[0]]);
player.SetVar("Card2", title_array[card_array[1]]);
player.SetVar("Card3", title_array[card_array[2]]);
player.SetVar("Card4", title_array[card_array[3]]);
player.SetVar("Card5", title_array[card_array[4]]);
player.SetVar("Card6", title_array[card_array[5]]);



var CardImage1 = document.querySelectorAll("[data-acc-text='CardImage1']")

TweenLite.set(CardImage1[0], {css:{backgroundImage:'url('+url+'images/'+card_colour+'/'+card_array[0]+'.png)', backgroundSize:'100%, 100%'}});

var CardImage2 = document.querySelectorAll("[data-acc-text='CardImage2']")

TweenLite.set(CardImage2[0], {css:{backgroundImage:'url('+url+'images/'+card_colour+'/'+card_array[1]+'.png)', backgroundSize:'100%, 100%'}});

var CardImage3 = document.querySelectorAll("[data-acc-text='CardImage3']")

TweenLite.set(CardImage3[0], {css:{backgroundImage:'url('+url+'images/'+card_colour+'/'+card_array[2]+'.png)', backgroundSize:'100%, 100%'}});

var CardImage4 = document.querySelectorAll("[data-acc-text='CardImage4']")

TweenLite.set(CardImage4[0], {css:{backgroundImage:'url('+url+'images/'+card_colour+'/'+card_array[3]+'.png)', backgroundSize:'100%, 100%'}});

var CardImage5 = document.querySelectorAll("[data-acc-text='CardImage5']")

TweenLite.set(CardImage5[0], {css:{backgroundImage:'url('+url+'images/'+card_colour+'/'+card_array[4]+'.png)', backgroundSize:'100%, 100%'}});

var CardImage6 = document.querySelectorAll("[data-acc-text='CardImage6']")

TweenLite.set(CardImage6[0], {css:{backgroundImage:'url('+url+'images/'+card_colour+'/'+card_array[5]+'.png)', backgroundSize:'100%, 100%'}});



window.CardAudio1 = new Audio(url+'audio/'+card_colour+'/'+card_array[0]+'.mp3');
window.CardAudio2 = new Audio(url+'audio/'+card_colour+'/'+card_array[1]+'.mp3');
window.CardAudio3 = new Audio(url+'audio/'+card_colour+'/'+card_array[2]+'.mp3');
window.CardAudio4 = new Audio(url+'audio/'+card_colour+'/'+card_array[3]+'.mp3');
window.CardAudio5 = new Audio(url+'audio/'+card_colour+'/'+card_array[4]+'.mp3');
window.CardAudio6 = new Audio(url+'audio/2/'+card_array[5]+'.mp3');


window.and = new Audio(url+'audio/0/and.mp3');
window.the = new Audio(url+'audio/0/the.mp3');
window.are = new Audio(url+'audio/0/are.mp3');
window.something = new Audio(url+'audio/0/something.mp3');


window.sequences = [url+'audio/0/the.mp3', url+'audio/'+card_colour+'/'+card_array[0]+'.mp3', url+'audio/0/and.mp3', url+'audio/'+card_colour+'/'+card_array[1]+'.mp3', url+'audio/0/and.mp3', url+'audio/0/something.mp3']
}

function Script170()
{
  function playAudio(src) {
  var audioElement = new Audio(src);
  audioElement.play();
  return audioElement
}

var player = GetPlayer();

player.SetVar("SpeakerSwitch",'1');

let index = 0

const audioElement = playAudio(sequences[index])
audioElement.addEventListener('ended', (e) => {
  index++
  if (index < sequences.length) {
    audioElement.src = sequences[index]
    audioElement.play();
  }
else
    player.SetVar("SpeakerSwitch",'0');

})
}

function Script171()
{
  CardAudio6.play();
}

function Script172()
{
  CardAudio5.play();
}

function Script173()
{
  CardAudio4.play();
}

function Script174()
{
  CardAudio3.play();
}

function Script175()
{
  something.play();
}

function Script176()
{
  CardAudio2.play();
}

function Script177()
{
  CardAudio1.play();
}

function Script178()
{
  and.play();
}

function Script179()
{
  and.play();
}

function Script180()
{
  the.play();
}

function Script181()
{
  var player = GetPlayer();

var url = player.GetVar("url");

// update answer array

var ans=player.GetVar("AnsArray");

ans = ans + window.card_array[5] + ",";

player.SetVar("AnsArray",ans);


var ans_step = player.GetVar("AnsStepArray");

ans_step = ans_step + player.GetVar("Counter") + ",";

player.SetVar("AnsStepArray",ans_step);



// who answers

var CardImage2 = document.querySelectorAll("[data-acc-text='CardImage2']")
TweenLite.set(CardImage2[0], {css: {backgroundImage: `url(${window.imageUrls[1]})`, backgroundSize: '100%, 100%'}});

var CardImage4 = document.querySelectorAll("[data-acc-text='CardImage4']")
TweenLite.set(CardImage4[0], {css: {backgroundImage: `url(${window.imageUrls[3]})`, backgroundSize: '100%, 100%'}});

// what doing answer

var CardImage5 = document.querySelectorAll("[data-acc-text='CardImage5']")
TweenLite.set(CardImage5[0], {css: {backgroundImage: `url(${window.imageUrls[4]})`, backgroundSize: '100%, 100%'}});


// describe answers

var CardImage1 = document.querySelectorAll("[data-acc-text='CardImage1']")
TweenLite.set(CardImage1[0], {css: {backgroundImage: `url(${window.imageUrls[0]})`, backgroundSize: '100%, 100%'}});

var CardImage3 = document.querySelectorAll("[data-acc-text='CardImage3']")
TweenLite.set(CardImage3[0], {css: {backgroundImage: `url(${window.imageUrls[2]})`, backgroundSize: '100%, 100%'}});


// incorrect answers


var CardImage6 = document.querySelectorAll("[data-acc-text='CardImage6']")
TweenLite.set(CardImage6[0], {css: {backgroundImage: `url(${window.imageUrls[5]})`, backgroundSize: '100%, 100%'}});

var CardImage7 = document.querySelectorAll("[data-acc-text='CardImage7']")
TweenLite.set(CardImage7[0], {css: {backgroundImage: `url(${window.imageUrls[6]})`, backgroundSize: '100%, 100%'}});

var CardImage8 = document.querySelectorAll("[data-acc-text='CardImage8']")
TweenLite.set(CardImage8[0], {css: {backgroundImage: `url(${window.imageUrls[7]})`, backgroundSize: '100%, 100%'}});

var CardImage9 = document.querySelectorAll("[data-acc-text='CardImage9']")
TweenLite.set(CardImage9[0], {css: {backgroundImage: `url(${window.imageUrls[8]})`, backgroundSize: '100%, 100%'}});


// audio

window.CardAudio1 = new Audio(url + 'audio/6/' +card_array[1]+'.mp3');
window.CardAudio2 = new Audio(url + 'audio/1/' +card_array[2]+'.mp3');
window.CardAudio3 = new Audio(url + 'audio/6/' +card_array[3]+'.mp3');
window.CardAudio4 = new Audio(url + 'audio/1/' +card_array[4]+'.mp3');
window.CardAudio5 = new Audio(url + 'audio/2/' +card_array[5]+'.mp3');
window.CardAudio6 = new Audio(url + 'audio/1/' +card_array[6]+'.mp3');
window.CardAudio7 = new Audio(url + 'audio/3/' +card_array[7]+'.mp3');
window.CardAudio8 = new Audio(url + 'audio/4/' +card_array[8]+'.mp3');
window.CardAudio9 = new Audio(url + 'audio/5/' +card_array[9]+'.mp3');


window.and = new Audio(url+'audio/0/and.mp3');
window.the = new Audio(url+'audio/0/the.mp3');
window.are = new Audio(url+'audio/0/are.mp3');
window.something = new Audio(url+'audio/0/something.mp3');


window.sequences = [
    url+'audio/0/the.mp3', 
    url+'audio/6/'+card_array[1]+'.mp3', 
    url+'audio/1/'+card_array[2]+'.mp3', 
    url+'audio/0/and.mp3', 
    url+'audio/6/'+card_array[3]+'.mp3', 
    url+'audio/1/'+card_array[4]+'.mp3', 
    url+'audio/0/are.mp3', 
    url+'audio/0/something.mp3'
];

var title = "The <b style='color: #7030A0;'>" + player.GetVar("Card1").toLowerCase() + "</b> <b style='color: #FF7E02;'>" + player.GetVar("Card2").toLowerCase() + "</b>" +
  " and <b style='color: #7030A0;'>" + player.GetVar("Card3").toLowerCase() + "</b> <b style='color: #FF7E02;'>" + player.GetVar("Card4").toLowerCase() + "</b>" +
  " are <b style='color: #FFC004;'>????</b>";

var titleComplete = document.querySelectorAll("[data-acc-text='title_complete']")[0];

// Function to dynamically adjust font size
function adjustFontSize() {
    var screenWidth = window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth;

    // Calculate the desired font size based on the screen width
    var fontSize = Math.max(16, screenWidth / 50); // You can adjust the ratio as needed

    // Apply the font size to the titleComplete element
    titleComplete.style.fontSize = fontSize + 'px';
}

// Initial adjustment when the page loads
adjustFontSize();

// Event listener for resizing
window.addEventListener('resize', adjustFontSize);

titleComplete.innerHTML = "<div style='text-align: center; color: #fff; font-family: \"Open Sans\", sans-serif;'>" + title + "</div>";

}

function Script182()
{
  function playAudio(src) {
  var audioElement = new Audio(src);
  audioElement.play();
  return audioElement
}

var player = GetPlayer();

player.SetVar("SpeakerSwitch",'1');

let index = 0

const audioElement = playAudio(sequences[index])
audioElement.addEventListener('ended', (e) => {
  index++
  if (index < sequences.length) {
    audioElement.src = sequences[index]
    audioElement.play();
  }
else
    player.SetVar("SpeakerSwitch",'0');

})
}

function Script183()
{
  CardAudio9.play();
}

function Script184()
{
  CardAudio9.play();
}

function Script185()
{
  CardAudio8.play();
}

function Script186()
{
  CardAudio8.play();
}

function Script187()
{
  CardAudio7.play();
}

function Script188()
{
  CardAudio7.play();
}

function Script189()
{
  CardAudio6.play();
}

function Script190()
{
  CardAudio6.play();
}

function Script191()
{
  CardAudio5.play();
}

function Script192()
{
  CardAudio5.play();
}

function Script193()
{
  the.play();
}

function Script194()
{
  CardAudio1.play();
}

function Script195()
{
  CardAudio2.play();
}

function Script196()
{
  and.play();
}

function Script197()
{
  CardAudio3.play();
}

function Script198()
{
  are.play();
}

function Script199()
{
  CardAudio4.play();
}

function Script200()
{
  console.log("GSAP version: "+TweenLite.version);

var player = GetPlayer();

var CardImageCorrect = document.querySelectorAll("[data-acc-text='CardImageCorrect']")
TweenLite.set(CardImageCorrect[0], {css: {backgroundImage: `url(${window.imageUrls[4]})`, backgroundSize: '100%, 100%'}});


}

function Script201()
{
  console.log("GSAP version: "+TweenLite.version);

var CardImageCorrect1 = document.querySelectorAll("[data-acc-text='CardImageCorrect1']")
TweenLite.set(CardImageCorrect1[0], {css: {backgroundImage: `url(${window.imageUrls[0]})`, backgroundSize: '100%, 100%'}});

var CardImageCorrect2 = document.querySelectorAll("[data-acc-text='CardImageCorrect2']")
TweenLite.set(CardImageCorrect2[0], {css: {backgroundImage: `url(${window.imageUrls[1]})`, backgroundSize: '100%, 100%'}});

var CardImageCorrect3 = document.querySelectorAll("[data-acc-text='CardImageCorrect3']")
TweenLite.set(CardImageCorrect3[0], {css: {backgroundImage: `url(${window.imageUrls[2]})`, backgroundSize: '100%, 100%'}});

var CardImageCorrect4 = document.querySelectorAll("[data-acc-text='CardImageCorrect4']")
TweenLite.set(CardImageCorrect4[0], {css: {backgroundImage: `url(${window.imageUrls[3]})`, backgroundSize: '100%, 100%'}});

var CardImageCorrect5 = document.querySelectorAll("[data-acc-text='CardImageCorrect5']")
TweenLite.set(CardImageCorrect5[0], {css: {backgroundImage: `url(${window.imageUrls[4]})`, backgroundSize: '100%, 100%'}});




}

function Script202()
{
  var player = GetPlayer();

var url = player.GetVar("url");

// update answer array

var ans=player.GetVar("AnsArray");

ans = ans + window.card_array[5] + ",";

player.SetVar("AnsArray",ans);


var ans_step = player.GetVar("AnsStepArray");

ans_step = ans_step + player.GetVar("Counter") + ",";

player.SetVar("AnsStepArray",ans_step);



// who answers

var CardImage2 = document.querySelectorAll("[data-acc-text='CardImage2']")
TweenLite.set(CardImage2[0], {css: {backgroundImage: `url(${window.imageUrls[1]})`, backgroundSize: '100%, 100%'}});

// what doing answer

var CardImage5 = document.querySelectorAll("[data-acc-text='CardImage5']")
TweenLite.set(CardImage5[0], {css: {backgroundImage: `url(${window.imageUrls[4]})`, backgroundSize: '100%, 100%'}});


// describe answers

var CardImage1 = document.querySelectorAll("[data-acc-text='CardImage1']")
TweenLite.set(CardImage1[0], {css: {backgroundImage: `url(${window.imageUrls[0]})`, backgroundSize: '100%, 100%'}});


// incorrect answers


var CardImage6 = document.querySelectorAll("[data-acc-text='CardImage6']")
TweenLite.set(CardImage6[0], {css: {backgroundImage: `url(${window.imageUrls[5]})`, backgroundSize: '100%, 100%'}});

var CardImage7 = document.querySelectorAll("[data-acc-text='CardImage7']")
TweenLite.set(CardImage7[0], {css: {backgroundImage: `url(${window.imageUrls[6]})`, backgroundSize: '100%, 100%'}});

var CardImage8 = document.querySelectorAll("[data-acc-text='CardImage8']")
TweenLite.set(CardImage8[0], {css: {backgroundImage: `url(${window.imageUrls[7]})`, backgroundSize: '100%, 100%'}});

// audio

window.CardAudio1 = new Audio(url + 'audio/6/' +card_array[1]+'.mp3');
window.CardAudio2 = new Audio(url + 'audio/1/' +card_array[2]+'.mp3');
window.CardAudio5 = new Audio(url + 'audio/2/' +card_array[5]+'.mp3');
window.CardAudio6 = new Audio(url + 'audio/1/' +card_array[6]+'.mp3');
window.CardAudio7 = new Audio(url + 'audio/3/' +card_array[7]+'.mp3');
window.CardAudio8 = new Audio(url + 'audio/4/' +card_array[8]+'.mp3');

window.and = new Audio(url+'audio/0/and.mp3');
window.the = new Audio(url+'audio/0/the.mp3');
window.is = new Audio(url+'audio/0/is.mp3');
window.something = new Audio(url+'audio/0/something.mp3');


window.sequences = [
    url+'audio/0/the.mp3', 
    url+'audio/6/'+card_array[1]+'.mp3', 
    url+'audio/1/'+card_array[2]+'.mp3', 
    url+'audio/0/is.mp3', 
    url+'audio/0/something.mp3'
];

var title = "The <b style='color: #7030A0;'>" + player.GetVar("Card1").toLowerCase() + "</b> <b style='color: #FF7E02;'>" + player.GetVar("Card2").toLowerCase() + "</b>" +
  " is <b style='color: #FFC004;'>????</b>";

var titleComplete = document.querySelectorAll("[data-acc-text='title_complete']")[0];

// Function to dynamically adjust font size
function adjustFontSize() {
    var screenWidth = window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth;

    // Calculate the desired font size based on the screen width
    var fontSize = Math.max(16, screenWidth / 50); // You can adjust the ratio as needed

    // Apply the font size to the titleComplete element
    titleComplete.style.fontSize = fontSize + 'px';
}

// Initial adjustment when the page loads
adjustFontSize();

// Event listener for resizing
window.addEventListener('resize', adjustFontSize);

titleComplete.innerHTML = "<div style='text-align: center; color: #fff; font-family: \"Open Sans\", sans-serif;'>" + title + "</div>";

}

function Script203()
{
  function playAudio(src) {
  var audioElement = new Audio(src);
  audioElement.play();
  return audioElement
}

var player = GetPlayer();

player.SetVar("SpeakerSwitch",'1');

let index = 0

const audioElement = playAudio(sequences[index])
audioElement.addEventListener('ended', (e) => {
  index++
  if (index < sequences.length) {
    audioElement.src = sequences[index]
    audioElement.play();
  }
else
    player.SetVar("SpeakerSwitch",'0');

})
}

function Script204()
{
  CardAudio8.play();
}

function Script205()
{
  CardAudio8.play();
}

function Script206()
{
  CardAudio7.play();
}

function Script207()
{
  CardAudio7.play();
}

function Script208()
{
  CardAudio6.play();
}

function Script209()
{
  CardAudio6.play();
}

function Script210()
{
  CardAudio5.play();
}

function Script211()
{
  CardAudio5.play();
}

function Script212()
{
  is.play();
}

function Script213()
{
  CardAudio2.play();
}

function Script214()
{
  CardAudio1.play();
}

function Script215()
{
  the.play();
}

function Script216()
{
  console.log("GSAP version: "+TweenLite.version);

var player = GetPlayer();

var CardImageCorrect = document.querySelectorAll("[data-acc-text='CardImageCorrect']")
TweenLite.set(CardImageCorrect[0], {css: {backgroundImage: `url(${window.imageUrls[4]})`, backgroundSize: '100%, 100%'}});


}

function Script217()
{
  console.log("GSAP version: "+TweenLite.version);

var CardImageCorrect1 = document.querySelectorAll("[data-acc-text='CardImageCorrect1']")
TweenLite.set(CardImageCorrect1[0], {css: {backgroundImage: `url(${window.imageUrls[0]})`, backgroundSize: '100%, 100%'}});

var CardImageCorrect2 = document.querySelectorAll("[data-acc-text='CardImageCorrect2']")
TweenLite.set(CardImageCorrect2[0], {css: {backgroundImage: `url(${window.imageUrls[1]})`, backgroundSize: '100%, 100%'}});

var CardImageCorrect5 = document.querySelectorAll("[data-acc-text='CardImageCorrect5']")
TweenLite.set(CardImageCorrect5[0], {css: {backgroundImage: `url(${window.imageUrls[4]})`, backgroundSize: '100%, 100%'}});
}

function Script218()
{
  console.log("GSAP version: "+TweenLite.version);

var player = GetPlayer();

var url=player.GetVar("url");

window.card_array = [];
var who_array = [];
var what_array = [];
var describe_array = [];

var ans_array_numbers, correct_card, card_ans;

var max_num = 24;

var card_colour = 1;

// Move the condition after defining and splitting ans_array and ans_step
//var ans_array_str = "1,2,3,4,5,6,";
//var ans_step_str = "1,2,3,4,5,6,";

//alert(ans_step_str + " / " + player.GetVar("AnsStepArray"));

var ans_array_str = player.GetVar("AnsArray");
var ans_step_str = player.GetVar("AnsStepArray");



// Convert string values to arrays
var ans_array = ans_array_str.split(",");
var ans_step = ans_step_str.split(",");

if (ans_array_str !== "") {
    // Loop through ans_array
for (var i = 0; i < ans_array.length-1; i++) {

    // Select the corresponding element using data-acc-text attribute
    var card_ans = document.querySelectorAll("[data-acc-text='x" + ans_step[i] + "']");

        var width = card_ans[0].offsetWidth - 8;
        var height = card_ans[0].offsetHeight - 8;
        
        // Apply TweenLite for the current values
        TweenLite.set(card_ans[0], {
            css: {
                backgroundImage: 'url(' + url + 'images/' + card_colour + '/' + ans_array[i] + '.png)',
                width: width + 'px',
                height: height + 'px',
                backgroundRepeat: 'no-repeat',
                backgroundSize: '80% 80%',
                backgroundColor: '#fff',
                backgroundPosition: 'center center'
            }
        });

}
}

var item_array=[
["Bird",4,5,6,12],
["Cat",4,5,6],
["Chicken",4,5],
["Cow",1,4],
["Crocodile",1,11],
["Dinosaur",2,5,11],
["Dog",1,5,6],
["Donkey",1,5],
["Daddy",3,17],
["Fish",6,12],
["Flamingo",1,5],
["Girl",3,5,6,17],
["Hippo",2,5,11],
["King",3,17],
["Lion",1,5],
["Baby",4,5,17],
["Mummy",3,17],
["Queen",3,17],
["Sheep",1,5],
["Snail",4,6,12],
["Snake",4,6,12],
["Spider",4,6,12],
["Tiger",1,5,11],
["Toddler",4,5,17],
];

who_array[1]='Bird';
who_array[2]='Cat';
who_array[3]='Chicken';
who_array[4]='Cow';
who_array[5]='Crocodile';
who_array[6]='Dinosaur';
who_array[7]='Dog';
who_array[8]='Donkey';
who_array[9]='Fish';
who_array[10]='Flamingo';
who_array[11]='Hippo';
who_array[12]='Lion';
who_array[13]='Sheep';
who_array[14]='Snail';
who_array[15]='Snake';
who_array[16]='Spider';
who_array[17]='Tiger';
who_array[18]='Daddy';
who_array[19]='Mummy';
who_array[20]='Toddler';
who_array[21]='Baby';
who_array[22]='Girl';
who_array[23]='Queen';
who_array[24]='King';

what_array[1]='Pizza';
what_array[2]='Boat';
what_array[3]='Chips';
what_array[4]='Peas';
what_array[5]='Banana';
what_array[6]='Orange';
what_array[7]='Orange Juice';
what_array[8]='Apple';
what_array[9]='Pear';
what_array[10]='Toys';
what_array[11]='Broccoli';
what_array[12]='Burger';
what_array[13]='Computer';
what_array[14]='Aeroplane';
what_array[15]='Train';
what_array[16]='Car';
what_array[17]='Television';
what_array[18]='Lorry';
what_array[19]='Bike';
what_array[20]='Sandwich';
what_array[21]='Toilet';
what_array[22]='Bed';
what_array[23]='Sofa';
what_array[24]='Oven';
what_array[25]='Teddy';


describe_array[1]='Large';
describe_array[2]='Huge';
describe_array[3]='Tall';
describe_array[4]='Small';
describe_array[5]='Loud';
describe_array[6]='Quiet';
describe_array[7]='Hot ';
describe_array[8]='Cold';
describe_array[9]='Wet';
describe_array[10]='Dry';
describe_array[11]='Heavy';
describe_array[12]='Light';
describe_array[13]='Best';
describe_array[14]='Brilliant';
describe_array[15]='Noisy';
describe_array[16]='Tasty';
describe_array[17]='Happy';






let uniqueSecondColumnValues = new Set();

// Keep shuffling until unique values are found
while (true) {
    // Random sorting within each row
    item_array = item_array.map(row => [row[0], ...row.slice(1).sort(() => Math.random() - 0.5)]);

    // Random shuffling of rows
    item_array = item_array.sort(() => Math.random() - 0.5);

    // Clear the set for each iteration
    uniqueSecondColumnValues.clear();

    // Filter and break the loop if unique values are found
    const uniqueRows = item_array.filter(row => {
        const value = row[1];
        if (!uniqueSecondColumnValues.has(value)) {
            uniqueSecondColumnValues.add(value);
            return true;
        }
        return false;
    });

    // Break the loop if there are at least 3 unique rows
    if (uniqueRows.length >= 3) {
        item_array = uniqueRows.slice(0, 3);
        break;
    }
}

// Keeping only the first two columns
item_array = item_array.map(row => row.slice(0, 2));

console.log(item_array);



card_array[1] = item_array[0][1];
card_array[2] = who_array.indexOf(item_array[0][0]);
card_array[3] = item_array[1][1];
card_array[4] = who_array.indexOf(item_array[1][0]);
card_array[5] = item_array[2][1];
card_array[6] = who_array.indexOf(item_array[2][0]);



for (i = 7; i <= 9; i++) {
do {
rand = Math.floor(Math.random() * max_num) + 1;
}
while (card_array.includes(rand));

card_array[i] = rand;

}



window.imageUrls = [
  url + 'images/6/' +card_array[1]+ '.png',
  url + 'images/1/' +card_array[2]+ '.png',
  url + 'images/6/' +card_array[3]+ '.png',
  url + 'images/1/' +card_array[4]+ '.png',
  url + 'images/6/' +card_array[5]+ '.png',
  url + 'images/1/' +card_array[6]+ '.png',
  url + 'images/3/' +card_array[7]+ '.png',
  url + 'images/3/' +card_array[8]+ '.png',
  url + 'images/3/' +card_array[9]+ '.png'
];


// pre-load

for (var i = 0; i < imageUrls.length; i++) {
  var image = new Image();
  image.src = window.imageUrls[i];
}


// set cards


player.SetVar("Card1", describe_array[card_array[1]]);
player.SetVar("Card2", who_array[card_array[2]]);
player.SetVar("Card3", describe_array[card_array[3]]);
player.SetVar("Card4", who_array[card_array[4]]);
player.SetVar("Card5", describe_array[card_array[5]]);
player.SetVar("Card6", who_array[card_array[6]]);

player.SetVar("Card7", what_array[card_array[7]]);
player.SetVar("Card8", what_array[card_array[8]]);
player.SetVar("Card9", what_array[card_array[9]]);



}

function Script219()
{
  var player = GetPlayer();

var url=player.GetVar("url");
var card_colour = 1


var CorrectCardImage1 = document.querySelectorAll("[data-acc-text='CorrectCardImage1']")

TweenLite.set(CorrectCardImage1[0], {css:{backgroundImage:'url('+url+'images/'+card_colour+'/'+window.card_array[0]+'.png)', backgroundSize:'100%, 100%'}});


var CorrectCardImage2 = document.querySelectorAll("[data-acc-text='CorrectCardImage2']")

TweenLite.set(CorrectCardImage2[0], {css:{backgroundImage:'url('+url+'images/'+card_colour+'/'+window.card_array[1]+'.png)', backgroundSize:'100%, 100%'}});


var CorrectCardImage3 = document.querySelectorAll("[data-acc-text='CorrectCardImage3']")

TweenLite.set(CorrectCardImage3[0], {css:{backgroundImage:'url('+url+'images/'+card_colour+'/'+window.card_array[2]+'.png)', backgroundSize:'100%, 100%'}});

var CorrectCardImage4 = document.querySelectorAll("[data-acc-text='CorrectCardImage4']")

TweenLite.set(CorrectCardImage4[0], {css:{backgroundImage:'url('+url+'images/'+card_colour+'/'+window.card_array[3]+'.png)', backgroundSize:'100%, 100%'}});
}

function Script220()
{
  CardAudio4.play();
}

function Script221()
{
  CardAudio3.play();
}

function Script222()
{
  CardAudio2.play();
}

function Script223()
{
  CardAudio1.play();
}

function Script224()
{
  and.play();
}

function Script225()
{
  and.play();
}

function Script226()
{
  and.play();
}

function Script227()
{
  the.play();
}

function Script228()
{
  var player = GetPlayer();

var url=player.GetVar("url");
var card_colour = 1


var CorrectCardImage1 = document.querySelectorAll("[data-acc-text='CorrectCardImage1']")

TweenLite.set(CorrectCardImage1[0], {css:{backgroundImage:'url('+url+'images/'+card_colour+'/'+window.card_array[0]+'.png)', backgroundSize:'100%, 100%'}});


var CorrectCardImage2 = document.querySelectorAll("[data-acc-text='CorrectCardImage2']")

TweenLite.set(CorrectCardImage2[0], {css:{backgroundImage:'url('+url+'images/'+card_colour+'/'+window.card_array[1]+'.png)', backgroundSize:'100%, 100%'}});


var CorrectCardImage3 = document.querySelectorAll("[data-acc-text='CorrectCardImage3']")

TweenLite.set(CorrectCardImage3[0], {css:{backgroundImage:'url('+url+'images/'+card_colour+'/'+window.card_array[2]+'.png)', backgroundSize:'100%, 100%'}});

var CorrectCardImage4 = document.querySelectorAll("[data-acc-text='CorrectCardImage4']")

TweenLite.set(CorrectCardImage4[0], {css:{backgroundImage:'url('+url+'images/'+card_colour+'/'+window.card_array[3]+'.png)', backgroundSize:'100%, 100%'}});
}

function Script229()
{
   console.log("GSAP version: "+TweenLite.version);

var player = GetPlayer();

var url=player.GetVar("url");

window.card_array = [];
var rand = 0;
var max_num = 24;

var card_colour = 1;

var title= "";

var title_complete = "";

card_array[0] = 1;


for (i = 1; i < 7; i++) {
do {
rand = Math.floor(Math.random() * max_num) + 1;
}
while (card_array.includes(rand));

card_array[i] = rand;

}

var title_array = [];


title_array[1]='Bird';
title_array[2]='Cat';
title_array[3]='Chicken';
title_array[4]='Cow';
title_array[5]='Crocodile';
title_array[6]='Dinosaur';
title_array[7]='Dog';
title_array[8]='Donkey';
title_array[9]='Fish';
title_array[10]='Flamingo';
title_array[11]='Hippo';
title_array[12]='Lion';
title_array[13]='Sheep';
title_array[14]='Snail';
title_array[15]='Snake';
title_array[16]='Spider';
title_array[17]='Tiger';
title_array[18]='Daddy';
title_array[19]='Mummy';
title_array[20]='Toddler';
title_array[21]='Baby';
title_array[22]='Girl';
title_array[23]='Queen';
title_array[24]='King';


//title = "The <b style='color:#FF7F02!important;'>" + title_array[card_array[0]].toLowerCase() + "</b> and <b style='color:#FF7F02!important;'>" + title_array[card_array[1]].toLowerCase() + "</b> and <b style='color:#FF7F02!important;'>????</b> ";

//title = "The <b><span style='color:#FF7F02!important;'>" + title_array[card_array[0]].toLowerCase() + "</span></b> and <b>" + title_array[card_array[1]].toLowerCase() + "</b> and <b>????</b> ";

//player.SetVar("Title",title);

//title_complete = "The <b style='color:#FF7F02!important;'>" + title_array[card_array[0]].toLowerCase() + "</b> and <b style='color:#FF7F02!important;'>" + title_array[card_array[1]].toLowerCase() + "</b> and <b style='color:#FF7F02!important;'>" + title_array[card_array[2]].toLowerCase() + "</b>";

//player.SetVar("TitleComplete",title_complete);


player.SetVar("Card1", title_array[card_array[0]]);
player.SetVar("Card2", title_array[card_array[1]]);
player.SetVar("Card3", title_array[card_array[2]]);
player.SetVar("Card4", title_array[card_array[3]]);
player.SetVar("Card5", title_array[card_array[4]]);
player.SetVar("Card6", title_array[card_array[5]]);



var CardImage1 = document.querySelectorAll("[data-acc-text='CardImage1']")

TweenLite.set(CardImage1[0], {css:{backgroundImage:'url('+url+'images/'+card_colour+'/'+card_array[0]+'.png)', backgroundSize:'100%, 100%'}});

var CardImage2 = document.querySelectorAll("[data-acc-text='CardImage2']")

TweenLite.set(CardImage2[0], {css:{backgroundImage:'url('+url+'images/'+card_colour+'/'+card_array[1]+'.png)', backgroundSize:'100%, 100%'}});

var CardImage3 = document.querySelectorAll("[data-acc-text='CardImage3']")

TweenLite.set(CardImage3[0], {css:{backgroundImage:'url('+url+'images/'+card_colour+'/'+card_array[2]+'.png)', backgroundSize:'100%, 100%'}});

var CardImage4 = document.querySelectorAll("[data-acc-text='CardImage4']")

TweenLite.set(CardImage4[0], {css:{backgroundImage:'url('+url+'images/'+card_colour+'/'+card_array[3]+'.png)', backgroundSize:'100%, 100%'}});

var CardImage5 = document.querySelectorAll("[data-acc-text='CardImage5']")

TweenLite.set(CardImage5[0], {css:{backgroundImage:'url('+url+'images/'+card_colour+'/'+card_array[4]+'.png)', backgroundSize:'100%, 100%'}});

var CardImage6 = document.querySelectorAll("[data-acc-text='CardImage6']")

TweenLite.set(CardImage6[0], {css:{backgroundImage:'url('+url+'images/'+card_colour+'/'+card_array[5]+'.png)', backgroundSize:'100%, 100%'}});



window.CardAudio1 = new Audio(url+'audio/'+card_colour+'/'+card_array[0]+'.mp3');
window.CardAudio2 = new Audio(url+'audio/'+card_colour+'/'+card_array[1]+'.mp3');
window.CardAudio3 = new Audio(url+'audio/'+card_colour+'/'+card_array[2]+'.mp3');
window.CardAudio4 = new Audio(url+'audio/'+card_colour+'/'+card_array[3]+'.mp3');
window.CardAudio5 = new Audio(url+'audio/'+card_colour+'/'+card_array[4]+'.mp3');
window.CardAudio6 = new Audio(url+'audio/'+card_colour+'/'+card_array[5]+'.mp3');


window.and = new Audio(url+'audio/0/and.mp3');
window.the = new Audio(url+'audio/0/the.mp3');
window.something = new Audio(url+'audio/0/something.mp3');


window.sequences = [url+'audio/0/the.mp3', url+'audio/'+card_colour+'/'+card_array[0]+'.mp3', url+'audio/0/and.mp3', url+'audio/'+card_colour+'/'+card_array[1]+'.mp3', url+'audio/0/and.mp3', url+'audio/0/something.mp3']
}

function Script230()
{
  function playAudio(src) {
  var audioElement = new Audio(src);
  audioElement.play();
  return audioElement
}

var player = GetPlayer();

player.SetVar("SpeakerSwitch",'1');

let index = 0

const audioElement = playAudio(sequences[index])
audioElement.addEventListener('ended', (e) => {
  index++
  if (index < sequences.length) {
    audioElement.src = sequences[index]
    audioElement.play();
  }
else
    player.SetVar("SpeakerSwitch",'0');

})
}

function Script231()
{
  CardAudio6.play();
}

function Script232()
{
  CardAudio5.play();
}

function Script233()
{
  CardAudio4.play();
}

function Script234()
{
  CardAudio3.play();
}

function Script235()
{
  something.play();
}

function Script236()
{
  CardAudio2.play();
}

function Script237()
{
  CardAudio1.play();
}

function Script238()
{
  and.play();
}

function Script239()
{
  and.play();
}

function Script240()
{
  the.play();
}

function Script241()
{
  var player = GetPlayer();

var url = player.GetVar("url");

var title= "";
//var title_complete = "";


// update answer array

var ans=player.GetVar("AnsArray");

ans = ans + window.card_array[4] + ",";

player.SetVar("AnsArray",ans);


var ans_step = player.GetVar("AnsStepArray");

ans_step = ans_step + player.GetVar("Counter") + ",";

player.SetVar("AnsStepArray",ans_step);



// who answers

var CardImage2 = document.querySelectorAll("[data-acc-text='CardImage2']")
TweenLite.set(CardImage2[0], {css: {backgroundImage: `url(${window.imageUrls[1]})`, backgroundSize: '100%, 100%'}});

var CardImage4 = document.querySelectorAll("[data-acc-text='CardImage4']")
TweenLite.set(CardImage4[0], {css: {backgroundImage: `url(${window.imageUrls[3]})`, backgroundSize: '100%, 100%'}});

var CardImage6 = document.querySelectorAll("[data-acc-text='CardImage6']")
TweenLite.set(CardImage6[0], {css: {backgroundImage: `url(${window.imageUrls[5]})`, backgroundSize: '100%, 100%'}});



// describe answers

var CardImage1 = document.querySelectorAll("[data-acc-text='CardImage1']")
TweenLite.set(CardImage1[0], {css: {backgroundImage: `url(${window.imageUrls[0]})`, backgroundSize: '100%, 100%'}});

var CardImage3 = document.querySelectorAll("[data-acc-text='CardImage3']")
TweenLite.set(CardImage3[0], {css: {backgroundImage: `url(${window.imageUrls[2]})`, backgroundSize: '100%, 100%'}});

var CardImage5 = document.querySelectorAll("[data-acc-text='CardImage5']")
TweenLite.set(CardImage5[0], {css: {backgroundImage: `url(${window.imageUrls[4]})`, backgroundSize: '100%, 100%'}});


// incorrect answers

var CardImage7 = document.querySelectorAll("[data-acc-text='CardImage7']")
TweenLite.set(CardImage7[0], {css: {backgroundImage: `url(${window.imageUrls[6]})`, backgroundSize: '100%, 100%'}});

var CardImage8 = document.querySelectorAll("[data-acc-text='CardImage8']")
TweenLite.set(CardImage8[0], {css: {backgroundImage: `url(${window.imageUrls[7]})`, backgroundSize: '100%, 100%'}});

var CardImage9 = document.querySelectorAll("[data-acc-text='CardImage9']")
TweenLite.set(CardImage9[0], {css: {backgroundImage: `url(${window.imageUrls[8]})`, backgroundSize: '100%, 100%'}});


// audio

window.CardAudio1 = new Audio(url + 'audio/6/' +card_array[1]+'.mp3');
window.CardAudio2 = new Audio(url + 'audio/1/' +card_array[2]+'.mp3');
window.CardAudio3 = new Audio(url + 'audio/6/' +card_array[3]+'.mp3');
window.CardAudio4 = new Audio(url + 'audio/1/' +card_array[4]+'.mp3');
window.CardAudio5 = new Audio(url + 'audio/6/' +card_array[5]+'.mp3');
window.CardAudio6 = new Audio(url + 'audio/1/' +card_array[6]+'.mp3');
window.CardAudio7 = new Audio(url + 'audio/3/' +card_array[7]+'.mp3');
window.CardAudio8 = new Audio(url + 'audio/3/' +card_array[8]+'.mp3');
window.CardAudio9 = new Audio(url + 'audio/3/' +card_array[9]+'.mp3');


window.and = new Audio(url+'audio/0/and.mp3');
window.the = new Audio(url+'audio/0/the.mp3');
window.something = new Audio(url+'audio/0/something.mp3');


window.sequences = [
    url+'audio/0/the.mp3', 
    url+'audio/6/'+card_array[1]+'.mp3', 
    url+'audio/1/'+card_array[2]+'.mp3', 
    url+'audio/0/and.mp3', 
    url+'audio/6/'+card_array[3]+'.mp3', 
    url+'audio/0/something.mp3',
    url+'audio/0/and.mp3', 
    url+'audio/6/'+card_array[5]+'.mp3', 
    url+'audio/1/'+card_array[6]+'.mp3'
];

var title = "The <b style='color: #7030A0;'>" + player.GetVar("Card1").toLowerCase() + "</b> <b style='color: #FF7E02;'>" + player.GetVar("Card2").toLowerCase() + "</b>" +
  " and <b style='color: #7030A0;'>" + player.GetVar("Card3").toLowerCase() + "</b> <b style='color: #FF7E02;'>????</b>" +
  " and <b style='color: #7030A0;'>" + player.GetVar("Card5").toLowerCase() + "</b> <b style='color: #FF7E02;'>" + player.GetVar("Card6").toLowerCase() + "</b>";

var titleComplete = document.querySelectorAll("[data-acc-text='title_complete']")[0];

// Function to dynamically adjust font size
function adjustFontSize() {
    var screenWidth = window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth;

    // Calculate the desired font size based on the screen width
    var fontSize = Math.max(16, screenWidth / 50); // You can adjust the ratio as needed

    // Apply the font size to the titleComplete element
    titleComplete.style.fontSize = fontSize + 'px';
}

// Initial adjustment when the page loads
adjustFontSize();

// Event listener for resizing
window.addEventListener('resize', adjustFontSize);

titleComplete.innerHTML = "<div style='text-align: center; color: #fff; font-family: \"Open Sans\", sans-serif;'>" + title + "</div>";

}

function Script242()
{
  function playAudio(src) {
  var audioElement = new Audio(src);
  audioElement.play();
  return audioElement
}

var player = GetPlayer();

player.SetVar("SpeakerSwitch",'1');

let index = 0

const audioElement = playAudio(sequences[index])
audioElement.addEventListener('ended', (e) => {
  index++
  if (index < sequences.length) {
    audioElement.src = sequences[index]
    audioElement.play();
  }
else
    player.SetVar("SpeakerSwitch",'0');

})
}

function Script243()
{
  CardAudio9.play();
}

function Script244()
{
  CardAudio9.play();
}

function Script245()
{
  CardAudio8.play();
}

function Script246()
{
  CardAudio8.play();
}

function Script247()
{
  CardAudio7.play();
}

function Script248()
{
  CardAudio7.play();
}

function Script249()
{
  CardAudio4.play();
}

function Script250()
{
  CardAudio4.play();
}

function Script251()
{
  the.play();
}

function Script252()
{
  CardAudio1.play();
}

function Script253()
{
  CardAudio2.play();
}

function Script254()
{
  and.play();
}

function Script255()
{
  CardAudio6.play();
}

function Script256()
{
  CardAudio5.play();
}

function Script257()
{
  and.play();
}

function Script258()
{
  CardAudio3.play();
}

function Script259()
{
  console.log("GSAP version: "+TweenLite.version);

var player = GetPlayer();

var CardImageCorrect = document.querySelectorAll("[data-acc-text='CardImageCorrect']")
TweenLite.set(CardImageCorrect[0], {css: {backgroundImage: `url(${window.imageUrls[3]})`, backgroundSize: '100%, 100%'}});


}

function Script260()
{
  console.log("GSAP version: "+TweenLite.version);

var CardImageCorrect1 = document.querySelectorAll("[data-acc-text='CardImageCorrect1']")
TweenLite.set(CardImageCorrect1[0], {css: {backgroundImage: `url(${window.imageUrls[0]})`, backgroundSize: '100%, 100%'}});

var CardImageCorrect2 = document.querySelectorAll("[data-acc-text='CardImageCorrect2']")
TweenLite.set(CardImageCorrect2[0], {css: {backgroundImage: `url(${window.imageUrls[1]})`, backgroundSize: '100%, 100%'}});

var CardImageCorrect3 = document.querySelectorAll("[data-acc-text='CardImageCorrect3']")
TweenLite.set(CardImageCorrect3[0], {css: {backgroundImage: `url(${window.imageUrls[2]})`, backgroundSize: '100%, 100%'}});

var CardImageCorrect4 = document.querySelectorAll("[data-acc-text='CardImageCorrect4']")
TweenLite.set(CardImageCorrect4[0], {css: {backgroundImage: `url(${window.imageUrls[3]})`, backgroundSize: '100%, 100%'}});

var CardImageCorrect5 = document.querySelectorAll("[data-acc-text='CardImageCorrect5']")
TweenLite.set(CardImageCorrect5[0], {css: {backgroundImage: `url(${window.imageUrls[4]})`, backgroundSize: '100%, 100%'}});


var CardImageCorrect6 = document.querySelectorAll("[data-acc-text='CardImageCorrect6']")
TweenLite.set(CardImageCorrect6[0], {css: {backgroundImage: `url(${window.imageUrls[5]})`, backgroundSize: '100%, 100%'}});


}

