/////// ####################################################################################################
/////// WRITTEN BY TECHNICWEB - 11/05
/////// Fully Compliant With:
///////		- Windows XP
///////				- Internet Explorer 6.0
///////				- Mozilla 1.7.12
///////				- Mozilla Firefox 1.0.7
///////				- Netscape 7.2
///////				- Opera 8.5.0
///////		- Windows 2000
///////				- Internet Explorer 5.0
///////				- Netscape 7.2
///////				- Mozilla 1.7.12
///////				- Firefox 1.0.7
///////				- Opera 8.5.0
///////						
///////	Buggy:
///////		- Apple Mac OSX 10
///////				- All browsers
///////
///////	Purpose:
///////		Manager to render a flash movie programatically, in conjunction with the flashdetectionmanager.
/////// #####################################################################################################

function EstateWeb_Objects_FlashObjectManager(o){
	this.Parameters = new EstateWeb_Objects_FlashParameterCollection(); // Store any parameters that need to be added along with the flash movie
	this.DetectionObject = o; //Object required for flash detection and validation
	this.MovieURL = ""; // Relative or absolute URL of the movie to load
	this.MovieWidth = "100%"; // Initial Width of the movie
	this.MovieHeight = "100%"; // Initial Height of the movie
	this.MovieID = ""; // ID of the <object> tag within the DOM
}

EstateWeb_Objects_FlashObjectManager.prototype.Render = __EstateWeb_Objects_FlashObjectManager_Render;

function __EstateWeb_Objects_FlashObjectManager_Render(){
	// Displays the flash movie in the specified html tag
	this.ControlID = arguments[0];
	if ( this.DetectionObject.Detect() ){
		if ( EstateWeb_Objects_FlashObjectManager_GetObject(this.ControlID) ){
			var oObject = document.createElement("object");			
			for ( var i = 0; i < this.Parameters.Length(); i ++ ){
				var oParameter = document.createElement("param");
				oParameter.name = this.Parameters.Items[i].Name;
				oParameter.value = this.Parameters.Items[i].Value;
				oObject.appendChild( oParameter );
			}
			EstateWeb_Objects_FlashObjectManager_GetObject(this.ControlID).appendChild( oObject );
			oObject.type = "application/x-shockwave-flash";
			oObject.data = this.MovieURL;
			oObject.width = this.MovieWidth;
			oObject.height = this.MovieHeight;
			this.MovieID ? oObject.id = this.MovieID : "";
			oObject.VIEWASTEXT = "true";
		}
	} 
}

function EstateWeb_Objects_FlashParameterCollection(){
	this.Items = new Array(); // Holds an Array of type EstateWeb_Objects_FlashParameterItem
}

EstateWeb_Objects_FlashParameterCollection.prototype.Add = __EstateWeb_Objects_FlashParameterCollection_Add;
EstateWeb_Objects_FlashParameterCollection.prototype.Length = __EstateWeb_Objects_FlashParameterCollection_Length;

function __EstateWeb_Objects_FlashParameterCollection_Add(){
	this.Items[this.Items.length] = arguments[0];
}

function __EstateWeb_Objects_FlashParameterCollection_Length(){
	return this.Items.length;
}


function EstateWeb_Objects_FlashParameterItem(name,value){
	this.Name = (name ? name : "");
	this.Value = (value ? value : "");
}

function EstateWeb_Objects_FlashObjectManager_GetObject(ID){
	return HttpManager.Document.GetObject(ID);
}