/* 
Methods for resizing the flash stage at runtime.

If flash window width or height is less than the minimum value, the div is set to the minimum, allowing for scrollbars

setFlashSize(divid)
divid: id of the div containing the flash movie.

canResizeFlash()
returns true if browser supports resizing flash, false if not. 

*/
function canResizeFlash(){
	var ua = navigator.userAgent.toLowerCase();
	var opera = ua.indexOf("opera");
	if( document.getElementById ){
		if(opera == -1) return true;
		else if(parseInt(ua.substr(opera+6, 1)) >= 7) return true;
	}
	return false;
}

function resizeFlashById(divid){
	var dimensions = getDim();
	var curW = dimensions.width;
	var curH = dimensions.height;
	var divStyleW = Element.getStyle(divid, 'width' );
	var divStyleH = Element.getStyle(divid, 'height' );
	if (curW < minWidth) {
		Element.setStyle(divid, {width:minWidth+"px"} );
	} else {
		Element.setStyle(divid, {width:"100%"} );
	}
	if (curH < minHeight) {
		Element.setStyle(divid, {height:minHeight+"px"} );
	} else {
		Element.setStyle(divid, {height:'100%'} );
	}
}
function getDim() { var w=0; var h=0; if (self.innerWidth) { w = self.innerWidth; h = self.innerHeight; } else if (document.documentElement && document.documentElement.clientWidth) { w = document.documentElement.clientWidth; h = document.documentElement.clientHeight; } else if (document.body) { w = document.body.clientWidth; h = document.body.clientHeight; } else { return; } return { width:w,height:h } }

function resizeFlash(){
	resizeFlashById('flashDiv');
	//alert('set flash size')
}

window.minWidth=800;
window.minHeight=600;

window.onresize=resizeFlash;
window.onload=resizeFlash;
