﻿// JScript File

function openWindowSize(url, width, height, isResizable, pos_top, pos_left) {
//
// To open a Popup a window with specified size and position.
//
// Created by: Derek Chung at 8 April 2008
//
// Input: url           = URL of page to open.
//        width         = window width in px
//        height        = window height in px
//        isResizable   = Yes - can resize, No - fixed.
//        pos_top       = position in px of opened window starting from top 
//        pos_left      = position in px of opened window starting from left
//
//  Usage:    openWindowSize('mypage.aspx', 800, 600, Yes, 0, 0)      -- To popup at the top left hand corner
//      OR    openWindowSize('mypage.aspx', 800, 600, Yes)            -- To popup at the centre of the screen
//
        var features="status=no,resizable="+isResizable+",width="+width+",height="+height+",scrollbars=1,toolbar=0,titlebar=0,location=0,top=" + pos_top + ",left=" + pos_left;    
        winname = 'PopupWindow';  
        window.open(url,winname,features);    
}

function openWindowSize(url, width, height, isResizable) {
    // position at the centre of screen.
        var pos_left = (screen.width - width) / 2;  
        var pos_top = (screen.height - height) / 2;
        var features="status=no,resizable="+isResizable+",width="+width+",height="+height+",scrollbars=1,toolbar=0,titlebar=0,location=0,top=" + pos_top + ",left=" + pos_left;    
//        var winname = 'temp'+Math.round(1000*Math.random());  
        winname = 'PopupWindow';  
        window.open(url,winname,features);    
}


// Open window with Full size
function openWindowFullSize(url, isResizable)
{
    var width=screen.width-10;
    var height=screen.height-90;
    var features="status=yes,resizable=" + isResizable + ",width="+width+",height="+height+",scrollbars=1,toolbar=1,titlebar=1,location=1,top=0,left=0";
    //var winname = 'temp'+Math.round(1000*Math.random());
    winname = 'PopupWindow';  
    window.open(url,winname,features);
    //k.focus();
}


