/* Author: Kai Gossel */

$(document).ready(function() {
	
	// Remove padding and border from last post on a page if page navigation is non-existent
	if (!$('#nav-below').length)
		$('#blog .posts .post').last().css({'padding-bottom' : '0', 'border-bottom' : 'none'});
	
	// Animated focus and blur effect for input fields
	$('#searchfield').focus(function() {
	    $(this).animate({boxShadow: '#3b86ba 0px 0px 6px', color: '#3b86ba' }, 100);
	});
	$('#searchfield').blur(function() {
	    $(this).animate({boxShadow: '#fff 0px 1px 0px', color: '#777' }, 100);
	});
	
	// Remove margin from last item in twitter-stream
	$('ul#list-twitterstream li').last().css({'margin-bottom' : '0'});
	
	// Remove margin-right and margin-bottom from 4th, 8th, 12th etc. item in flickr-stream
	var i = 1;
	$('ul#list-flickrstream li').each(function(index) {
		if(i == 4)
			$(this).css({ 'margin-right' : '0' });
		if(i > 4)
			$(this).css({ 'margin-bottom' : '0' });
		if(i == 8)
			$(this).css({ 'margin-right' : '0' });
		if(i >= 8)
			i = 0;
			
		i++;
	});
	
});
