$(document).ready(function(){
	
	$('h1.logo').click(function(){
		
		window.location = '/';
	});

	var classNames = {
						0: 'yellow',
						1: 'green',
						2: 'blue'
					}

	$('ul.nav-box a').each(function(index) {

		$(this).addClass(classNames[index % 3])
	});
	
	if ($('.cals').length > 0){

		$('.cals').cycle({
			
			fx:			'fade', 
			speed:		'fast', 
			timeout:	0, 
			next:		'.controls .next', 
			prev:		'.controls .prev',
			after:		function(){ 
							
							if (this.id != 0){

								$('.controls .prev').show(); 
							
							} else {
								
								$('.controls .prev').hide(); 
							}

							if (this.id != 11){

								$('.controls .next').show(); 
							
							} else {
								
								$('.controls .next').hide(); 
							}
						}
		});
	}

	$('body.page-23 #copy img').next().remove();
	
	$('body.page-4 #copy p').addClass('no-image');
	$('body.page-4 #copy p img').closest('p').removeClass('no-image');

	$('.anchor-head').each(function(){
		
		var x		= $(this).offset().left;
		var y		= $(this).offset().top;
		var img		= $('#img-' + $(this).attr('rel'));

		img.css('position', 'absolute');
		img.css('top', (y - 70) + 'px');
		img.css('left', '0px');
		img.css('z-index', '9999');
	});

	$('#nav').hover(function(){
		
		$('#body').css('position', 'static');
	}, 
		
		function(){
			$('#body').css('position', 'relative');
		}
	);

	$('#home-table .col-3 p:last').addClass('tiny');
});