function openWindow(theURL,winName,features) {
    
    window.open(theURL,winName,features);
 
    try{ 
 
          var op = window.opener; 
           op.opener = self; 
          op.close(); 
 
    } 
   catch(er) 
      {} 
    self.close();
 
 }
 
var FormFocus = "";
var ObjName = "";
var modalWin = "";

function PopUp_DisplayExt(inpParam,winName,winWidth,winHeight,inpModal) {
	var ntop=(screen.height/2)-(winHeight/2);
	var nleft=(screen.width/2)-(winWidth/2);

	var strURL = inpParam;
	
	var strParam = 'resizable=no, scrollbars=yes, titlebar=no, toolbar=no, status=no, location=no, directories=no, copyhistory=no, menubar=no, width='+winWidth+', height='+winHeight+', top='+ntop+', left='+nleft;

	if (!inpModal) {
		var newWin = window.open(strURL,winName,strParam);
		newWin.focus();
	} else {
		switch (chkBrowser()) {
			case "IE":

				modalWin = window.open(strURL,winName,strParam);
				modalWin.focus();
			break;
			case "FF":
				winWidth += 5;
				winHeight += 30;
				ntop = (screen.height/2)-(winHeight/2);
				nleft=(screen.width/2)-(winWidth/2);
				strParam = 'dialogWidth:'+winWidth+'px;dialogHeight:'+winHeight+'px;help:off;status:no;resizable:no;dialogTop:'+ntop+'px;dialogLeft:'+nleft+'px';
				window.showModalDialog(strURL,winName,strParam);
			break;
			default:
				var newWin = window.open(strURL,winName,strParam);
				newWin.focus();
			break;
		}
	}

}  // New Dynamic Window
window.onfocus = function() {
	if (chkBrowser() == "IE") {
		if (modalWin) {
			if (!modalWin.closed) {
				modalWin.focus();
			}
		}
	}
}
function chkBrowser(){
	var brtype;
	var nua = navigator.userAgent;
	
	if (/MSIE (\d+\.\d+);/.test(nua)){ // Detects Internet Explorer
		brtype = "IE";
	} else if (/Firefox[\/\s](\d+\.\d+)/.test(nua)){ // Detects Firefox Browser
		brtype = "FF";
	} else {
		brtype = "OT";
	};

	return (brtype);
}