/**
 * UGCpresenter v1.0: Embedding and configuring a flash slideshow for UGC content.
 */
if(typeof wales == "undefined") var wales = new Object();
wales.UGCpresenter = function(width, height){
	if (!document.getElementById) { return; }

	this.attributes = new Array();
	
	var width = width ? width : 648;
	var height = height ? height: 360;
	var lowversion = lowversion ? lowversion: 'You need Flash 8 to see this slideshow';

}



wales.UGCpresenter.prototype = {
	setAttribute: function(name, value){
		this.attributes[name] = value;
	},
	getAttribute: function(name){
		return this.attributes[name];
	},
	setConfig: function(configxml){
		this.attributes['config'] = configxml;
	},
	setEntries: function (entriesxml) {
		this.attributes['entries'] = entriesxml;
	},
	setSize: function(width, height){
		this.attributes['width'] = width;
		this.attributes['height'] = height;
	},
	embed: function(holder){
	
		var myFlashMovie = new bbcjs.plugins.FlashMovie("/wales/flash/ugcpresenter/ugcpresenter.swf");
		myFlashMovie.version = 8;
		myFlashMovie.width = this.getAttribute('width');  
		myFlashMovie.height = this.getAttribute('height'); 
		myFlashMovie.loop = true;
		myFlashMovie.lowversion = this.getAttribute('lowversion');
		myFlashMovie.flashvars = 'config=' + this.getAttribute('config') + '&htmlWidth=' + this.getAttribute('width') + '&htmlHeight=' + this.getAttribute('height') + '&entries=' + this.getAttribute('entries');
		myFlashMovie.id = "ugcpresenter";
		myFlashMovie.quality = "high";
	
		myFlashMovie.noPluginMsg = myFlashMovie.lowversion;
		
		if(holder) {
			myFlashMovie.insert(holder);
		}else{
			myFlashMovie.embed();	
		}
		return false;
	}
}
/* add Array.push if needed (ie5) */
if (Array.prototype.push == null) { Array.prototype.push = function(item) { this[this.length] = item; return this.length; }}


var UGCpresenter = wales.UGCpresenter;
