




	jQuery(document).ready(function(){

		
	//	jQuery('#primary').css('background-color','#ebf3f4');
		
		//centerPhotos();
		
		
		
		var animating = false;
		var activePhoto = 5;
		var headliner = jQuery('div#headliner');
		var photoList = jQuery('div#headliner ul');
		var photos = jQuery('div#headliner ul li');
		var photoWidth = 460;
		var prevButton = jQuery('div#headliner div#leftPhotoShade a');
		var nextButton = jQuery('div#headliner div#rightPhotoShade a');
		var checkPagination = function(){
			if (activePhoto == 0) {
				prevButton.addClass('disabled');
				nextButton.removeClass('disabled');
			} else if (activePhoto >= photos.length - 1) {
				nextButton.addClass('disabled');
				prevButton.removeClass('disabled');
			} else {
				prevButton.removeClass('disabled');
				nextButton.removeClass('disabled');
			}
		};
		var centerPhotos = function(){
			photoList.animate({ left: ((400 + (activePhoto * photoWidth) - (headliner.outerWidth() / 2)) * -1) }, {
				duration: 500,
				queue: false
			});
		};
		centerPhotos();
		jQuery(window).resize(centerPhotos);
		jQuery('div#headliner ul, div#headliner p').delay(1).fadeIn(1);
		
		nextButton.click(function(){
			if (activePhoto < photos.length - 1 && !animating) {
				animating = true;
				activePhoto += 1;
				checkPagination();
				photoList.animate({ left: ('-=' + photoWidth) }, {
					duration: 750,
					queue: false,
					complete: function(){
						animating = false;
					}
				});
			}
			return false;
		});
		
		prevButton.click(function(){
			if (activePhoto >= 1 && !animating) {
				animating = true;
				activePhoto -= 1;
				checkPagination();
				photoList.animate({ left: ('+=' + photoWidth) }, {
					duration: 750,
					queue: false,
					complete: function(){
						animating = false;
					}
				});
			}
			return false;
		});
		
	});
