// JavaScript Document
/*
var $slider_max;
var $slider_current;
var $scrolling = false;
*/



(function($) {
	$.slideshow = {
		defaults: {
			$slider_max: null,
			$slider_current: 0,
			$scrolling: false
		}
	};
	$.fn.extend({
		slideshow: function(options) {
			var options = $.extend( {}, $.slideshow.defaults, options );
			return this.each(function() {
				var that = $(this);
				var $slider_max = $('.slider DIV', that).length;
				var $slider_current = 0;
				var $scrolling = false;
				$('.slider', that).width(20000);
				$('.counter', that).text(($slider_current + 1) + '/' + $slider_max);
				$('.slide_next', that).click(function(event){
					event.preventDefault();
					if($slider_current == $slider_max -1)return;
					$slider_current += 1;
					doSlide();
				});
				$('.slide_prev', that).click(function(event){
					event.preventDefault();
					if($slider_current == 0)return;
					$slider_current -= 1;
					doSlide();
				});
				function doSlide(){
					$('.counter', that).text(($slider_current + 1) + '/' + $slider_max);
					
					$('.slider', that).stop(true, true).animate({left: 0 - $slider_current * 560 }, 250);
						
					if($slider_current != 0)$('.slide_prev', that).fadeIn(250);
					else $('.slide_prev', that).fadeOut(250);
					
					if($slider_current != $slider_max - 1)$('.slide_next', that).fadeIn(250);
					else $('.slide_next', that).fadeOut(250);
					
					$('.slide_text p', that).html($('.slider_' + ($slider_current + 1) + ' .desc', that).html());
				}
			});
		}
	});
	$(function() {
		$('.slideshow').slideshow();
	});
})(jQuery);




$(document).ready(function(){
	Cufon.replace('.cufon');
		
	$('#navigation a[href*=#]').bind("click", function(event) {
		
		$('a.active').removeClass('active');
		$(this).addClass('active');
		
		event.preventDefault();
		var $scrollto = $(this).attr("href");
		
		$scrolling = true;
		
		$('html,body').animate({
			scrollTop: $($scrollto).offset().top
		}, 500 );
	});
});
