// Javascript functions

// openPopUp: opens a pop-up window
// imageLocation: the relative path to the image
// imageHeight: the height of the pop-up window
// imageWidth: the width of the pop-up window
// imageTitle: the title bar text for the pop-up window
function openPopUp(imageLocation, imageHeight, imageWidth, imageTitle) {
    popUp = window.open('', '', 'titlebar=no,height='+ imageHeight +',width=' + imageWidth + '');

    with (popUp.document) {
        writeln('<html>');
        writeln('<head>');
        writeln('<title>Loading...</title>');
        writeln('<script>');
        writeln('function doTitle(){document.title="'+imageTitle+'";}');
        writeln('</script>');
        writeln('</head>');
        writeln('<body style="margin: 0; padding: 0; scroll="no" onload="doTitle(); self.focus()" onblur="self.close()">');
        //writeln('<body scroll="no" onload="doTitle();self.focus()">');
        writeln('<img style="display: block; margin: auto;" src="'+imageLocation+'">');
        writeln('</body>');
        writeln('</html>');
        close();
    }
}

// openPopUp: opens a pop-up window
// imageLocation: the relative path to the image
// imageHeight: the height of the pop-up window
// imageWidth: the width of the pop-up window
// imageTitle: the title bar text for the pop-up window
// windowText: text that will apperar in window
function openPopUpWithText(imageLocation, imageHeight, imageWidth, imageTitle, windowText) {
    popUp = window.open('', '', 'titlebar=no,height='+ imageHeight +',width=' + imageWidth + '');


    with (popUp.document) {
        writeln('<html>');
        writeln('<head>');
        writeln('<title>Loading...</title>');
        writeln('<script>');
        writeln('function doTitle(){document.title="'+imageTitle+'";}');
        writeln('</script>');
        writeln('<link rel="stylesheet" href="css/style.css" />');
        writeln('</head>');
        writeln('<body scroll="no" onload="doTitle();self.focus()" bgcolor="#000000" text="#FFFFFF">');
        //writeln('<body scroll="no" onload="doTitle();self.focus()">');
        writeln('<img src="'+imageLocation+'" align="left" style="display:block">');
        writeln('<span class="main_font">' + windowText + '</span>');
        writeln('</body>');
        writeln('</html>');
        close();
    }
}