let current = 0;
let zoom = 1;

const img = document.getElementById("pageImage");
const page = document.getElementById("pageNumber");

function showPage(){

    img.src = pages[current];

    page.innerHTML = (current+1)+" / "+pages.length;

}

function nextPage(){

    if(current < pages.length-1){

        current++;

        showPage();

    }

}

function prevPage(){

    if(current>0){

        current--;

        showPage();

    }

}

function zoomIn(){

    zoom += 0.2;

    img.style.transform="scale("+zoom+")";

}

function zoomOut(){

    if(zoom>0.4){

        zoom -= 0.2;

        img.style.transform="scale("+zoom+")";

    }

}

function toggleDark(){

    document.body.classList.toggle("dark");

}

function fullscreen(){

    if(document.documentElement.requestFullscreen){

        document.documentElement.requestFullscreen();

    }

}

document.addEventListener("keydown",function(e){

    if(e.key==="ArrowRight") nextPage();

    if(e.key==="ArrowLeft") prevPage();

});