/**
 * @author rbraendli
 */

window.addEvent('domready',function(){
	images = document.getElementById("vs_references_images_thumbs").getElementsByTagName("img");
	for(a in images) {
		images[a].onclick = function() {
//			document.getElementById("vs_references_images_mainimage").getElementsByTagName("img")[0].src = this.getAttribute("rel");
		    var m = $('vs_references_images_main_image');
			var imageFile = vs_references_image[this.getAttribute("id")].src;
		    var fx = new Fx.Tween(m,{
		        duration: 700,
		        onComplete: function(){ 
		                m.setStyle('background-image','url(' + imageFile + ')');
		                m.fade('in');
		        }
		    });
		    fx.start('opacity',1,0);
			for (index in this.parentNode.getElementsByTagName("img")) {
				this.parentNode.getElementsByTagName("img")[index].className = "";
			}
			this.className = "active";
		}
	}
});




