var root = $webroot || "/release";

/* Controls the Flash Cards */
var ColourPalette = function(xml){
	this.params = {"quality":"high","wmode":"opaque"};
    this.flashvars = {"flashcardxml":root+"/includes/xml/"+xml};
}
ColourPalette.prototype = {
	render:function(identity){
		swfobject.embedSWF(root+"/includes/swf/colors.swf", identity, "368", "155", "8.0.0", "", this.flashvars, this.params);		
	}
}

/* Side promotion banner */

var SidePromotion = function(data) {
	this.params = {"quality":"high","wmode":"opaque"};
	this.data = data;
	this.flashvars = {};
	this.render();
}
SidePromotion.prototype = {
	render:function() {
		var data = this.data;
		swfobject.embedSWF(root + "/includes/swf/" + this.data, "side-promotion", "180", "264", "8.0.0", "", this.flashvars, this.params);
	}
}

/* Controls the Flash banner */
var Banner = function(data){
	if(!data || data.constructor != Array) return;
	this.data = data;
	this.turn = Math.floor(((new Date()).getTime()*Math.random())%this.data.length);
	this.params = {"quality":"high","wmode":"opaque"};
    this.flashvars = {};
    this.render();
}
Banner.prototype = {
	render:function(){
		if(this.data && this.data.length >= this.turn)
			swfobject.embedSWF(root + "/includes/swf/" + this.data[this.turn], "banner", "667", "69", "8.0.0", "", this.flashvars, this.params);		
	}
}

var Icon = function(data){
	if(!data || data.constructor != Object) return;
	this.data = data;
	this.params = {"quality":"high","wmode":"opaque"};
    this.flashvars = {};
    this.render();
}
Icon.prototype = {
	render:function(){
		var data = this.data;
		for(identity in data){
			if(document.getElementById(identity)){
				swfobject.embedSWF(root + "/includes/swf/" + this.data[identity], identity, "220", "104", "8.0.0", "", this.flashvars, this.params);		
			}
		}
	}
}