$(document).ready(function() {

	// First + Last
	$('ul.people li:last-child').addClass('last');
	$('ul#navigation li:last').addClass('last');

	// Actives
	$('body#services li.services a, body#work li.work a, body#people li.people a, body#news li.news a, body#contact li.contact a').addClass('active');

	// Nav
	$('ul#navigation li a').parent().append('<em></em>');
	$('ul#navigation li a:not(.active)').hover(
		function(){
			$(this).parent().children('em').stop(true, true);
			$(this).parent().children('em').fadeIn('slow');

		},
		function(){
			$(this).parent().children('em').stop(true, true);
			$(this).parent().children('em').fadeOut('slow');
		}
	);

	// Sections
	$('#sections').cycle({
		fx: 'fade',
		cleartype: false,
		speed:  500, 
    	pager:   '#servicetabs',
		pagerAnchorBuilder: function(idx, slide) { 
           	return '#servicetabs li:eq(' + idx + ') a';
        },
    	timeout: 0
	});
	
	$('#display').cycle({
		fx: 'fade',
		speed:  500, 
    	pager:   'ul.casestudies',
	    pagerEvent: 'mouseover',
    	pagerAnchorBuilder: function(idx, slide) { 
           	return 'ul.casestudies li:eq(' + idx + ') a';
        },
    	timeout: 0
	});

	$('#scroll').before('<div id="dot" class="dots">').cycle({ 
    	fx:     'scrollHorz', 
    	speed:  'slow', 
    	timeout: 0, 
    	pager:  '#dot' 
	});
	
	$('#scroll2').before('<div id="dot2" class="dots">').cycle({ 
    	fx:     'scrollHorz', 
    	speed:  'slow', 
    	timeout: 0, 
    	pager:  '#dot2' 
	});
});
