/**
 * SWFFullWindow
 * @version 1.1
 * @author  Kenichi Nagai and Masayuki Emi
 * Licensed under the MIT License:
 * http://www.opensource.org/licenses/mit-license.php
 */
function SWFFullWindow(swfContainerId, minWidth, minHeight){
	this.minWidth = minWidth;
	this.minHeight = minHeight;
	this.swfContainer = document.getElementById(swfContainerId);
	this.init();
}
SWFFullWindow.prototype = {
	minWidth: 0,
	minHeight: 0,
	swfContainer: null,
	init: function(){
		var html = document.getElementsByTagName("html")[0];
		var body = document.body;
		html.style.height = "100%";
		body.style.height = "100%";
		body.style.margin = "0";
		body.style.padding = "0";
		this.swfContainer.style.height = "100%";
		var scope = this;
		window.onresize = function(){
			scope.onWindowResize();
		}
		window.onresize();
	},
	onWindowResize: function(){
		// get winsow size
		var ww, wh;
		if(self.innerHeight){
			ww = self.innerWidth;
			wh = self.innerHeight;
		}else if(document.documentElement && document.documentElement.clientHeight){
			ww = document.documentElement.clientWidth;
			wh = document.documentElement.clientHeight;
		}
		// set container size
		var c = this.swfContainer;
		var mw = this.minWidth;
		var mh = this.minHeight;
		c.style.width = (ww < mw) ? mw + "px": "100%";
		c.style.height = (wh < mh) ? mh + "px": "100%";
		// set scrollbar style for IE
		var html = document.getElementsByTagName("html")[0];
		if(navigator.userAgent.indexOf("MSIE") != -1){
			html.style.overflow = (ww < mw || wh < mh) ? "scroll": "hidden"; 
		}else{
			html.style.overflow = "visible"; 
		}
	},
	toString: function(){
		return "[SWFFullWindow minWidth=" + this.minWidth + ", minHeight=" + this.minHeight + "]";	
	}
}