 
var childWin = '';
 
function popup(url)
{
	//url += getQueryString();

	if (!childWin.closed && childWin.location) {
		childWin.location.href = url;
	} else {
		childWin=window.open(url,'name','height=500,width=600,scrollbars=yes,resizable=yes');
		if (!childWin.opener) childWin.opener = self;
		setTimeout("checkClose();", 1000);
	}
	if (window.focus) {childWin.focus()}
	return false;
}

function checkClose() {
    if (childWin) {
        if (childWin.closed && !self.done) {
	        childWin = null;
	        document.location = 'exitpoll.php';
        }
        setTimeout("checkClose();", 1000);
    }
}
 
function problem(msg) {
    document.write('<img src="images/buttons/start-grey.gif" alt="Cannot run tests" border=0/><br/>');
    document.write('<b>' + msg + '</b>');
}

function writeTestButton(test_link) {
    if (false) { // Set to true when maintaining the site
	    problem('The tests cannot be run right now because we are updating our server. Please try again in an hour or two.');
    } else if (is_opera) 
	    problem('The tests cannot run under Opera.<br/>Please use another browser, e.g. Firefox or Safari or Internet Explorer');
    else if (is_ie && (!is_Flash || is_FlashVersion < 6)) 
	    problem('A recent Adobe Flash plugin is required.<br/>Please download a copy from <a href="http://www.adobe.com/products/flashplayer/">Adobe</a>.');
    else if (is_ie && is_major < 5) 
	    problem('Internet Explorer version 5 or greater required.<br/>Please download a copy from <a href="http://www.microsoft.com">Microsoft</a>.');
    else {
        document.write('<a href="' + test_link + '" onclick="return popup(\'' + test_link + '\');">');
        document.write('<img src="images/buttons/start.gif" alt="Start The Test" border=0></a>');
    }
}

