﻿var loggedin = false;
var nw = '';
function openWindow(url, opts) {
	var s = $.extend({width: 500, height: 'auto'}, opts || {});
	if (nw && !nw.closed && nw.location)
		nw.location.href = url;
	else {
		s.height = s.height == 'auto' ? screen.height - 300 : s.height;
		var left = (screen.width / 2) - (s.width / 2);
		var top = (screen.height / 2) - (s.height / 2);
		nw = window.open(url, 'popup', 'scrollbars=yes,width='+s.width+',height='+s.height+',left='+left+',top='+top);
		if (!nw.opener)
			nw.opener = self;
	}
	if (window.focus)
		nw.focus();
}