var popupHandle;

function closePopup() {
if(popupHandle != null && !popupHandle.closed) popupHandle.close();
}


function displayPopupCentered(url,name,height,width,extraproperties) {
// url             -> name of file to display
// name            -> name of window, when created
// height          -> height of popuwindow
// width 	   -> width of popupwindow
// extraproperties -> for example 'scrollbar=1'
// example         -> <a href="javascript:void(0)" 
//                     onmouseover="window.status='Click for more information'; return true" 
//                     onClick="displayPopupCentered('smartpopuptext.txt','popup3',document.formtest.testheight.value,document.formtest.testwidth.value,'scrollbars=1');">Test POPCLICKCENTER</a>

var properties = "toolbar = 0, location = 0, height = " + height;
properties = properties + ", width=" + width;
var leftprop, topprop, screenX, screenY, cursorX, cursorY;

if(navigator.appName == "Microsoft Internet Explorer") {
	screenY = document.body.offsetHeight;
	screenX = window.screen.availWidth;
}
else {
	screenY = window.outerHeight
	screenX = window.outerWidth
}
leftvar = (screenX - width) / 2;
rightvar = (screenY - height) / 2;
if(navigator.appName == "Microsoft Internet Explorer") {
	leftprop = leftvar;
	topprop = rightvar;
}
else {
	leftprop = (leftvar - pageXOffset);
	topprop = (rightvar - pageYOffset);
}
properties = properties + ", left = " + leftprop;
properties = properties + ", top = " + topprop;

if(extraproperties != null) {
properties = properties + ", " + extraproperties;
}
closePopup();
popupHandle = open(url,name,properties);
}

