
var Switchbox = {
	
	container: 		false,
	containerImage:	false,
	thumbnails:		false,
	
	/**
	 *	Initialize switchbox
	 */
	init: function(){
		if(this.container = $('switchbox')){
			this.containerImage	= this.container.getElement('img');
			this.thumbnails 	= $$('a.switchbox');
		
			this.thumbnails.each(function(link){
				link.onclick = function(){
					this.setContainerImage(link.rel);	
					return false;
				}.bind(this);
			}.bind(this));
		}		
	},
	
	/**
	 *	Set container image
	 */
	setContainerImage: function(filename){
		var originalUrl = '/nl/image/get/?process=original&file='+filename;
		var thumbnailUrl = '/nl/image/get/?process=resizewidth&width=280&proportions=true&file='+filename;
		
		this.container.href		= originalUrl;
		this.containerImage.src	= thumbnailUrl;
	}
	
};

fireOn = Window.ie ? 'load' : 'domready';
window.addEvent(fireOn, Switchbox.init.bind(Switchbox));

