	$(function(){

		$('.thumbs img').each(function(){
			var s = $('.show');
			var showsrc = s.attr('src');
			var el = $(this);
			var thissrc = el.attr('rel');
			var thisid = 'thumb_'+Math.floor(Math.random()*10001213123);
			
			$('#preload').append('<img src="'+thissrc+'" />');
			
			
			el.attr('id', thisid);
			
			if(thissrc == showsrc){el.fadeTo(1,0.3);}
		
			el.click(function(){
				s.fadeOut(500, function(){
					s.attr('src', thissrc);
					s.fadeIn();
				});
				$('.thumbs img:not(#'+thisid+')').fadeTo(1, 1);
				el.fadeTo(1,0.3);
				
				return false;
			}); // close click
					
		}); // close each
		
	}); // close docready
	
	
	function setactive (active, id) {
	
		if(typeof(id) == 'undefined'){var id = '#nav a';}
	
		active = active.replace(/[^0-9a-zA-Z]/g, '');
		active = active.toLowerCase();
	
		$(id).each(function(){
			var el = $(this);
			var thisname = el.html();
			thisname = thisname.replace(/[^0-9a-zA-Z]/g, '');
			thisname = thisname.toLowerCase();
			
			if(thisname == active){
			el.addClass('active').css({'text-decoration' : 'none', cursor : 'default'});
			
			if(thisname == 'news'){
				el.addClass('redback').removeAttr('style');
			}
			
			}
		
		});
	}
