function SWFAlign(swfid)
{
	this._swfid = swfid;
	this._width = 0;
	this._height = 0;
	this.scrollX = 0;
	this.scrollY = 0;
	
	this.unFocus = unFocus;
	this.getValues = getValues;
	this.getInnerWidth = getInnerWidth;
	this.getInnerHeight = getInnerHeight;
	this.resizeSWF = resizeSWF;


	function unFocus()
	{
		//alert('unFocus');
		document.getElementById('focme').focus();
	}

	// modified from http://www.howtocreate.co.uk/tutorials/javascript/browserwindow
	function getValues() {
	  var myWidth = 0, myHeight = 0;
	  if( typeof( window.innerWidth ) == 'number' ) {
	    //Non-IE
	    myWidth = window.innerWidth;
	    myHeight = window.innerHeight;
	  } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
	    //IE 6+ in 'standards compliant mode'
	    myWidth = document.documentElement.clientWidth;
	    myHeight = document.documentElement.clientHeight;
	  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
	    //IE 4 compatible
	    myWidth = document.body.clientWidth;
	    myHeight = document.body.clientHeight;
	  }
	  this._width = myWidth;
	  this._height = myHeight;
	}
	function getScrollXY() {
	  var scrOfX = 0, scrOfY = 0;
	  if( typeof( window.pageYOffset ) == 'number' ) {
	    //Netscape compliant
	    scrOfY = window.pageYOffset;
	    scrOfX = window.pageXOffset;
	  } else if( document.body && ( document.body.scrollLeft || document.body.scrollTop ) ) {
	    //DOM compliant
	    scrOfY = document.body.scrollTop;
	    scrOfX = document.body.scrollLeft;
	  } else if( document.documentElement && ( document.documentElement.scrollLeft || document.documentElement.scrollTop ) ) {
	    //IE6 standards compliant mode
	    scrOfY = document.documentElement.scrollTop;
	    scrOfX = document.documentElement.scrollLeft;
	  }
	  return [ scrOfX, scrOfY ];
	}

	function getInnerWidth()
	{
		this.getValues();
		return this._width;
	}
	function getInnerHeight()
	{
		this.getValues();
		return this._height;
	}

	// Scroll feature originating from Hoss Gifford, http://hossgifford.com/
	// found @ http://www.flashinsider.com/2006/07/14/stop-making-flash-scrollbars/ 
	function resizeSWF(nHeight)
	{
		this.getValues();
		if (nHeight>this._height)
		{
			nHeight += 30;
			nHeight += "px";
			document.getElementById(this._swfid).style.height = nHeight;
		}else{
			// keep it at least 100% high.
			document.getElementById(this._swfid).style.height = '100%';
		}
	}

	window.onresize = function()
	{
		//alert(swfid);
		swfAlign.getValues();
		document.getElementById(swfid).setInnerWidth(swfAlign._width);
		document.getElementById(swfid).setInnerHeight(swfAlign._height);
		document.getElementById(swfid).onResize(true);
		//alert( document.all ? document.body.scrollTop : window.pageYOffset );
	}
//	window.onscroll = function(ev)
//	{
//		swfAlign.scrollY = document.all ? document.body.scrollTop : window.pageYOffset;
//		document.getElementById(swfid).setScrollY(swfAlign.scrollY);
//	//	document.getElementById(swfid).onResize(true);
//	return true;
//	}
}

