function OnlineKATSmartScale(flashElemIdParam, standardWidthParam, standardHeightParam, shouldHandleWindowResize){
this.standardWidth = standardWidthParam;
this.standardHeight = standardHeightParam;
this.flashElemId = flashElemIdParam;
if(shouldHandleWindowResize){
window["OnlineKAT" + flashElemIdParam] = this;
window.onresize = function(){ this["OnlineKAT" + flashElemIdParam].resizeFlash(); }
}
this._getBody = function(w){
return (w.document.compatMode && w.document.compatMode == "CSS1Compat") ? w.document.documentElement : w.document.body || null;
}
this._getWinSize = function(win){
if(!win) win = window;
var s = new Object();
if(typeof win.innerWidth != 'undefined'){
s.width = win.innerWidth;
s.height = win.innerHeight;
}else{
var obj = this._getBody(win);
s.width = parseInt(obj.clientWidth);
s.height = parseInt(obj.clientHeight);
}
return s;
}
this.windowWidth = function()
{
return this._getWinSize().width;
}
this.windowHeight = function()
{
return this._getWinSize().height;
}
this.resizeWindow = function (windowWidth, windowHeight)
{
window.resizeTo(windowWidth, windowHeight);
var winSize = this._getWinSize();
window.resizeTo(windowWidth + (windowWidth-winSize.width), windowHeight + (windowHeight-winSize.height));
}
this.resizeFlash = function()
{
var winSize = this._getWinSize();
fWidth = winSize.width;
fHeight = winSize.height;
var elemObject = document.getElementById(this.flashElemId);
if(fWidth>=this.standardWidth)
elemObject.width = fWidth;
else
elemObject.width = this.standardWidth;
if(fHeight>=this.standardHeight)
elemObject.height = fHeight;
else
elemObject.height = this.standardHeight;
}
}
