function PPopupPosition(iWidth, iHeight){
	var aCenter = new Array();
	try {
		aCenter[0] = Math.round((screen.availWidth/2) - (iWidth/2));
		aCenter[1] = Math.round((screen.availHeight/2) - (iHeight/2));
		if(aCenter[0] < 0) aCenter[0] = 0;
		if(aCenter[1] < 0) aCenter[1] = 0;
	} catch (e) {
		alert(e);
	}
	return aCenter;
}

function PPopupFocus(iCounter) {
	try {
		var sAgent = navigator.userAgent;
		if(sAgent.indexOf("Macintosh") > 0 && sAgent.indexOf("Safari") > 0 && sAgent.indexOf("Macintosh") < sAgent.indexOf("Safari")) {
			//mac safari hack
			self.blur();
		}
		self.focus();
		//iCounter++;
		//if(iCounter>2)return;
		//window.setTimeout("IRTPopupFocus("+iCounter+")", 1000);
	} catch (e) {
		alert(e);
	}
}

function POpenPopup(sUrl, iWidth, iHeight) {
	try {
		var dim = PPopupPosition(iWidth, iHeight);
		var PPopup = window.open(sUrl, "PPopup", "width="+iWidth+",height="+iHeight+",left="+dim[0]+",top="+dim[1]+",menubar=no,toolbar=no,location=no,status=no");
		self.blur();
		PPopup.focus();
	} catch (e) {
		alert(e);
	}

    
  }
