
// Open a full-chrome (all GUI elements) window
// This is like using a target="_blank" in a normal link but allows focussing the window
function openFullChromeWindow(url, name, openerName) {
	return openWindow(url, name, 'directories,location,menubar,resizable,scrollbars,status,toolbar');
}

// Core utility function that actually creates the window and gives focus to it
function openWindow(url, name, properties, openerName) {

	// ie4.x pc can't give focus to windows containing documents from a different domain
	// in this case, initially load a local interstisial page to allow focussing before loading final url
	var agent = navigator.userAgent.toLowerCase();
	if (agent.indexOf("msie") != -1 && parseInt(navigator.appVersion) == 4 && agent.indexOf("msie 5") == -1 && agent.indexOf("msie5") == -1 && agent.indexOf("win") != -1 && url.indexOf('http://') == 0) {
		winReference = window.open('about:blank', name, properties);
		
		setTimeout('if (winReference && !winReference.closed) winReference.location.replace("' + url + '")', 300);
	}
	else {
		winReference = window.open(url, name, properties);
	}

	// ie doesn't like giving focus immediately (to new window in 4.5 on mac; to existing ones in 5 on pc)
	setTimeout('if (winReference && !winReference.closed) winReference.focus()', 200);
	
	if (openerName) self.name = openerName;
	return winReference;
}

function onRequest() {
	window.opener.location.href="/replay";
	window.opener.focus();
	window.close();
}
	
function flashPopitup(url,hite,wit){if(promoPopup) {promoPopup.close()};
	var winH = (screen.height - hite) / 2;
	var winW = (screen.width - wit) / 2;
	var promoPopup=window.open(url, "promoPopup","resizable=no,menubar=no,status=no,toolbar=no,location=no,scrollbars=no,screenx=1,screeny=1,height=" + hite + ",width=" + wit + ",top="+winH+",left="+winW);
	promoPopup.focus();
}


