$(document).ready(function() {
	$('.menu a[href*=#], a#header-logo[href*=#], a.call-to-action[href*=#], .pagenav a[href*=#], a.textlink[href*=#], .box-footer a[href*=#]').live('click', function() {
		$.bbq.pushState( '#/' + this.hash.slice(1) );
		return false;
	});
	$(window).bind('hashchange', function(event) {
		if (location.hash) {
		var tgt = location.hash.replace(/#\//,'');
	} else {
		var tgt = '#top';
	}
	$.smoothScroll({scrollTarget: '#' + tgt});
	});
	$(window).trigger('hashchange');
	
	$(window).scroll(function() {    
    	$("ul.menu li a.active").removeClass("active");
    	var scroll = $(window).scrollTop();
	if (scroll <= 1200) {
        $("#active-intro").addClass("active");
	}
	else if (scroll <= 2400) {
        $("#active-work").addClass("active");
	}
	else if (scroll <= 3600) {
        $("#active-how-work").addClass("active");
	}
	else if (scroll <= 4800) {
        $("#active-about").addClass("active");
	}
	else if (scroll <= 6000) {
        $("#active-contact").addClass("active");
	}
	/*else {
        $("#").addClass("active");
	}*/
	});
	
	$('ul.slider').bxSlider({
		speed: 700,
		pager: false,
		next_image: 'images/slider-next.gif',
		prev_image: 'images/slider-prev.gif',
		wrapper_class: 'slider-wrap'
	});
	
	$('ul.slider').css('overflow', 'hidden');

	var opacity = 0.8, toOpacity = 1, duration = 250;
		$('.opacity').css('opacity',opacity).hover(function() {
			$(this).stop().fadeTo(duration,toOpacity);
		}, function() {
			$(this).stop().fadeTo(duration,opacity);
		}
	);
	$('.client').hover(function() {
		$(this).find('.caption').stop(false,true).fadeIn(600);
	},
	function() {
		$(this).find('.caption').stop(false,true).fadeOut(400);
	});
	$('.popup-content').hover(function() {
		$(this).find('.popup-caption').stop(false,true).slideDown('slow');
	},
	function() {
		$(this).find('.popup-caption').stop(false,true).slideUp('slow');
	});
	$('#contactform').slidinglabels({
		className		: 'form-slider',
		topPosition		: '5px',
		leftPosition		: '10px',
		axis				: 'x',
		speed			: 'fast'
	});
	$('a, #btn, #main-audio-player').data("title", $('a, #btn, #main-audio-player').attr("title")).removeAttr("title");

});
