$(document).ready(function() {

	if( $.browser.msie ){
		$("body").addClass('msie');
	}
	else {
		$("body").addClass('modern');
	}


	// Sub Nav State Changes
	$('#aboutNav a').click(function() {
		var curChildIndex = $(this).parent().prevAll().length + 1;
		$(this).parent().parent().children('.selected').removeClass('selected');
		$(this).parent().addClass('selected');
		
		$('#slides').children('.current').fadeOut('fast',function() {
			$(this).removeClass('current');
			$(this).parent().children('div:nth-child('+curChildIndex+')').fadeIn('fast',function() {
				$(this).addClass('current');
			});
		});
		return false;
	});
	
	// Panel Slides
	$("#aboutNav .services").click(function(){
		$("#panels").animate({'left': '00'}, 1000, 'easeInOutQuart');
	});
	$("#aboutNav .meaningful").click(function(){
		$("#panels").animate({'left': '-960'}, 1000, 'easeInOutQuart');
	});
	$("#aboutNav .clients").click(function(){
		$("#panels").animate({'left': '-1920'}, 1000, 'easeInOutQuart');
	});
	$("#aboutNav .packages").click(function(){
		$("#panels").animate({'left': '-2880'}, 1000, 'easeInOutQuart');
	});
	
	$("#aboutNav .about").click(function(){
		$("#panels").animate({'left': '-3840'}, 1000, 'easeInOutQuart');
	});
	$("#aboutNav .consultants").click(function(){
		$("#panels").animate({'left': '-4800'}, 1000, 'easeInOutQuart');
	});
	$("#aboutNav .contact").click(function(){
		$("#panels").animate({'left': '-5760'}, 1000, 'easeInOutQuart');
	});
	
	// Social Icon Hover States
	
	$(".modern .social").fadeTo(1000, 0.3);
	
	$(".modern .social").hover(
		function() { 
			$(this).fadeTo(200, 1.0); 
		},
		function() { 
			$(this).fadeTo(600, 0.3); 
		}
	);
	
	//Slide in effect of page elements
	var position = {
		'position' : 'relative',
		'top' : '0px',
		'right' : '-5000px'
	}
	
	$(".glisse").css(position);
	
	setTimeout(animate_profiles,500);
	
	function animate_profiles() {
		$(".glisse").each(function(i){
			var $this = $(this);
			setTimeout(function() {
				$this.animate({left: '0'},{duration: 'slow', easing: 'easeOutExpo'});
		    }, 100*i);
			
		});
	}
	
	$("a[rel^='prettyPhoto']").prettyPhoto();
		
	$(".overlay[rel]").overlay({
			mask: '#333',
			closeOnClick: true
	});
	
	$("#corkboard a").hover(
		function () {
			$(this).parent().find(".tooltip").animate({
				top: -80,
				opacity: 'toggle',
				easing: 'easeOutExpo' 
			});
		},
		function () {
			$(this).parent().find(".tooltip").animate({
				top: -100,
				opacity: 'toggle',
				easing: 'easeOutExpo'
			});
		}
	);
	
	$("#corkboard a").bind("click", function(){
		
		var current = $(".main .current");
		var next = $(this).attr("rel");
		
		$(current).fadeOut().removeClass("current");
		$(next).fadeIn().addClass("current");
	});
	
});	

