﻿// JScript File

function showScreenshot(titleText, screenshotImageName)
{
    var screenshotPath = "url('images/screenshots/" + screenshotImageName + "')";
    var background = document.getElementById("screenshotbackground");
    var screenshot = document.getElementById("screenshot");
    var screenshotTitle = document.getElementById("screenshot_titletext");
    var screenshotBody = document.getElementById("screenshot_body");
    
    if (background && screenshot && screenshotTitle && screenshotBody)
    {
        // stretch background across entire document
        background.style.height = (document.height || document.documentElement.scrollHeight) + "px";
        background.style.width = (document.width || document.documentElement.scrollWidth) + "px";
        
        // set screenshot image
        screenshotBody.style.backgroundImage = screenshotPath;
        
        // set screenshot title text
        screenshotTitle.innerText = titleText;
        screenshotTitle.textContent = titleText;
        
        background.style.visibility = "visible";
        screenshot.style.visibility = "visible";
    }
}

function hideScreenshot()
{
    var screenshot = document.getElementById("screenshot");
    var background = document.getElementById("screenshotbackground");
    
    if (screenshot && background)
    {
        // hide these items
        screenshot.style.visibility = "hidden";
        background.style.visibility = "hidden";
    }
}