

$(document).ready(function(){

	showActiveTab();
	
	if(!isIphone()){
		$('.scroll-pane').jScrollPane({
			'showArrows' : false,
			'animateScroll' : true,
			'animateDuration' : 300,
			'animateEase': 'linear'
		});
		$('a').tooltip({
			track: true,
			delay: 0,
			showURL: false,
			showBody: " - ",
			fade: 250
		});

		$('#projects').cycle({ 
		    fx:     'scrollUp', 
		    speed:  500, 
		    timeout: 0, 
		    next:   '#next-project', 
		    prev:   '#prev-project',
			easing: 'easeOutQuart'
		});		
	}else{
		$('#projects-nav').remove()
	}
	

})

function showActiveTab(){
	var active_item = window.location.hash;
	if(active_item == ''){
		var active_item = '#home';
	}

	active_item = active_item.replace('#','.');
	$('nav#main li'+active_item).addClass('active');
	$('nav#main a').each(function(){
		$(this).click(function(){
			var the_link = $(this);
			$('nav#main li').removeClass('active');
			the_link.parent('li').addClass('active');	
		})
	})	
}

function isIphone(){
	if((navigator.userAgent.match(/iPhone/i)) || (navigator.userAgent.match(/iPod/i))) {
		return true;
	}
	return false;
}
