ProjectImageView = Class.create( {
	_images : null,
	_pointer : null,
	
	initialize: function() {
		this._images = new Array();
		this._pointer = 0;		
		
	},
	
	addImage: function (image) {
		this._images.push(image);
	},
	
	update: function (pointer) {		
		this._pointer = pointer;		
		// display image
		$('projectImage').setStyle({backgroundImage:'url('+this._images[this._pointer]+')'});		
		
		var links = $$('#projectImage a.projectImageViewLink');
        links.each(function(item) {
            item.removeClassName('selected');
        });
        
		$('projectImageViewLink'+this._pointer).addClassName('selected');
	},
	
	nextImage: function () {		
		if(this._pointer < this._images.size() -1) {
			this._pointer ++;
			this.update(this._pointer);
		} else if (this._pointer == (this._images.size() - 1)) {
			this._pointer = 0;
			this.update(this._pointer);		
		}
	},
	
	previousImage: function () {		
		if (this._pointer > 0) {
			this._pointer --;
			this.update(this._pointer);
		} else if(this._pointer == 0) {
			this._pointer = (this._images.size() - 1);
			this.update(this._pointer);
		}
	},
	
	toggleInfo: function () {
		$('linkBox').toggleClassName('hidden');
		$('projectInfo').toggleClassName('hidden');
	}	
});

var projectImageView;