if (!DetectFlashVer(8, 0, 0)) {
	window.location.href = 'no-flash.html';
} else {
	$(document).ready(function(){
		if (isNewWindow()) {
			if (window.opener) {
				innerFlash();
                    floater();
				window.opener.location.href = 'splash.html';
				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 > 1500 ? 1500 : screen.availWidth - 8;
				var maxH = screen.availHeight > 1000 ? 1000 : screen.availHeight - 33;
				callOpen(window.location.href, maxW, maxH);

				setTimeout(function() {
					window.location.href = 'splash.html';
				}, 8000);
			}
		} else {
			innerFlash();
               floater();
		}
	});
}

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

function isNewWindow(){
	if (screen.width > 1500 || screen.width < 1024){
		return true;
	}
}

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