// define and use a modal window of a browser

var ModalWin = null;
var NonModalWin = null;
var helpWnd = null;

function openModalWinBar(url, valWidth, valHeight, wndName)
{
    //	sticky_URL = url;
	if (!ModalWin || ModalWin.closed) {

	  var str = "height=" + valHeight + ",innerHeight=" + valHeight;
		  str += ",width=" + valWidth + ",innerWidth=" + valWidth;
	  if (window.screen) {
	  var ah = screen.availHeight - 30;
        var aw = screen.availWidth - 10;
        var xc = (aw - valWidth) / 2;
        var yc = (ah - valHeight) / 2;

        str += ",left=" + xc + ",screenX=" + xc;
        str += ",top=" + yc + ",screenY=" + yc;
	  str += ",toolbar=no, title=yes, status=no, menubar=no, scrollbars=yes, resizable=yes";
	  }	
	  
  	  ModalWin = window.open(url, ((wndName == null) ? "modalWin" : wndName), str);
	}
	else {
		ModalWin.focus();
	}
}

function focusModalWin()
{
	window.setTimeout("if (ModalWin && !ModalWin.closed) ModalWin.focus();", 25);
}

function redirectUrlInParent_AndClosePopup(url)
{
	window.opener.top.location=url;
	window.close();
}



// define and use a NON modal window of a browser

function openNonModalWin(url, valWidth, valHeight )
{
	NonModalWin = window.open(url, "ModalWin", 'resizeable=yes, scrollbars=yes, width=' + valWidth + ',height=' + valHeight);
}

