// JavaScript Document
var x = 0, y = 0; // default values
var winPopped = false;

function getResized(target){
	if(target== null){
		target = this;
	}else{
		target = eval('parent.'+target);
	}
	if (document.all) {
		x = target.screenLeft;
		y = target.screenTop;
	} else if (document.layers) {
		x = target.screenX;
		y = target.screenY;
	}
}
getResized();
var remoteWindow;
function popWin(theURL,winName,features,posTarget) {
		if(remoteWindow){
			remoteWindow.close();
		}
		getResized(posTarget);
 		remoteWindow = window.open(theURL,winName,features +',top='+y+',screenY='+y+',left='+x+',screenX='+x);
		if (remoteWindow.opener == null) remoteWindow.opener = self;
		remoteWindow.focus();
}

function popWinCentered(theURL,winName,w,h,features) {
		// get the width of the display
		var screen_width=window.screen.width 
		var screen_height=window.screen.height 

		// determine the requested placement
		var x = Math.round((screen_width-w)/2) 
		var y = Math.round((screen_height-h)/2) 

		if(remoteWindow){
			remoteWindow.close();
		}
 		remoteWindow = window.open(theURL,winName,features + ",width="+w+",height="+h+',top='+y+',screenY='+y+',left='+x+',screenX='+x);
		if (remoteWindow.opener == null) remoteWindow.opener = self;
		remoteWindow.focus();
}
