$(function() {
	
	$('.link')
		.mouseover(function(e) { 
            
            var src = $(this).attr('id');
            $(this).find('img').attr('src', 'http://mikekotsch.de/_img/follow/'+src+'.gif');
            $(this).find('h3').css({'color': '#0195be'});
                       
        })
        .mouseout(function() {
        
            var src = $(this).attr('id');
            $(this).find('img').attr('src', 'http://mikekotsch.de/_img/follow/'+src+'.png');
            $(this).find('h3').css({'color': '#343434'});
            
    });
    
    $('.nav')
		.mouseover(function(e) { 
            
            var src = $(this).attr('id');
            $(this).find('img').attr('src', 'http://mikekotsch.de/_img/projects/'+src+'/'+src+'.gif');
            $(this).find('h3').css({'color': '#0195be'});
                       
        })
        .mouseout(function() {
        
            var src = $(this).attr('id');
            $(this).find('img').attr('src', 'http://mikekotsch.de/_img/projects/'+src+'/'+src+'.png');
            $(this).find('h3').css({'color': '#343434'});
            
    });
    
    $('#me')
		.mouseover(function(e) { 
            
            $(this).attr('src', 'http://mikekotsch.de/_img/me.gif');
                       
        })
        .mouseout(function() {
        
            $(this).attr('src', 'http://mikekotsch.de/_img/me.png');
            
    });
    
    $('#mcdonalds').click(function() {
    	
    	window.location = '/projects/mcdonalds/meinburger/';
    });
    
    $('#audi').click(function() {
    	
    	window.location = '/projects/audi/sensorbanner/';
    });
    
    $('#o2').click(function() {
    	
    	window.location = '/projects/o2/';
    });
    
    $('#experiments').click(function() {
    	
    	window.location = '/projects/experiments/tagafriend/';
    });
});

function swapImages(){
  	
  	var $active = $('#myGallery .active');
  	var $next = ($('#myGallery .active').next().length > 0) ? $('#myGallery .active').next() : $('#myGallery img:first');
  	
  	$active.fadeOut(function(){
    $active.removeClass('active');
    $next.fadeIn().addClass('active');
  });
}

setInterval('swapImages()', 3000);
