/**
 * FlashScaler
 * 
 * @author Jonathan Nicol, f6design.com, f6design.com/journal/ 
 * Copyright 2006, Jonathan Nicol
 * Free for both personal and commercial use
 * 
 * Credits:
 * This class makes use of Simon Willison's addLoadEvent function (http://simon.incutio.com/archive/2004/05/26/addLoadEvent)
 * and viewport size capturing javascript by Peter-Paul Koch (http://www.quirksmode.org/viewport/compatibility.html)
 * 
 * @param {String} flashdiv
 * 		The div that contains the flash onject/embed tag. IE: the same div SwfObject writes to.
 * 
 * @param {Number} w
 * 		Minimum width of Flash Movie. If browser window is narrower, scrollbars will be forced.
 * 
 * @param {Number} h
 * 		Minimum height of Flash Movie. If browser window is shorter, scrollbars will be forced.
 *
 */ 

/* From Flash */
var flashWidth; var flashHeight;
function initializeFlashElement( w, h ) {
	flashObj = document.getElementById("flashcontent");
	window.onresize = doResize;
	setFlashDimensions( w, h );
	//doResize();
}
	function setFlashDimensions( w, h ){
		//alert( "Flash Width : " + w + " |  Flash height : " + h );
		flashWidth = w;
		flashHeight = h;
		doResize();
	}

/* End From Flash */
	function doResize() {		
		//alert( 'resize' );
		if (self.innerHeight) // all except Explorer
		{
			winW = self.innerWidth;
			winH = self.innerHeight;
		}
		else if (document.documentElement && document.documentElement.clientHeight)	// Explorer 6 Strict Mode
		{
			winW = document.documentElement.clientWidth;
			winH = document.documentElement.clientHeight;
		}
		else if (document.body) // other Explorers
		{
			winW = document.body.clientWidth;
			winH = document.body.clientHeight;
		}	
		//alert( "WINH : "+winH );
		//alert( "FH : " + flashHeight );
		if(winH<flashHeight) {
		//	alert( 'set to px ');
			flashObj.style.height = flashHeight+"px";
			
		} else {
			//alert( 'set to 100');
			flashObj.style.height = "100%";
		}
		if(winW<flashWidth) {
			flashObj.style.width = flashWidth+"px";
		} else {
			flashObj.style.width = "100%";
		}	
	}