function openPopUp(url, width, height, wname) 
{
	var scrW = window.screen.availWidth;
	var scrH = window.screen.availHeight;
	var w, h, wnm;
	if (!(w = width)) w = 640;
	if (!(h = height)) h = 480;
	var l = (Math.round((scrW - w) / 2));
	var t = (Math.round((scrH - h) / 2) - 20);
	if (!(wnm = wname)) wnm = '_blank';

 
	var sFeatures = "toolbar=0"
					+ ", directories=0"
					+ ", status=0"
					+ ", menubar=0"
					+ ", scrollbars=1"
					+ ", resizable=1"
					+ (", width=" + w)
					+ (", height=" + h)
					+ (", left=" + l)
					+ (", top=" + t);
 
	var newWin = window.open(url, wnm, sFeatures);
	newWin.status = "";
	newWin.focus();
}

function closePopUp (method) {
	switch (method) {
		case 'close' : {
			if (isObject(window.opener)) window.opener.focus(); 
			window.close();
			} break;
		case 'parentReload' : {
			if (isObject(window.opener) && !opener.closed) {
				window.opener.focus(); 
				window.opener.location.reload(); 
			}
			window.close();
			} break;
		default: this.window.close();
	}
	return true;
}

function isObject (obj) {
	if (typeof(obj) == 'object' && obj) { return true; }
	else { return  false ;}
}	
