$(document).ready(function(){
	
	$('#slider').nivoSlider({
		effect:'sliceDown', //Specify sets like: 'fold,fade,sliceDown'
		slices:10,
		animSpeed:500, //Slide transition speed
		pauseTime:5500,
		startSlide:0, //Set starting Slide (0 index)
		directionNav:false, //Next & Prev
		directionNavHide:false, //Only show on hover
		controlNav:true, //1,2,3...
		controlNavThumbs:true, //Use thumbnails for Control Nav
      	controlNavThumbsFromRel:true, //Use image rel for thumbs
		controlNavThumbsSearch: '.jpg', //Replace this with...
		controlNavThumbsReplace: '_thumb.jpg', //...this in thumb Image src
		keyboardNav:true, //Use left & right arrows
		pauseOnHover:false, //Stop animation while hovering
		manualAdvance:false, //Force manual transitions
		captionOpacity:1, //Universal caption opacity
		beforeChange: function(){},
		afterChange: function(){},
		slideshowEnd: function(){} //Triggers after all slides have been shown
	});

	
	var linkSelector = '#navigation a,.view-case,.see-more',
		contentDiv = '#content',
		loadingDiv = '#loading';
	
	$.address.init(function(event) {
	$(linkSelector).address();
	}).change(function(event) {
	$(loadingDiv).show();
	$(contentDiv).fadeOut(500);
 	var pathName = event.value;
	if (pathName==''){
		pathName='home.php';
	}
	var numericExpression = /\d/;
	if (pathName == 'work.php' || pathName == 'about.php' || pathName == 'careers.php' || pathName == 'contact.php' || event.value.match(numericExpression)){
	$('#slider,#featured-logos').fadeOut(500);
	$('#header').delay(500).animate({height: "120"},500);
	}else{
	$('#header').animate({height: "600"},500);
	$('#slider,#featured-logos').delay(500).fadeIn(500);
	}

	var file = pathName;
	$(contentDiv).load(file,function(){
	$(loadingDiv).hide();
	$(contentDiv).fadeIn(500);
	});
	
	}).history(true)
	.strict(false)	
	
});
