//---------------------------------------------------------------------------
//
//  flashBridge
//	v2.0
//
//  Created by: Bob Corporaal - reefscape.net on 07-11-2008.
//	Contact: bob@reefscape.net - http://reefscape.net
//
//
//	v2.0	7-11-08
//	- simplified for use with actionscript 3 & MooTools
//
//
//	MIT / X11 License
//
//	Copyright (c) 2006 Bob Corporaal - reefscape.net
//	
//	Permission is hereby granted, free of charge, to any person obtaining a copy of 
//	this software and associated documentation files (the "Software"), to deal in 
//	the Software without restriction, including without limitation the rights to 
//	use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
//	of the Software, and to permit persons to whom the Software is furnished to do 
//	so, subject to the following conditions:
//	
//	The above copyright notice and this permission notice shall be included in all 
//	copies or substantial portions of the Software.
//	
//	THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 
//	IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 
//	FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 
//	AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 
//	LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 
//	OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 
//	SOFTWARE.
//---------------------------------------------------------------------------
//
//

var FlashBridge = function() {
	var flashElements = [];
	
	return {
			//
			//	change the height of a specific element
			//
			setHeight : function(elementID, height)
			{
				$(elementID).setStyle('height', height);
			},
			//
			//	change the width of a specific element
			//
			setWidth : function(elementID, width)
			{
				$(elementID).setStyle('width', width);
			},
			//
			//	get the size of an element
			//
			getSize : function(elementID)
			{
				var size = $(elementID).getSize();
				return size;
			},
			//
			//	change the width & height of a specific element
			//
			setSize : function(elementID, width, height)
			{
				$(elementID).setStyle('width', width);
				$(elementID).setStyle('height', height);
			},
			//
			//	standard morph to a size
			//
			morphToSize : function(elementID, width, height)
			{
				var effect = new Fx.Morph(elementID);
				effect.start({
				    'height': [$(elementID).getSize().y, height],
				    'width': [$(elementID).getSize().x, width]
				});
			},
			//
			//	standard morph to a height
			//
			morphToHeight : function(elementID, height)
			{
				$(elementID).tween('height',height);
				//var effect = new Fx.Morph(elementID);
				//effect.start({
				
				//    'height': [$(elementID).getSize().y, height]
				
				//});
			},
			//
			//	standard morph to a width
			//
			morphToWidth : function(elementID, width)
			{
				var effect = new Fx.Morph(elementID);
				effect.start({
				    'width': [$(elementID).getSize().x, width]
				});
			},
			//
			//	setDocumentTitle - to set document title
			//
			setDocumentTitle : function(str)
			{
				//document.title = str;
				SWFAddress.setTitle(str);
			},
			//
			//
			//
			sendInfoToJavascript : function(str)
			{
				document.htmlForm.receivedField.value = str;
			},
			//
			//
			//
			sendEventToJavascript : function(event)
			{
				receiveEvent(event);
			},
			//
			//
			//
			sendInfoToFlash : function () {
			 	$("flashContent").sendInfoToFlash(document.htmlForm.sendField.value);
			 },
			//
			//	alert - show alert (used to test the script)
			//
			alert : function(str)
			{
				alert(str);
			},
			//
			//	available
			//
			available : function()
			{
				return true;
			}
		}
}();


