$(document).ready(function() {
	
	var pathname = window.location.pathname;
	var pathArray = pathname.split('/');
	var slideNum = $('#slider .slide').size();
	var activeSlide = 0;
	
/* -- grid images -- */
// work
	$('#work li').hover(
		function() {
			$(this).addClass('hovering');
	},
		function () {
			$(this).removeClass('hovering');
	});
// blog	
	$('#blog li').hover(
		function() {
			$(this).addClass('hovering');
	},
		function () {
			$(this).removeClass('hovering');
	});
// people	
	$('#people li').hover(
		function() {
			$(this).addClass('hovering');
	},
		function () {
			$(this).removeClass('hovering');
	});

/* -- home slider hover -- */	
	$('#slider .slide').hover(
		function() {
			$(this).addClass('hovering');
		},
		function () {
			$(this).removeClass('hovering');
		});
		
		$('#slider .slides').cycle({fx: 'scrollLeft',speed: 1000,timeout: 5000});
/*		
	$('#slider .leftArrow').click(function() {
		activeSlide = activeSlide - 1;
		if (activeSlide < 0) {
			activeSlide = slideNum - 1;
		}
		var moveAmount = activeSlide * 960;
		$('#slider .slides').animate({left: -moveAmount}, 1000);
		return false;
	});
	
	$('#slider .rightArrow').click(function() {
		activeSlide = activeSlide + 1;
		if (activeSlide >= slideNum) {
			activeSlide = 0;
		}
		var moveAmount = activeSlide * 960;
		$('#slider .slides').animate({left: -moveAmount}, 1000);
		return false;
	});
*/		
/* -- about slider -- */
	$('#aboutSliderControls li').click(function() {
		var moveAmount;
		var section = $(this).attr('class');
		$('#aboutSliderControls li').removeClass('activeBtn');
		$(this).addClass('activeBtn');
		if (section == 'expertise') {
			moveAmount = 0;
		} else if (section == 'services') {
			moveAmount = -960;
		} else if (section == 'thinking') {
			moveAmount = -1920;
		}
		$('#aboutSlider .slides').animate({left: moveAmount}, 1000);
		return false;
	});

/* -- active tag archive -- */	
	if (pathArray[1] == 'tag') {
		var thisTag = $('body').attr('class');
		var tagArray = thisTag.split(' ');
		var theTag = tagArray.pop();
		var babyArray = theTag.split('-');
		var baby = babyArray.pop();
		$('.tag-link-'+baby).parent().addClass('activeTag');
	}

/* -- work grid image margins -- */	
	if(pathArray[1] == 'workgrid') {
		var i = 0;	
		$('#work ul li').each(function(i) {
			i++;
			var newNum = i - 2;
			var remain = newNum % 3;
			if (remain == 0) {
				$(this).css("margin","0 3px 0 3px");
			} else {
				// do nothing
			}
		});
	}
	

	
	
});
