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 maxSizePopup(){
	//maxWidth = (screen.width>1280 ? 1280 : screen.width);
	//maxHeight = (screen.width>1024 ? 1024 : screen.height);
	if(screen.width>1160){
		maxWidth=1152;
		//
		left=(((screen.width-maxWidth)/2))-6;
	}else{
		maxWidth=screen.width;
	}
	if(screen.height>900){
		maxHeight=700;
		//
		top=((screen.height-maxHeight)/2)-25;
	}else{
		maxHeight=screen.height;
	}
}
function maxSizeWindow(){
	if( typeof( window.innerWidth ) == 'number' ) {
		//Non-IE
		myWidth = window.innerWidth;
		myHeight = window.innerHeight;
	} else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
		//IE 6+ in 'standards compliant mode'
		myWidth = document.documentElement.clientWidth;
		myHeight = document.documentElement.clientHeight;
	} else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
		//IE 4 compatible
		myWidth = document.body.clientWidth;
		myHeight = document.body.clientHeight;
	}
	  //window.alert( 'Width = ' + myWidth );
	 // window.alert( 'Height = ' + myHeight );
	if(myWidth>1160){
		maxWidth=1152;
		maxHeight=800;
		//
		window.resizeTo(maxWidth, maxHeight);
	} else {
		// do nothing
	}
}
function openFullScreen(url){
	maxSizePopup();
	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=no');
	//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 resizeWindow (url) {
	maxSizeWindow();
	window.location = url;
}
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()';

