var w = window;
var w_width, w_height;

function openW(url, x, y, opt) {
	if (isNaN(x = parseInt(x))) { x = 400; }
	if (isNaN(y = parseInt(y))) { y = 450; }

	if ((w == window) || w.closed) {
		w = open(url,'_blank','width=' + x + ',height=' + y + opt);
		w_width  = x;
		w_height = y;
	} else {
		if ((w_width != x) || (w_height != y)) {
			w.close();
			w = open(url,'_blank','width=' + x + ',height=' + y + opt);
			w_width  = x;
			w_height = y;
		}
		w.location.href = url;
		w.focus();
	}

	return false;
}

function openWin(url, x, y) {
	var opt = ',toolbar=0,location=0,directories=0,status=1,menubar=1,scrollbars=1,resizable=1';

	if (isNaN(x = parseInt(x))) { x = 400; }
	if (isNaN(y = parseInt(y))) { y = 450; }

	openW(url, x, y, opt);

	return false;
}

function openWin2(url, x, y) {
	var opt = ',toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=1,left=0,top=0,screenX=0,screenY=0';

	if (isNaN(x = parseInt(x))) { x = 400; }
	if (isNaN(y = parseInt(y))) { y = 450; }

	openW(url, x, y, opt);

	return false;
}

function openWin3(url, x, y) {
	var opt = ',toolbar=0,location=1,directories=0,status=1,menubar=0,scrollbars=1,resizable=1';

	if (isNaN(x = parseInt(x))) { x = 400; }
	if (isNaN(y = parseInt(y))) { y = 450; }

	openW(url, x, y, opt);

	return false;
}

function openWin4(url, x, y) {
	var opt = ',toolbar=1,location=1,directories=0,status=1,menubar=1,scrollbars=1,resizable=1';

	if (isNaN(x = parseInt(x))) { x = 400; }
	if (isNaN(y = parseInt(y))) { y = 450; }

	openW(url, x, y, opt);

	return false;
}


