﻿// *************************************************
// Window related javascript routines
// *************************************************

// -------------------------------------------------
// Opens popup window (aligned top left)
// -------------------------------------------------
function openPopup(url, width, height) 
{
    window.open(url,'popup','width=' + width + ',height=' + height +',left=0,top=0,toolbar=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no ,modal=yes');
} 

// -------------------------------------------------
// Opens popup window (centered)
// -------------------------------------------------
function openPopupCentered(url, width, height) 
{
    var x = (screen.width - width) / 2;
    var y = (screen.height - height) / 2;
    window.open(url,'popup','width=' + width + ',height=' + height +',left=' + x + ',top=' + y + ',toolbar=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no ,modal=yes');
}     

// -------------------------------------------------
// Refreshes the parent page and closes child window
// -------------------------------------------------
function closePopupWithParentRefresh()
{
    window.opener.document.forms(0).submit();
    self.close();
}

// -------------------------------------------------
// Generic centred popup window 
// -------------------------------------------------
function openGenericPopupCentred(url, windowname, width, height, toolbar, directories, status, menubar, scrollbars, resizable, modal) 
{
    var x = (screen.width - width) / 2;
    var y = (screen.height - height) / 2;
    
    window.open(url, windowname,
        + 'width=' + width 
        + ',height=' + height 
        + ',left=' + x 
        + ',top=' + y 
        + ',toolbar=' + toolbar 
        + ',directories=' + directories 
        + ',status=' + status 
        + ',menubar=' + menubar
        + ',scrollbars=' + scrollbars
        + ',resizable=' + resizable
        + ',modal=' + modal);
}  
