var Mediajunkies = {
	url: null,
	setBackground: function(url, object) 
	{
		$('.article').removeClass('white');
		$(object).find('.article').addClass('white');
	
		if(Mediajunkies.url != url && $('#background img').attr('src') != url)
		{
			$('#background').fadeOut(0, function() {
				$('#background img').attr('src', url).load(function() 
				{  	
					$('#background').fadeIn(0, function() {
						$('#background').stop();
					});

		  			Mediajunkies.url = url;
		  		});
	  		});
  		}
	}
}

var check = false;

$(document).ready(function() { 

	console.log($('.goto').length);

	if($('.goto').length)
	{		
		console.log('trigger');	

		$('html, body').animate({	
		    scrollTop: ($('.goto').offset().top - 10)
		}, 1000);
	}
		
	$('#background').hide();
	
	$('#background img').attr('src', $('#background img').attr('src')).load(function()
	{
		$('#background').fadeIn('fast');
	});
	
	/* Alternative way of displaying background for Internet Explorer */
	if (navigator.appVersion.indexOf("MSIE") != -1)
	{	
		if(parseFloat(navigator.appVersion.split("MSIE")[1]) < 9)
			$('#background').fadeIn('slow');
	}
	
	$('.category').click(function() { 
		if(!check)
		{
			$('.select').slideDown(function() {
				$('.select').stop();
				check = true;
				$('.arrows').css({'background':'url(http://www.mediajunkies.nl/wp-content/themes/mediajunkies/static/images/arrow_up.png)'});
			});
		}
		else
		{
			$('.select').slideUp(function() {
				$('.select').stop();
				check = false;
				$('.arrows').css({'background':'url(http://www.mediajunkies.nl/wp-content/themes/mediajunkies/static/images/arrow_down.png)'});
			});
			
			
		}
	});
	$('#logo').click(function() {
		$('html, body').animate( { scrollTop: 0 }, 'slow' );
	});
});
