﻿// JScript File


//Simple script to open a new "popup" window

if(window.open)
{
    var newWindow;
    function openNewWindow(url, name, windowWidth, windowHeight)
    {
        newWindow = window.open(url, name, 'height=' + windowHeight + ',width=' + windowWidth + ',resizable=yes,scrollbars=yes,toolbar=no,location=no,directories=no,status=no,menubar=no,copyhistory=no');
    if (window.focus) newWindow.focus();
     return false;
    }  
}


//More robust script, but has multi-window limitation
/*
var htc = new function()
{};
htc.window = new function()
{
    var win = null,
        timer = null;

    function parseOptions(options)
    {
        var temp = [], values = [
            'height', 'width',
            'left', 'top',
            'resizable', 'scrollbars',
            'toolbar', 'menubar',
            'location', 'status'
        ];
      
        for (var i = 0, c = values.length; i < c; i++) {
            if (!options[values[i]]) continue;
            temp.push(values[i]+'='+options[values[i]]);
        }
        return temp.join(',');
    };                   
  
    this.open = function(url, options)
    {
        if (win === null || win.closed) {
            timer = clearInterval(timer);
            win = window.open(url, options.name || 'POPUP', parseOptions(options));
        }
       
        if (options.modal) {                   
            timer = setInterval(htc.window.focus, 100);
        } else {
            htc.window.focus();
        }
       
        return false;
    };
    this.focus = function()
    {
        try {
            win.focus();
        } catch (e) { return; }
    };
};*/