	
$(document).ready(
		function() {
			var count=$('.text').size();
			jQuery.fn.highlightnumbers = function(image) {
				for(a=0;a<count-1;a++){
					if(a==image){
						$('.bildli').eq(a).children().text(a+1);
						$('.bildli').eq(a).children().css('color','black');
					}else{
						var lien="<a href='#' name='"+a+"'>"+(a+1)+"</a>";
						//alert(lien)
						$('.bildli').eq(a).children().html(lien);
						$('.bildli').eq(a).children().css('color','#999');
					}
				}
				if(image==count-1){
					$('#info').children().text('Info');
					$('#info').children().css('color','black');
				}else{
					lien="<a href='#'>Info</a>";
					$('#info').children().html(lien);
					$('#info').children().css('color','#999');
				}
				
				
				var legend=$('.nextbild').eq(image).attr("name");
				if(image<count-1){
					$('#myLegend').text(legend);
				}else{
					$('#myLegend').text('');
				}
				
			}
			
			$('.bildli').highlightnumbers(0);
			$('.text').hide();
			$('.text').eq(selected).show();
			//$('.snav:eq(0)').css('color','black');
			$('.snav').click(function(){
					var i=$(this).attr('name');
					$('.text:not(i)').hide();
					//$('.text').eq(i).show();//fadeIn('fast');
					
					//$('.snav:not(i)').css('color','#888');
					//$(this).css('color','black');
					
			});	
			//var selected;
			$('.images').eq(selected).css('color','black');
			
			$('.images').hover(function(){
					var i=$(this).attr('name');
					$('.text:not(i)').hide();
					$('.text').eq(i).show();
					
					$('.images:not(i)').css('color','#888');
					$(this).css('color','black');
			});	
			
			//////////////////
			var image=0;
			$('.nextbild').click(function(){		  
					image=(parseInt(image)+1);
					$('.text:not(image)').hide();
					$('.text').eq(image).show();
					$(this).highlightnumbers(image);
			});	
			$('#info').click(function(){
					image=count-1;
					$('.text:not(image)').hide();
					$('.text').eq(image).show();
					$(this).highlightnumbers(image);
			});
			
			$('.bildli').click(function(){
					image=$(this).attr("name");
					$('.text:not(image)').hide();
					$('.text').eq(image).show();
					$(this).highlightnumbers(image);
					
			});
			
			/////////////////
			$('.introbutton').click(function(){
					$('.content').show();
					$(this).fadeOut('fast');						   
			});
			$('.content').show();
			$('.intro').pause(2000).fadeOut('slow');
			
		}
	);
