


// Properties
var browsertype = "";
var container_min_width = 980;
var container_min_height = 559;
var container_max_width = 1600;
var container_max_height = 1240;
var container_id = "flashcontent";


// Browser Checks
if (navigator.userAgent.indexOf("Opera") != -1 && document.getElementById) 
	browsertype = "OP";
if (document.all)
	browsertype = "IE";
if (document.layers)
	browsertype = "NN";
if (!document.all && document.getElementById)
	browsertype="MO";



// Set ID Width
function setWidth (id, w)
{
	if (browsertype == "IE")
		eval("document.all." + id + ".style.width='" + w + "'");
	if (browsertype == "NN")
		eval("document." + id + ".width='" + w + "'");
	if (browsertype == "MO" || browsertype == "OP")
		eval("document.getElementById('" + id + "').style.width='" + w + "'");
}



// Set ID Height
function setHeight (id, h)
{
	if (browsertype == "IE")
		eval("document.all." + id + ".style.height='" + h + "'");
	if (browsertype == "NN")
		eval("document." + id + ".height='" + h + "'");
	if (browsertype == "MO" || browsertype == "OP")
		eval("document.getElementById('" + id + "').style.height='" + h + "'");
}



// Get Inner Width
function getInnerWidth ()
{
	var myWidth = 0;
	if (typeof(window.innerWidth) == 'number')
	{
		// Non-IE
    	myWidth = window.innerWidth;
	}
	else if (document.documentElement && (document.documentElement.clientWidth || document.documentElement.clientHeight))
	{
		// IE 6+ in 'standards compliant mode'
		myWidth = document.documentElement.clientWidth;
	}
	else if ( document.body && (document.body.clientWidth || document.body.clientHeight))
	{
		// IE 4 compatible
		myWidth = document.body.clientWidth;
	}
	return myWidth;
}



// Get Inner Height
function getInnerHeight ()
{
	var myHeight = 0;
	if (typeof(window.innerWidth) == 'number')
	{
		// Non-IE
		myHeight = window.innerHeight;
	}
	else if (document.documentElement && (document.documentElement.clientWidth || document.documentElement.clientHeight))
	{
		// IE 6+ in 'standards compliant mode'
		myHeight = document.documentElement.clientHeight;
	}
	else if (document.body && (document.body.clientWidth || document.body.clientHeight))
	{
		// IE 4 compatible
		myHeight = document.body.clientHeight;
	}
	return myHeight;
}



function scalePage ()
{
	var w = getInnerWidth();
	var h = getInnerHeight();
	//obj = document.getElementById("container");
	if (w < container_min_width)
	{
		setWidth(container_id, container_min_width + "px");
		//obj.style.width = 960 + "px";
	}
	else
	{
		setWidth(container_id, 100 + "%");
		//obj.style.width = 100 + "%";	
	}
	if (h < container_min_height)
	{
		setHeight(container_id, container_min_height + "px");
		//obj.style.height = 600 + "px";
	}
	else
	{
		setHeight(container_id, 100 + "%");
		//obj.style.height = 100 + "%";	
	}
}



function fullscreen ()
{
	var w = screen.availWidth;
	var h = screen.availHeight;
	if ( w > container_max_width) {
		w = container_max_width;
	}
	if ( h > container_max_height) {
		h = container_max_height;
	}
	self.resizeTo(w, h);
	
	var x = (screen.availWidth - container_max_width)/2;
	var y = (screen.availHeight - container_max_height)/2;
	if ( x < 0 ) {
		x = 0;
	}
	if ( y < 1 ) {
		y = 1;
	}
	self.moveTo(x,y);
}



//window.onresize = scalePage;
//window.onload = scalePage;
window.onload = fullscreen;
//addLoadEvent(fullscreen);
//addLoadEvent(scalePage);


