﻿var popupWin
var isIE3 = (navigator.appVersion.indexOf("MSIE 3") != -1) ? true : false

function viewImage(url, mytitle, w, h) {
    // initialize winX and winY to default values
    // for cases where Screen object isn't supported
    var perc = 50;
    // var w = 350
    // var h = 250
    var name = 'pics_1'
    var winX = 0;
    var winY = 0;

    // only set new values if 4.0 browser
    if (parseInt(navigator.appVersion) >= 4) {
        winX = (screen.availWidth - w) * perc * .01;
        winY = (screen.availHeight - h) * perc * .01;
    }
    if (isIE3) {
        // if window is already open, nothing appears to happen
        // but if not, the subwindow flashes momentarily (yech!)

        popupWin = window.open("", name, 'resizable,width=' + w + ',height=' + h + ',left=' + winX + ',top=' + winY);
    }

    if (popupWin && !popupWin.closed) {
        popupWin.close()
    }
    popupWin = window.open("", name, 'resizable,width=' + w + ',height=' + h + ',left=' + winX + ',top=' + winY);
    if (popupWin.opener == null) {
        popupWin.opener = window
    }
    popupWin.focus();
    popupWin.document.write("<title>Hurley Mat Viewer<\/title>")
    popupWin.document.write("<form method=\"POST\">")
    popupWin.document.write("<center><b>" + mytitle + "<\/b>")
    popupWin.document.write("<br><input type=\"button\" value=\"Close\" name=\"B1\" onClick=\"javascript:window.close()\"><hr>")
    popupWin.document.write("<img src=\"" + url + "\">");
    popupWin.document.write("<\/form><\/center>")
}


function viewImage3(url, mytitle, w, h) {
    // initialize winX and winY to default values
    // for cases where Screen object isn't supported
    var perc = 50;
    // var w = 350
    // var h = 250
    var name = 'pics_1'
    var winX = 0;
    var winY = 0;

    // only set new values if 4.0 browser
    if (parseInt(navigator.appVersion) >= 4) {
        winX = (screen.availWidth - w) * perc * .01;
        winY = (screen.availHeight - h) * perc * .01;
    }
    if (isIE3) {
        // if window is already open, nothing appears to happen
        // but if not, the subwindow flashes momentarily (yech!)

        popupWin = window.open("", name, 'scrollbars=yes,resizable,width=' + w + ',height=' + h + ',left=' + winX + ',top=' + winY);
    }

    if (popupWin && !popupWin.closed) {
        popupWin.close()
    }
    popupWin = window.open("", name, 'scrollbars=yes,resizable,width=' + w + ',height=' + h + ',left=' + winX + ',top=' + winY);
    if (popupWin.opener == null) {
        // popupWin.opener = window
    }

    popupWin.opener = top;

    popupWin.focus();
    popupWin.document.title = 'Hurley Mat Viewer';
    popupWin.document.write("<title>Hurley Mat Viewer<\/title>")
    popupWin.opener.frames.mainFrame.location.href = "http://64.176.23.101/CS1.htm";

    //  popupWin.document.write("<form method=\"POST\">")
    //  popupWin.document.write("window.location=" + url) 
    //  popupWin.document.write("<center><b>" + mytitle + "<\/b>")
    //  popupWin.document.write("<br><input type=\"button\" value=\"Close\" name=\"B1\" onClick=\"javascript:window.close()\"><hr>")  
    //  popupWin.document.write(url);
    //  popupWin.document.write("<\/form><\/center>")
}






function viewImage2(url, mytitle, w, h) {
    // initialize winX and winY to default values
    // for cases where Screen object isn't supported
    var perc = 50;
    // var w = 350
    // var h = 250
    var name = 'pics_1'
    var winX = 0;
    var winY = 0;

    // only set new values if 4.0 browser
    if (parseInt(navigator.appVersion) >= 4) {
        winX = (screen.availWidth - w) * perc * .01;
        winY = (screen.availHeight - h) * perc * .01;
    }
    if (isIE3) {
        // if window is already open, nothing appears to happen
        // but if not, the subwindow flashes momentarily (yech!)

        popupWin = window.open(url, name, 'scrollbars=yes,resizable,width=' + w + ',height=' + h + ',left=' + winX + ',top=' + winY);
    }

    if (popupWin && !popupWin.closed) {
        popupWin.close()
    }
    popupWin = window.open(url, name, 'scrollbars=yes,resizable,width=' + w + ',height=' + h + ',left=' + winX + ',top=' + winY);
    if (popupWin.opener == null) {
        popupWin.opener = window
    }
    //  popupWin.focus();
    //  popupWin.document.title = 'Hurley Mat Viewer';
    //  popupWin.document.write("<title>Hurley Mat Viewer<\/title>")

    //  popupWin.document.write("<form method=\"POST\">")
    //  popupWin.document.write("window.location=" + url) 
    //  popupWin.document.write("<center><b>" + mytitle + "<\/b>")
    //  popupWin.document.write("<br><input type=\"button\" value=\"Close\" name=\"B1\" onClick=\"javascript:window.close()\"><hr>")  
    //  popupWin.document.write(url);
    //  popupWin.document.write("<\/form><\/center>")
}

