var FlashWidth=0;
var FlashHeight=0;
var WrapID="WrapFlash";
var uai = new UAIdentifier();

function getBrowserWidth () {  
	if ( window.innerWidth ) { return window.innerWidth; }  
	else  if ( document.documentElement && document.documentElement.clientWidth != 0 ) { return document.documentElement.clientWidth; }  
	else if ( document.body ) { return document.body.clientWidth; }  
	return 0;  
}

function getBrowserHeight () {
	if ( window.innerHeight) { return window.innerHeight; }  
	else if ( document.documentElement && document.documentElement.clientHeight != 0 ) { return document.documentElement.clientHeight; }  
	else if ( document.body ) { return document.body.clientHeight; }  
	return 0;  
}

function setWrapWidth (WrapWidth) {  
	FlashWidth=WrapWidth;
	setFlaArea();
}

function setWrapHeight (WrapHeight) {  
	FlashHeight=WrapHeight;
	setFlaArea();
}

function setWrapSize (WrapWidth,WrapHeight) {  
	FlashWidth=WrapWidth;
	FlashHeight=WrapHeight;
	setFlaArea();
}

function setWrapID (IDName) {  
	WrapID=IDName;
}

function setFlaArea(){
	var WrapFlashElement = document.getElementById(WrapID);
	var Body = document.getElementsByTagName("body")[0];
	
	if(getBrowserWidth() > FlashWidth || FlashWidth == "0") {
		WrapFlashElement.style.width = "100%";
	} else {
		WrapFlashElement.style.width = FlashWidth+"px";
	}
	
	if(getBrowserHeight() > FlashHeight || FlashHeight == "0") {
		WrapFlashElement.style.height = "100%";
		if (uai.gecko) {
			Body.style.height = "100%";
			Body.style.position = "absolute";
		}
	} else {
		WrapFlashElement.style.height = FlashHeight+"px";
	}
}
window.onresize = setFlaArea;