﻿var win = null;
var loggedOn = false;

function showWindow(title, page)
{
    win = new Window({
    url:                page,
    options:            {method: 'get'},
    title:              title,
    className:          "window",
    id:                 'productinfo',
    width:              600,
    height:             400,
    minWidth:           600, 
    minHeight:          400,
    zIndex:             9999,
    minimizable:        false,
    showEffect:         Element.show,
    showEffectOptions:  {duration: 0},
    hideEffect:         Element.hide,
    hideEffectOptions:  {duration: 0},
    resizable:          false,
    maximizable:        false,
    draggable:          false,
    wiredDrag:          true,
    destroyOnClose:     true})

    win.showCenter(true);
    win.show();
    win.setConstraint(true, {left:150, right:150, top:50, bottom:50})

    // Set up a windows observer, check out debug window to get messages
    myObserver =
    {
        onDestroy: function(eventName, win)
        {
            if (loggedOn == true)
            {
                window.location = parent.document.location;
            }
            Windows.removeObserver(this);
        }
    }
    Windows.addObserver(myObserver);
}

function CloseShowWindow()
{
    //parent.document.location.reload();
    parent.document.location.replace(parent.document.location.href);
    top.Windows.close('productinfo', event);
}
function refreshPage() 
{ 
    window.location.reload(); 
}
