function assignPopups(){
	popupLinkParents = new Array("high", "thankyou");
	for (var i=0; i<popupLinkParents.length; i++){
		if (document.getElementById(popupLinkParents[i])!=null) {
			var popupLinkParent = document.getElementById(popupLinkParents[i]);
			popupLinks = popupLinkParent.getElementsByTagName('a');
			for (var q=0; q<popupLinks.length; q++){
				popupLinks[q].onclick = function(){openFullScreen(this.href); return false;}
			}
		}
	}
		
	flashInstalledDiv = document.getElementById("flash-installed");
	if (flashInstalledDiv) {
		flashInstalledPopupLink = flashInstalledDiv.getElementsByTagName("a")[0];
		browserId = navigator.userAgent;
		if (browserId.indexOf('MSIE')==-1) {
			//alert("this is not IE");
			flashInstalledPopupLink.onclick = function () {
				openFullScreen(flashInstalledPopupLink.href);
				window.location.href = window.location.href.replace(/flash-installed\.php/,'');
				return false;}
		}
		else {
			flashInstalledPopupLink.onclick = function () {openPopupCloseWindow(flashInstalledPopupLink.href); return false;}
		}
	}
	
	noFlashDiv = document.getElementById("no-flash");
	if (noFlashDiv) {
		backtohtmlDiv = noFlashDiv.getElementsByTagName("div")[0];
		backtohtmlLink = backtohtmlDiv.getElementsByTagName("a")[0];
		backtohtmlLink.onclick = function () {redirectParentCloseWindow(backtohtmlLink.href); return false;}
	}

}
var maxHeight;// = screen.height;
var maxWidth;// = screen.width;
var top = 0;
var left = 0;
// commented out for HTML
function maxSize(){
	//maxWidth = (screen.width>1280 ? 1280 : screen.width);
	//maxHeight = (screen.width>1024 ? 1024 : screen.height);
	if(screen.width>1600){
		//alert ("hi");
		maxWidth=1440;
		left=(((screen.width-maxWidth)/2))-6;
	}else{
		maxWidth=screen.width;
	}
	if(screen.height>1000){
		maxHeight=900;
		top=((screen.height-maxHeight)/2)-25;
	}else{
		maxHeight=screen.height;
	}
}

function openFullScreen(url){
	maxSize();
	window.open(url,'newwin','height=' + maxHeight + ',width=' + maxWidth + ',top='+ top +',left='+ left +',x='+ left +',y='+ top +',status=no,toolbar=no,menubar=no,location=no,scrollbars=no,resizable=yes');
	//window.location.href = window.location.href.replace(/\/.*$/,'thankyou.php');
}

function openWin(url, name, h, w){
	window.open(url,name,'height=' + h + ',width=' + w + ',top=0,left=0,x=0,y=0,status=no,toolbar=no,menubar=no,location=no,scrollbars=no,resizable=yes');
}

function openPopupCloseWindow(url) {
	openFullScreen(url);
	// bypass the IE "Do you want to close this window?" dialog box
	window.focus();
	window.opener = window;
	window.close();
}

function redirectParentCloseWindow(url) {
	window.opener.location = url;
	// bypass the IE "Do you want to close this window?" dialog box
	window.focus();
	window.opener = window;
	window.close();
}


// Onload Init
onloadHandlers[onloadHandlers.length] = 'assignPopups()';
onloadHandlers[onloadHandlers.length] = 'maxSize()';
