/**
 * @author Chris
 */
$(document).ready(function(){
	
	if ($.browser.msie) {
		if ($.browser.version == '6.0') {
			$('#nav').css('marginRight', '0px');
		}
	}
	
	$('#nav a').addClass('nav');
	$('a.thisNav').css('width','150px');
	
	$('a.nav').hoverIntent(function(){
		$(this).animate({width:"150px"});
		
	},function(){
		if ($(this).attr('class') == 'nav') {
			$(this).animate({
				width: "120px"
			});
		}
	});
	
	var arbit = 113;
	if($.browser.safari){
		var arbit = 111;
	}
	if($.browser.msie){
		var arbit = 111;
	}
	
	$('a.nav').click(function(){
		$('#nav a').attr('class','nav');
		$(this).css("width","150px");
		$(this).attr('class','');
		$('#nav a.nav').animate({width:"120px"});
		
		var href = $(this).attr('href');
		var offset = $(this).offset();
		var bottom = offset.top - arbit;
		$('#text').slideUp('slow',function(){
			$('#loader').fadeIn('fast');	
		});
		$('#content').animate({marginTop:bottom+"px"},
			500,
			function(){
				$('#content').animate({marginTop:bottom+"px"},
			1000, function(){
				$('#text').load(href+' #text', function(){
					$('#loader').fadeOut('fast', function(){
					$('#text').slideDown('slow');
				});
				$('#content').animate({
					marginTop: "0px"
				}, 1000);
				});
			});
		});
		
		
		return false;
	});
})
