/*
	version:
		1.1
		
	MODIFIED BY SONIC
		http://jibjub.com/
		+ removed the proportional scaling portion!
	
	homepage:  
		http://www.eberhardt.ca/swfresize/
	
	useage: 
		var sr = new SWFResize(_elementID, _minWidth, _minHeight);
			-- _elementID - the ID of the div used for the SWFObject
			-- _minWidth -- the minimum width of the SWF
			-- minHeight -- the minimum height of the SWF
		
	notes:
		It's a good idea to put this immediately before you put your "new SWFObject()" command, if you are using SWFObject

*/

if(typeof eberhardt=="undefined"){var eberhardt=new Object();}

eberhardt.SWFResize=function(_elementID, _minWidth, _minHeight){
	var element;
	var minWidth;
	var minHeight;
	if(!document.getElementById){return;}
	this.element = _elementID;
	this.minWidth =  (_minWidth == undefined) ? 0 : _minWidth;
	this.minHeight = (_minHeight == undefined) ? 0 : _minHeight;;
	
	eberhardt.addEvent(window, 'resize', eberhardt.delegate(this,this.resize), false);
	
	this.resize();
};

eberhardt.SWFResize.prototype={
	resize:function(){
		docWidth = document.body.clientWidth;
		docHeight = document.body.clientHeight;
		var newFlashWidth = docWidth;
		var newFlashHeight = docHeight;
		
		if (newFlashHeight < this.minHeight){
			newFlashHeight = this.minHeight;
		}
		
		if (newFlashWidth < this.minWidth){
			newFlashWidth = this.minWidth;
		}
		
		document.getElementById(this.element).style.width = newFlashWidth + "px";
		document.getElementById(this.element).style.height = newFlashHeight+ "px";
	}
}

var SWFResize = eberhardt.SWFResize;

// These two functions below are used to handle adding the event to the body onresize.
// They are too generic to actually be considered part of SWFResize, but I didn't want them to conflict with any other names,
// so I added them to "eberhardt".
eberhardt.delegate = function( that, thatMethod )
{
    return function(e) { return thatMethod.call(that,e); }
}

eberhardt.addEvent = function(el, eType, fn, uC) {
	if (el.addEventListener) {
		el.addEventListener(eType, fn, uC);
		return true;
	} else if (el.attachEvent) {
		return el.attachEvent('on' + eType, fn);
	} else {
		el['on' + eType] = fn;
	}
}

/*
deconcept.SWFObject.prototype.swfresize = function(){
	alert (this);	
}
*/