if (isMobile()) {
	window.location.href = 'mobile';
} else if (!DetectFlashVer(8, 0, 0)) {
	window.location.href = 'no-flash';
} else {
	$(document).ready(function(){
		if (isNewWindow()) {
			if (window.opener) {
				innerFlash();
				window.opener.location.href = 'splash';
				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';
				}, 1000);
			}
		} else {
			innerFlash();
		}
	});
}

function innerFlash(){
	$('#main').css('display', 'block');
	$('#main-media').media({
		version: '8,0', width: '100%', height: '100%', autoplay: true, src: urlBase + 'swf/site.swf', caption: false,
		attrs: { id: 'flashSite'},
		params: {
			allowScriptAccess: 'sameDomain',
			bgColor:"#66AC0E",
			quality: 'high'
		},
		flashvars: {
			urlBase: urlBase,
			'lg' : lg
		}
	});
}

function isMobile(){
	if (screen.width < 400){
		return false;
	}
}

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

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