﻿var DetailWin = null;

window.onfocus = CloseAll;

function DescDetails(url, name, w, h) {

    //Window Property Parameters
    var w0, h0;
    var dirs = "no";
    var loc = "no";
    var menu = "no";
    var scrs = "yes";
    var stat = "no";
    var tool = "no";
    var resize = "yes";
    var top = "40";
    var left = "40";

    //This sets the height and width in pixels
    w0 = w;
    h0 = h;

    //Make sure the height and width are integers
    w0 = parseInt(w0);
    h0 = parseInt(h0);

    //Check to see if it's a printer friendly window
    if (name == 'printer') {
        menu = "yes";
        tool = "yes";
    }

    //Set up the window property variables for interpolation
    var features =
                'width=' + w0 +
                ',height=' + h0 +
                ',directories=' + dirs +
                ',location=' + loc +
                ',menubar=' + menu +
                ',scrollbars=' + scrs +
                ',status=' + stat +
                ',toolbar=' + tool +
                ',top=' + top +
                ',left=' + left +
                ',resizable=' + resize;

    //Open the window
    DetailWin = window.open(url, name, features);

    if (window.focus) {
        DetailWin.focus()
    }
}

function CloseAll() {
    if (DetailWin != null && DetailWin.open) DetailWin.close();
}