jQuery(document).ready(function($) {
	var start_offset = - Math.floor(Math.random() * 4020);

	if ((start_offset + 180) < -3850) start_offset = -3850;

	var offset1 = start_offset;
	var offset2 = start_offset + 180;

	function scroll_background() {
   		offset1--; offset2--;

		if (offset2 == -3850) {
			offset1 = 0;
			offset2 = 180;
		}

   		$('#head-wrap, #foot-grad').css('background-position', '0 ' + offset1 + 'px');
   		$('#color-nav-grad').css('background-position', '0 ' + offset2 + 'px');

   		setTimeout(function() { scroll_background(); }, 40);
   	}

	// Start the animation
	scroll_background();

	// Init facebox
	$('a[rel*=facebox]').facebox();
});
