if (!DetectFlashVer(9, 0, 0)) {
	window.location.href = 'no-flash';
} else {
	$(document).ready(function(){
		if (isNewWindow()) {
			if (window.opener) {
				innerFlash();
				window.opener.location.href = 'splash-renew-clinical';
				var windowWidth = window.outerWidth || document.documentElement.clientWidth;
				var windowHeight = window.outerHeight || document.documentElement.clientHeight;
				window.moveTo((screen.width / 2) - (windowWidth / 2 + 4), (screen.height / 2) - (windowHeight / 2 + 30));
			} else {						
				var maxW = screen.availWidth > 1680 ? 1680 : screen.availWidth - 8;
				var maxH = screen.availHeight > 1050 ? 1050 : screen.availHeight - 33;
				callOpen(window.location.href, maxW, maxH);

				setTimeout(function() {
					window.location.href = 'splash-renew-clinical';
				}, 8000);
			}
		} else {
			innerFlash();
		}
	});
}

function innerFlash(){
	$('#main').css('display', 'block');
	$('#main-media').media({
		version: '9,0', width: '100%', height: '100%', autoplay: true, src: 'swf/site.swf',	caption: false,
		attrs: { id: 'flashSite'},
		params: {
			allowScriptAccess: 'sameDomain',
			bgColor:"#172439",
			quality: 'high',
			wmode:'window'
		}
	});
}


function isNewWindow(){
	if ((screen.width > 1680 || screen.width < 1024) || (screen.height > 1050 || screen.height < 768)){
		return true;
	}
}

function callOpen(openPage, width, height){
	window.open(openPage, "AvonRenewClinical", "'toolbar=no,location=no,status=no,menubar=no,scrollbars=no,resizable=no,left=0,top=0,width="+width+",height="+height+ "'");
}