window.addEvent('domready', function() {
	
	thumbs	=	$$('a.category-thumb');
	for (i = 0; i < thumbs.length; ++i) {
		thumb	=	thumbs[i];		
		
		thumb.setStyle('cursor', 'pointer');
				
		thumb.addEvent('mouseover', function () {
			id		=	this.id.split('-')[1];
			this.style.background	=	"url(" + skindir + "categories/cat-" + id + "-ho.jpg)";
			
			teaser	=	$('cat-' + id + '-title');
			
			teaser.style.display	=	'block';
			
			width	=	teaser.getWidth();
			teaser.setStyle('margin-left', '-' + width + 'px');			
		});
		
		thumb.addEvent('mouseout', function () {
			id		=	this.id.split('-')[1];
			
			da	=	this.className.split(' ');
			
			if (da[(da.length-1)] != 'active-thumb') {
				this.style.background	=	"url(" + skindir + "categories/cat-" + id + ".jpg)";
			}			
			

			teaser	=	$('cat-' + id + '-title');
			teaser.style.display	=	'none';
		});
		
		
		thumb.addEvent('click', function () {
			id				=	this.id.split('-')[1];
			nodes_id		=	this.id.split('-')[2];
			
			url				=	serverpath + 'index.php?ID=' + nodes_id + '&cat_ID=' + id;
			window.location.href	=	url;
		});
	}
	 
});