function showDetail(ith, image, filename)
{
    var detail_page = window.location.href.lastIndexOf(".");
    var temp = window.location.href.lastIndexOf("/");
    detail_page = window.location.href.substr(temp, detail_page-temp);
    detail_page = "/pages"+ detail_page + "_detail.php";
    window.location.href = detail_page + "?image=" + ith;
}


function GaleryForward()
{
    var image = window.location.search;
    image = image.split("=")[1];
    
    var url = window.location.href.split("=")[0];
    
    image = parseInt(image)+1;
    
    window.location.href = url + "=" + image;
}

function GaleryBack()
{
    var image = window.location.search;
    image = image.split("=")[1];
    
    var url = window.location.href.split("=")[0];
    
    image = parseInt(image)-1;
    window.location.href = url + "=" + image;
}

function CheckNavigation(max)
{
    var prev = document.getElementById("prev");
    var next = document.getElementById("next");
    
    var image = window.location.search;
    image = image.split("=")[1];
    
    image = parseInt(image);
    
    if(image <= 0)
    {
        prev.style.visibility="hidden";
    }
    else
    {
        prev.style.visibility="visible";
    }
    
    if(image >= max)
    {
        next.style.visibility="hidden";
    }
    else
    {
        next.style.visibility="visible";
    }
           
}
