	/*
	=:project
	  RenaissanceCMS

	=:class
	  RenSlideShow

	=:since
	  0.3.1a

	=:last update
	  06/02/09

	=:status
	  in progress

	=:principle author
	  Rob chant

	=:notes
      JavaScript part of renaissance's slideshow functionality

	=:contains methods

		=:public
		  
		
		=:private


	=:contains properties

		=:public
		
		=:private


 	=:contains methods

		=:public
		  RenSlideShow(id,target,view,initial_image,use_activation,activated)

		=:private
		  activate()
		  deActivate()
		  initialize()
		  showImage(image)

	*/

function RenSlideShow(id,target,view,initial_image,use_activation,activated){

	this.initialize(id,target,view,initial_image,use_activation,activated);
}

RenSlideShow.prototype={
	
	id: null,
	target: null,
	view: null,
	use_activation: null,
	
	current: null,
	activated: null,

	initialize: function(id,target,view,initial_image,use_activation,activated){
		
		this.id=id;
		this.target=target;
		this.view=view;
		this.use_activation=use_activation;

		this.current=initial_image;
		this.activated=activated;

	},

	activate: function(){
	
		if(this.use_activation)
			{
			if(!this.activated)
				{
				$.id(this.target).style.display='block';
				this.activated=true;
				}
			}
	},

	deActivate: function(){
		
		if(this.use_activation)
			{
			if(this.activated)
				{
				$.id(this.target).style.display='none';
				this.activated=false;
			
				if(typeof this.current=='number')
					{	
					DomUtils.removeClassName('slide-show-'+this.id+'-activation-'+this.current,'on');
					this.current=false;
					
					$.id(this.target).innerHTML='';
					}
				}
			}
		
	},

	showImage: function(image){

		if(this.current!=image)
			{
			RenFront.Content.fetch(image,'image',this.view,this.target,'','');

			this.activate();

			if(typeof this.current=='number')
				DomUtils.removeClassName('slide-show-'+this.id+'-activation-'+this.current,'on');

			DomUtils.addClassName('slide-show-'+this.id+'-activation-'+image,'on');
		
			this.current=image;
			}
		else
			this.deActivate();
	}	

}
