// Window Scaling Functions

var winW=0;
var winH=0;
var winOW=0;
var winOH=0;
var brsr="";
var screenW=0;
var screenH=0;
var flashW=0;
var flashH=0;

function getWinSize() {
	screenW=screen.width;
	screenH=screen.height;
	
	if( typeof( window.innerWidth ) == 'number' ) {
		//Non-IE
		winW = window.innerWidth;
		winH = window.innerHeight;
		brsr = "Non-IE";
	}
	else {
		if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
			//IE 6+ in 'standards compliant mode'
			winW = document.documentElement.clientWidth;
			winH = document.documentElement.clientHeight;
			brsr = "IE 6+ in sc mode";
		}
		else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
			//IE 4 compatible
			winW = document.body.clientWidth;
			winH = document.body.clientHeight;
			brsr = "IE 4 compatible";
		}
		else {
			winW = -1;
			winH = -1;
			brsr = "unsupported";
		}
	}
}

function getOuterWinSize() {
	screenW=screen.width;
	screenH=screen.height;

	if( typeof( window.outerWidth ) == 'number' ) {
		//Non-IE
		winOW = window.outerWidth;
		winOH = window.outerHeight;
		brsr = "Non-IE";
	}
	else {
		if( document.body && ( document.body.offsetWidth || document.body.offsetHeight ) ) {
			//IE compatible
			winOW = document.body.offsetWidth;
			winOH = document.body.offsetHeight;
			brsr = "IE compatible";
		}
		else {
			winOW = -1;
			winOH = -1;
			brsr = "unsupported";
		}
	}
}

function getFlashSize() {
	flashW=document.getElementById("preloader").offsetWidth;
	flashH=document.getElementById("preloader").offsetHeight;
}

function setWinSize(factor) {
	getOuterWinSize();

	if ( (winOW==800) || (winOW==1024) || (winOW==1280) || (winOW==1400) || (winOW==1600) || (winOW==1680) || (winOW==1920) ) {
		alert("Please restore (un-maximize) the window and try again.");
	}
	else {
		if (factor==100) {
			winW0=744;winH0=564;
		}
		else if (factor==125) {
			winW0=928;winH0=696;
		}
		else if (factor==150) {
			winW0=1112;winH0=828;
		}
		else if (factor==175) {
			winW0=1296;winH0=960;
		}
		else if (factor==200) {
			winW0=1480;winH0=1092;
		}
		else {
			winW0 = winWorig;
			winH0 = winHorig;
		}
		top.window.resizeTo(winW0,winH0);
		getWinSize();
		top.window.resizeTo(winW0+(winW0-winW),winH0+(winH0-winH));
		getFlashSize();
		if (flashW > 0) top.window.resizeTo(winW0+(winW0-winW)+(winW0-8-flashW),winH0+(winH0-winH));
	}
}

function launchReadme() {
		window.open('support/su_scaling_readme_'+locale+'.htm', 'Help', config='width=448,height=280,scrollbars=1,resizable=1');
}
