/**
 * FlashResize (http://www.think2loud.com)
 * A jQuery plugin for Full Browser Flash.
 * 
 * Version 1.2
 * Feb 2009
 *
 **/
(function($){
	$.fn.flashResize = function(options) {
		var defaults = {
   			minWidth: '100%',
   			minHeight: '100%',
   			checkHtml: true,
   			checkBody:true
  		};
  
  		var options = $.extend(defaults, options);
  		var htmlTag = $('html');
  		if(htmlTag.height() != '100%' && options.checkHtml){
  			htmlTag.height('100%');
  		}
  		var bodyTag = $('body');
  		if(bodyTag.height() != '100%' && options.checkBody){
  			bodyTag.height('100%');
  		}
  		
		return this.each(function() {
   			obj =  $(this);
   			var	theWindow = $(window)
   
   			if(theWindow.width() < options.minWidth && options.minWidth !='100%') {
	   	 		obj.width(options.minWidth);  
			}
			
			if(theWindow.height() < options.minHeight && options.minHeight != '100%') {
				obj.height(options.minHeight);	
			}
   
   			theWindow.resize(function(){
				if(options.minWidth != '100%') {
					if(theWindow.width() < options.minWidth) {
						obj.width(options.minWidth);	
					}
					else if(obj.width() != '100%') {
						obj.width('100%');
					}
				}
				if(options.minHeight != '100%') {
					if(theWindow.height() < options.minHeight) {
						obj.height(options.minHeight);	
					}
					else if(obj.height() != '100%') {
						obj.height('100%');
					}
				}
			});
  		});
 	};
})(jQuery);

