/**
 *
 * @author      TENDER
 * @link        http://www.tendercreative.com
 *
 */
 
var swfobject_utils = {

	isIphone : ((navigator.userAgent).indexOf("iPhone") > 0)

	/**
	 * If flash is not found will redirect to another url instead of displaying alternative content.
	 * It is reccommended to call this before the swfobject.embedSWF
	 *
	 * @param (String) 	path 			= Redirect URI
	 * @param (String) 	version 		= Minimum required flash version (Optional)
	 * @param (Bool) 	redirect_iphone = Weather or not iPhone traffic should be redirected (Optional)
	 *
	 * Example: swfobject_utils.redirectNoFlash('/noflash', 9)
	 */
	, redirectNoFlash : function(path, version, redirect_iphone) {

			if (!path) 		return;
			if (!version)	version = '9';

			if ((redirect_iphone && this.isIphone) || !swfobject.hasFlashPlayerVersion(version)) {			
				document.location = url;				
			}

	}


	/**
	 * Use this to create a full screen swfobject instance. Will maintain 100% on window resize.
	 *
	 * @param (String) 	swf = Id given to swf embed object (Optional)
	 * @param (Int) 	w 	= Minimum required with in px (Optional)
	 * @param (Int) 	h 	= Minimum required height in px (Optional)
	 * @param (String) 	div = Div id which contains embed (Optional)
	 *
	 * Example: swfobject_utils.createFullBrowserFlash(800, 600, 'container')
	 */
	, createFullBrowserFlash : function(swf, w, h, div) {

			// Don't continue is this is an iPhone.
			if (this.isIphone) return false;

			if (typeof swfobject == 'undefined') {
				alert('Error: Could not find instance of swfobject.');
				return false;
			}

			if (w) 		this.fullBrowserFlash.min_w = w;
			if (h) 		this.fullBrowserFlash.min_h = h;
			if (div) 	this.fullBrowserFlash.container_id = div;
			if (swf) 	this.fullBrowserFlash.swf_id = swf;

			swfobject.addDomLoadEvent(swfobject_utils.fullBrowserFlash.init);
	
	}
	
	, fullBrowserFlash : {
		
			min_w 			: 980
			, min_h			: 580
			, base_h 		: null
			, pad_h			: 100
			, container_id	: 'container'
			, swf_id		: null
		
			, init: function() {	
			
				var instance 	= swfobject_utils.fullBrowserFlash;
				instance.base_h = instance.min_h;
				
				swfobject.createCSS("html", "height:100%;");
				swfobject.createCSS("body", "height:100%;");		
				swfobject.createCSS("#"+instance.container_id, "margin:0; width:100%; height:100%; min-width:" + instance.min_w + "px; min-height:" + instance.min_h + "px;");
	
				window.onresize = function() {
					swfobject_utils.fullBrowserFlash.resize();
				};
				window.onresize();
	
			}

			, resize: function() {

				var instance 	= swfobject_utils.fullBrowserFlash;
				var el 			= document.getElementById(instance.container_id);
				var size 		= instance.getViewportSize(); 

				new_w 			= size[0] < instance.min_w ? (instance.min_w + "px") : "100%";
				new_h 			= size[1] < instance.min_h ? (instance.min_h + "px") : "100%";

				el.style.width	= new_w;
				el.style.height	= new_h;
			
				// Resize flash element too. This is required for Safari and IE6
				if (instance.swf_id && (swf = document.getElementById(instance.swf_id))) {
					swf.style.width		= new_w;
					swf.style.height	= new_h;
				}
			
			}
		
			, getViewportSize: function() { 
		
				var size = [0, 0]; 
				if (typeof window.innerWidth != "undefined") { 
					size = [window.innerWidth, window.innerHeight];
				} else if (typeof document.documentElement != "undefined" && typeof document.documentElement.clientWidth != "undefined" && document.documentElement.clientWidth != 0) {
					size = [document.documentElement.clientWidth, document.documentElement.clientHeight]; 
				}else {
					size = [document.getElementsByTagName("body")[0].clientWidth, document.getElementsByTagName("body")[0].clientHeight]; 
				}	
				return size; 
	
			}

			/**
			 * Call this method from within flash to set a new movie height.
			 * Note: It is no longer required to pass the embed id as it it set when init called
			 *
			 * @param (Int) 	h 		= New movie height
			 * @param (String) 	swf_id 	= Id given to swf embed object (Optional)
			 *
			 * Example: swfobject_utils.fullBrowserFlash.setFlashHeight(1200)
			 */		
			, setFlashHeight: function(h, swf_id) {

				h += this.pad_h; 

				if (swf_id) this.swf_id = swf_id;
				if (h == this.min_h) 	return;

				// Use the new height if greater then initial height, otherwise resize to initial height				
				this.min_h = (h > this.base_h) ? h : this.base_h;
			
				this.resize();
	
			}
	
	}

}


/* Added only to support legacy sites. You should not be using this */
function setMinHeight(h, swf_id) {
	swfobject_utils.fullBrowserFlash.setFlashHeight(h, (swf_id||null));
}

