﻿function openWindow(url,param,wName,height,width)
{
	var nHeight=350,nWidth=400;
	if(! isnull(height))nHeight = height
	if(! isnull(height))nWidth = width
	
	wName = nz(wName,"defWin1")
	if(isnull(param)) param = "scrollbars=no,toolbar=no,resizable=0,left=0,top=0,width="+nWidth+",height="+nHeight

	var win = window.open(url, wName ,param);
	win.focus();
}

function openWindowReturnValue(url, param, wName, height, width) {
    var nHeight = 350, nWidth = 400;
    if (!isnull(height)) nHeight = height
    if (!isnull(height)) nWidth = width

    wName = nz(wName, "defWin1")
    //if (isnull(param)) param = "scrollbars=no,toolbar=no,resizable=0,left=3000,top=3000,width=" + nWidth + ",height=" + nHeight
    if (isnull(param)) param = "scrollbars=no,toolbar=no,resizable=0,left=30,top=30,width=" + nWidth + ",height=" + nHeight

    var win = window.open(url, wName, param);
    win.focus();

    return win;
}

///////////////////////////////////////////////////////////////////////////////////////////////////
// Tests whether the given argument is empty or null
function isnull(arg) 
{
	arg = arg+'';
	return (arg == '' || arg == 'null' || arg == 'undefined');
}

///////////////////////////////////////////////////////////////////////////////////////////////////
function nz(param,val)
{
	//if the param is null or 0 return val or "" if val not sopplied
	return(
		isnull(param)
		? ((!isnull(val)) ? val : "") 
		: param
	)
}


    