// BANNER OBJECT
function Banner(objName, width, height){
	this.obj = objName;
	this.aNodes = [];
	this.currentBanner = 0;
	this.banWidth = width;
	this.banHeight = height;
	
};

// ADD NEW BANNER
Banner.prototype.add = function(bannerPath) {
	this.aNodes[this.aNodes.length] = new Node(this.obj +"_"+ this.aNodes.length, bannerPath);
};

// Node object
function Node(name, bannerPath) {
	this.name = name;
	this.bannerPath = bannerPath;
};

// Outputs the banner to the page
Banner.prototype.toString = function() {
		var str = ""
		var r = Math.ceil(Math.random() * this.aNodes.length);
		var iCtr = r - 1;
		
		str = str + '<span name="'+this.aNodes[iCtr].name+'" '
		str = str + 'id="'+this.aNodes[iCtr].name+'" ';
		str = str + 'bgcolor="#FFFCDA" ';	// CHANGE BANNER COLOR HERE
		str = str + 'align="center" ';
		str = str + 'valign="top" >\n';
			
		str = str + '<OBJECT '
		str = str + 'classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" '
		str = str + 'codebase="http://download.macromedia/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" '
		str = str + 'WIDTH="'+this.banWidth+'" '
		str = str + 'HEIGHT="'+this.banHeight+'" '
		str = str + 'id="bnr_'+this.aNodes[iCtr].name+'" '
		str = str + 'ALIGN="" '
		str = str + 'VIEWASTEXT>'
		str = str + '<PARAM NAME=movie VALUE="'+ this.aNodes[iCtr].bannerPath + '">'
		str = str + '<PARAM NAME=quality VALUE=high>'
		str = str + '<PARAM NAME=bgcolor VALUE=#FFFCDA>'
		str = str + '<EMBED ';
		str = str + 'src="'+this.aNodes[iCtr].bannerPath+'" '
		str = str + 'quality=high '
//			str = str + 'bgcolor=#FFFCDA '
		str = str + 'WIDTH="'+this.banWidth+'" '
		str = str + 'HEIGHT="'+this.banHeight+'" '
		str = str + 'NAME="bnr_'+this.aNodes[iCtr].name+'" '
		str = str + 'ALIGN="center" '
		str = str + 'TYPE="application/x-shockwave-flash" '
		str = str + 'PLUGINSPAGE="http://www.macromedia.com/go/getflashplayer">'
		str = str + '</EMBED>'
		str = str + '</OBJECT>'

		str += '</span>';

	return str;
};

// START THE BANNER ROTATION
Banner.prototype.start = function(){
	var thisBannerObj = this.obj;
}