

jQuery(document).ready(function($){

	//Execute Cufon on body copy
	Cufon.replace('.topnav li, .replace, .copyright, .quick-links, #content-left', { fontFamily: 'Century Gothic' });

	//Remove main border on last menu item
	$('.topnav li:last').addClass('nobg');
			
   //Reduce right content's width if nothing is present
   if($('#content-right').html() == false) {
		$('#content-right').width(0);
		// this initialises the scrollBy and scrollTo links.
		$('#content-left').jScrollPane({showArrows:false,animateTo:true, animateInterval:50, animateStep:3,reinitialiseOnImageLoad:true});
   }
   else
   {
		// this initialises the scrollBy and scrollTo links.
		$('#content-left').jScrollPane({showArrows:false,animateTo:true, animateInterval:50, animateStep:3,reinitialiseOnImageLoad:true});
   
   }


	$('.scroll-by-demo').bind(
		'click',
		function()
		{
			$('#content-left')[0].scrollBy(parseInt($(this).attr('rel')));
			return false;
		}
	);
	
   
  //Position scroll buttons
  $('.scroller').css('right', $('#content-right').width() + 20);
 
  //Hide scrollbox unless necessary
  if($('.hentry').height() < $('#content-inner').height()) { 
		//$('.scroller').hide();
   }
   
	var Header = {
		// Let's write in JSON to make it more modular
		addFade : function(selector){
			$("<span class=\"fake-hover\"></span>").css("display", "none").prependTo($(selector)); 
			// Safari dislikes hide() for some reason
			$(selector+" a").bind("mouseenter",function(){
				$(selector+" .fake-hover").fadeIn("slow");
			});
			$(selector+" a").bind("mouseleave",function(){
				$(selector+" .fake-hover").fadeOut("slow");
			});
			
		}
	};

	$(function(){
		Header.addFade("#scroll-up");
		Header.addFade("#scroll-down");
	});


});

