$(document).ready(function () {   
	
	Cufon.replace('li.welcome p, ul.nav, #about, #clients, #back-link');
	
	$('a.about').click(function() {
		$('#about').slideToggle();
		if( $('#clients').is(':hidden') ) {
		    // no nothing
		}else{
		    $('#clients').slideToggle();
		    return;
		}
	});
	
	$('a.clients').click(function() {
		$('#clients').slideToggle();
		if( $('#about').is(':hidden') ) {
		    // do nothing
		}else{
		    $('#about').slideToggle();
		    return;
		}
	});
	
	$('#timeline').scroll(function() {
		$('#drag-tip').fadeOut('slow');
	});
	     
   $('#timeline').mousedown(function (event) {
       $(this)
           .data('down', true)
           .data('x', event.clientX)
           .data('scrollLeft', this.scrollLeft);
          
       return false;
   }).mouseup(function (event) {
       $(this).data('down', false);
   }).mousemove(function (event) {
       if ($(this).data('down') == true) {
           this.scrollLeft = $(this).data('scrollLeft') + $(this).data('x') - event.clientX;
$('#drag-tip').fadeOut('slow');
       }
   }).mousewheel(function (event, delta) {
       this.scrollLeft -= (delta * 30);
   }).css({
       'overflow' : 'auto',
   });

	$(window).mouseout(function (event) {
	   if ($('#timeline').data('down')) {
	       try {
	           if (event.originalTarget.nodeName == 'BODY' || event.originalTarget.nodeName == 'HTML') {
	               $('#timeline').data('down', false);
	           }                
	       } catch (e) {}
	   }

	});
	
	if( self.document.location.hash.substring(1) == 'clients' ) {
		$('#clients').slideDown();
	}else{
		// Do Nothing
		return
	};
	
});