/******************************************** Copyright Class ********************************************/
var copyrights = new Class({
///////////////////////////////////////////////// Options /////////////////////////////////////////////////
	options: {
		design:false,
		copy:false,
		sufix:''
     },
///////////////////////////////////////////////////////////////////////////////////////////////////////////



/////////////////////////////////////////////// Constructor ///////////////////////////////////////////////
	initialize:function(id,options) {	
/*############################################# properties ##############################################*/
		var that = this;			//holds the instance

		this.id = id;				//holds the module number
		this.setOptions(options);  //sets the options

		//adds the instance to the cache array
		copyrightsCache.addInstances(this);
		
		this.wrapperDiv = null;	//holds the copyright div wrapper
/*#######################################################################################################*/



/*############################################### methods ###############################################*/
		//creates the module content
		this.create = function(){
			this.wrapperDiv = $("copyrights_v"+this.id);		//get the copyright div wrapper
			
			//writes the design information
			if(this.options.design!='false')
				this.writeDesign();

			//writes the copyright information
			if(this.options.copy!='false')
				this.writeCopyright();
		};
		
		//writes the design information
		this.writeDesign = function(){
			var design = new Element('div', {'class': 'design'+this.options.sufix});
			var designLink = new Element('a', {'href':'http://www.strawberryworld.biz/','target':'_blank'});
			designLink.innerHTML = this.options.design;
			designLink.inject(design);
			design.inject(this.wrapperDiv);
		};
		
		//writes the copyright information
		this.writeCopyright = function(){
			var copy = new Element('div', {'class': 'copyrights'+this.options.sufix});
			copy.innerHTML = this.options.copy;
			copy.inject(this.wrapperDiv);
		};
/*#######################################################################################################*/
	}
///////////////////////////////////////////////////////////////////////////////////////////////////////////
});
copyrights.implement(new Events, new Options);
/*********************************************************************************************************/



/*************************************** Copyright Cache Object ******************************************/
var copyrightsCache = {
	instances:new Array(),		//holds the instances
	
	//adds an instance
	addInstances:function(obj){
		this.instances.push(obj);
	},
	
	//inicialize all instances
	loadInstances:function(){
		for (var i=0; i<this.instances.length; i++)
			this.instances[i].create();
	}
};
/*********************************************************************************************************/



/************************************ Initialize the Copyright instances *********************************/
window.addEvent("load",function(){
	copyrightsCache.loadInstances();
});
/*********************************************************************************************************/
