// JavaScript thumbshower - based on mootools 1.2


var Thumbshower = new Class({
    container: null,
	bigimg: null,
	
	initialize: function(container, bigimg) {
		
		this.container = $(container);
		this.bigimg = $(bigimg);
		if(this.container == null || this.bigimg == null) {
			return false;
		}
		this.container.getChildren().each(function(el) {
			if(el.get('tag') == "a" && el.get('href')) {
				hrefval = el.get('href').toLowerCase();
				hreftitle = (el.get('title')) ? el.get('title') : "no description";
				if(hrefval.contains('.png') || hrefval.contains('.gif')|| hrefval.contains('.jpg') || hrefval.contains('.jpeg')) {
					el.addEvent('click', function() {
						$(bigimg).fade('hide');
						img = new Asset.image(el.get('href'), {
							title: hreftitle,
							onload: function() {
								$(bigimg).set('src', el.get('href'));		
								$(bigimg).set('width', this.width);
								$(bigimg).set('height', this.height);
								$(bigimg).fade('in');
							}
						});
						return false;
					});
				}
			}
		});
		
	}
});

			
window.addEvent('domready', function() { var mythumb = new Thumbshower("objektthumbs", "imbigpic"); });
			