$(document).ready(function(){

	/*- Home Services -*/
	$('#homeServices div').hide();
	$('#homeServices li:first div').show();
	$('#homeServices li:first').addClass('selected');
	$('#homeServices li h3').click(function(){
		$(this).parent().addClass('selected');
		$(this).parent().siblings().removeClass('selected');
		$(this).parent().siblings().children('div').fadeOut();
		$(this).next('div').fadeIn();
	});
	$('#homeServices li h3').hover(
		function(){
			$(this).addClass('hover');
		},
		function(){
			$(this).removeClass('hover');
		}
	);
	
	/*- Home Cycle -*/
	$('.home #iphone').anythingSlider({
	        easing: "swing",              
	        autoPlay: true,               
	        startStopped: true,      
	        delay: 2200,                   
	        animationTime: 1000,           
	        hashTags: false,
	        buildNavigation: false,
	        pauseOnHover: true
	});
	$('#apps').anythingFader({            
	        autoPlay: true,               
	        startStopped: true,      
	        delay: 2000,                   
	        animationTime: 800,           
	        hashTags: false,
	        buildNavigation: false,
	        pauseOnHover: true
	});
	$('.screenshot').anythingSlider({
	        easing: "swing",              
	        autoPlay: true,               
	        startStopped: false,      
	        delay: 2200,                   
	        animationTime: 1000,           
	        hashTags: false,
	        buildNavigation: false,
	        pauseOnHover: true
	});
	$('#slideNav a:first').addClass('navCurrent');
	$('#slideNav a').click(function(){
		$(this).addClass('navCurrent');
		$(this).siblings().removeClass('navCurrent');
	});
	
	/*- Retweet -*/
	var tweetText = $('#twitterHidden').text();
	var newtText = tweetText.replace(/\s/g,"%20");
	$('#retweet').attr('href', ('http://twitter.com/home?status=RT%20' + newtText));
	
	/*- Staff Members -*/
	$('.person').children(':not(h4)').hide();
	$('.person:first').children().show();
	$('.person h4').click(function(){
		$(this).parent('li').children().slideDown();
		$(this).parent('li').siblings().children(':not(h4)').slideUp();
	});
	
	/*- Search -*/
	$('#s').focus(function(){
		$(this).val('');
	});
	$('#s').blur(function(){
		var searchVal = $(this).val();
		if (searchVal == '') {$(this).val('Search...');}
	});
	
	/*- Last Elements -*/
	$('.service:last, .aboutItem:last, .person:last, .searchResult:last').addClass('last');
	
});