	var canChangeTitle = true;
	function loadAlbum(id){
		$("#title-text, #feature div").fadeOut("fast")
		$("#thumbs").slideUp()
		canChangeTitle=false
		$("#thumbs a, #thumbs div.clear").remove()

		$("#now-playing").fadeOut("fast")
			
		$.getJSON('/ajax.php?id='+id, function(data) {
			var c=0;
			var items = [];

			$("#title-text span").fadeOut("fast", function(){
				$("#title-text span").html(data[0].title).fadeIn("fast");
				$("#title-text").fadeIn("fast")
			})


			$("#feature div").html('<div id="slides"><div class="slides_container"></div></div>')

			$.each(data, function(key, val) {
				c++
				if (c<5){
					var slide =	'<a href="javascript:void(0);" data-vimeo-id="'+val.id+'"><img src="'+val.thumbnail+'" width="728" height="410" title="'+val.title+'"></a>'
					$('.slides_container').append(slide)	
				}
				if (val.tag){
					var tag = val.tag
				}else{
					var tag = "";
				}
				var thumb = '<a id="t_'+val.id+'" class="thumb" data-vimeo-id="'+val.id+'" data-description="'+val.description+'" data-title="'+val.title+'"><div><img src="'+val.thumbnail+'" alt="'+val.title+'"></div><span><? echo $display_tag; ?>'+tag+val.title+'</span></a>';

				$("#thumbs").append(thumb)
			});
			if ($("#description").html()){
				$("#description").fadeIn()
			}
			$("#thumbs").append('<div class="clear"></div>')
			$("#thumbs").slideDown()
			$("#title-text, #feature div").fadeIn("fast")


			$('#slides').slides({
				play: 5000,
				pause: 2500,
				crossfade: true,
				effect: 'fade',
				hoverPause: true,
				animationStart: function() {
					if (canChangeTitle){
						//	$("#title-text").fadeOut("fast")
					}
				},
				animationComplete: function(current) {
					$("#title-text span").html($('#slides a:eq('+(current-1)+') img').attr("title"))
					$("#title-text").fadeIn("fast");
				}
			});

			$(".content").fadeIn()





		});
	}
	var logo_is_hidden = true;
	var last_viewed_area;

	function displayNav(){
		$("#landing").fadeIn(1000)
		$("#logo-large").fadeIn(1000,function(){

			$("#intro").fadeIn(2000, function(){
				$("#social_slide a").fadeTo("fast", 0.6)
				$("#social_slide").delay("300").animate({left:'16px'}, 1000)

				$("#nav_slider").delay("300").animate({right:0}, 1000, function(){
					//Done
				})
			})
		})
	}

	function changeBg(b){
		api.goTo(b);				
		
	}

	var landing=true;
	$(document).ready(function(){
		
		displayNav()
		$('#social a').hover(function(){
			$(this).fadeTo("fast", 1)
			$(this).find("img").fadeIn("fast")
		},function(){
			$(this).fadeTo("fast", 0.6)
			$(this).find("img").fadeOut("fast")
		});

		$("#logo").click(function(){
			$("#team2").trigger('click')
/*			if (!landing){
			
				landing=true;
				$(".content, .footer").fadeOut("fast", function(){
					$(".content").removeClass("bg")
					$('.text-area, .videos').hide()
					api.goTo(1);
					$(".selected").removeClass("selected")
					$(".content, #landing").removeClass("border").fadeIn()
				})
			} */

		})

		$(".navigation a").live('click', function(){

			var anchor = this;
			$(".content").addClass("bg")
			if ($(anchor).hasClass("integration")){
				setTimeout("changeBg(3)", 1000)
			}else if($(anchor).hasClass("team")){
				setTimeout("changeBg(5)", 1000)
			}else if($(anchor).hasClass("contacts")){
				setTimeout("changeBg(1)", 1000)
				setTimeout("initialize()", 1000)
			}else{
				setTimeout("changeBg(2)", 1000)
			}
			


			$("#landing").fadeOut(function(){
				$(".content").addClass("border")
				$(".footer").fadeIn()
				if ($(anchor).hasClass("anthems")){
					$("#description").html("A great sporting image is awesome, but accompanied by the right soundtrack it's sublime...  We pride ourselves on our understanding of music and contacts within the industry.  From the underground, from the charts, from production music libraries to the original compositions we'll find it and make it sing.").hide()
				}else{
					$("#description").html("").hide()
				}

				$(".selected").removeClass("selected")
				$(anchor).addClass("selected")


				if ($(anchor).hasClass("album")){
					//Load album
					loadAlbum($(anchor).attr("data-id"));
					$('.text-area').fadeOut(function(){
						$('.videos').fadeIn()
					})

				}

				if ($(anchor).hasClass("text")){
					$('.content').show();


					//Fade out album first
					$('.videos').fadeOut(function(){
						$('#feature div, #title-text span').html("") //Clear playing
						$('.text-area').fadeIn()

						if ($(anchor).hasClass("team")){
							$('#contacts').hide()							
							$('#team').fadeIn()
						}						
						if ($(anchor).hasClass("contacts")){
							$('#team').hide()							
							$('#contacts').fadeIn()
						}						
					})

				}

				landing=false;
				
				}) //END HIDE LANDING

			})

			$('#thumbs a, .slides_container a').live('click', function(){
				$('html, body').animate({scrollTop:0}, 'fast');
				
				var dvi = $(this).attr("data-vimeo-id")
				newFeature(dvi);
				$("#thumbs a").not("#t_"+dvi).removeClass("playing").fadeTo('200', 0.5)
				$("#t_"+dvi).addClass("playing").fadeTo('200', 1)
				refreshTitleText($("#t_"+dvi).attr('data-title'))
				refreshDescription($("#t_"+dvi).attr('data-description'))
			})

			$.supersized({
				slide_interval          :   5000,		// 5 SECONDS BETWEEN TRANSITIONS
				transition              :   1,    		// FADE
				transition_speed		:	500,		// 0.5 SECOND TRANSITION
				autoplay				: 0,										   	
				slide_links				:	'blank',
				slides 					:  	[
				{image : 'images/bg-landing.jpg'},
				{image : 'images/bg-work.jpg'},
				{image : 'images/bg-integration.jpg'},
				{image : 'images/bg-work.jpg'},
				{image : 'images/bg-team.jpg'},
				{image : 'images/bg-work.jpg'}]
			});




		})
		var vimeo_code;
		function newFeature(vimeo_id){
			$(".pagination").remove()
			$("#slides").slides("pause");
			canChangeTitle = false;
			vimeo_code = '<iframe src="http://player.vimeo.com/video/'+vimeo_id+'?title=0&amp;byline=0&amp;portrait=0&amp;color=ab0000&amp;autoplay=1" width="728" height="410" frameborder="0" webkitAllowFullScreen allowFullScreen></iframe>';
			$('#feature div').fadeOut("fast",function(){
				$('#feature div').html(vimeo_code);			
				setTimeout("fadeInFeature()", 1000)
			})
		}

		function fadeInFeature(){
			$('#feature div').fadeIn("fast")
		}

		function refreshTitleText(title){
			var t = title
			//$("#now-playing").fadeIn("fast")
			$('#title-text').fadeTo(5,.01, function(){
				$('#title-text').animate({width:'toggle'},400, function(){
					$('#title-text span').html(t).fadeTo(5,.01)
					$('#title-text').animate({width:'toggle'},200, function(){
						$('#title-text span').html(t).append('<span id="now-playing" style="display:inline;visibility:visible;"> NOW PLAYING</span>').fadeTo(1000,1)
						$('#title-text').fadeTo(1000,1)
					});
				});
			})
		}

		function refreshDescription(description){
			$("#description").slideUp("slow", function(){
				if (description){ $("#description").html(description).slideDown("slow") }
			})
		}
