


Cufon.replace('#nav li');
Cufon.replace('h4');


var scrSpeed = 1000;

$(document).ready( function () {
	
	
	$(window).scroll(function(){
		if ($(window).scrollLeft() > 0) {
			$("#back").fadeIn("slow");
		}
		else {
			$("#back").fadeOut("slow");
		}
	});
    
   
   
	$('#nav1').click(function(){
		$.scrollTo( "#m1", scrSpeed, { axis:'x', offset: { left: -200 } } );
	});
    
	$('#nav2').click(function(){
		$.scrollTo( "#m2", scrSpeed, { axis:'x', offset: { left: -200 } } );
	});
    
	$('#nav3').click(function(){
		$.scrollTo( "#m3", scrSpeed, { axis:'x', offset: { left: -200 } } );
	});
    
	$('#nav4').click(function(){
		$.scrollTo( "#m4", scrSpeed, { axis:'x', offset: { left: -200 } } );
	});
    
	$('#nav5').click(function(){
		$.scrollTo( "#m5", scrSpeed, { axis:'x', offset: { left: -200 } } );
	});
    
	
	
	
	shortcut.add("Home",function() {
		$.scrollTo( 0, scrSpeed, { axis:'x' } );
	});
	shortcut.add("End",function() {
		$.scrollTo( "#container div:last", scrSpeed, { axis:'x' } );
	});
	shortcut.add("Right",function() {
		$.scrollTo( '+=500px', 500, { axis:'x' } );
        },
	 	{ 'disable_in_input':true
	});
	shortcut.add("Left",function() {
		$.scrollTo( '-=500px', 500, { axis:'x' } );
         },
	 	{ 'disable_in_input':true
	});
    shortcut.add("Up",function() {
		$.scrollTo( '-=500px', 500, { axis:'x' } );
         },
	 	{ 'disable_in_input':true
	});
    shortcut.add("Down",function() {
		$.scrollTo( '+=500px', 500, { axis:'x' } );
        },
	 	{ 'disable_in_input':true
	});
    shortcut.add("B",function() {
		$.scrollTo( 0, scrSpeed, { axis:'x' } );
        },
	 	{ 'disable_in_input':true
	});
	
	
	
	$('#back a').click(function(){
		$.scrollTo( 0, scrSpeed, { axis:'x', easing:'easeOutQuint' } );
	});
	
	
	
	
	(function($) {
		$.fn.cfadeIn = function(speed, callback) {
			$(this).fadeIn(speed, function() {
				if(jQuery.browser.msie)
					$(this).get(0).style.removeAttribute('filter');
				if(callback != undefined)
					callback();
			});
		};
		$.fn.cfadeOut = function(speed, callback) {
			$(this).fadeOut(speed, function() {
				if(jQuery.browser.msie)
					$(this).get(0).style.removeAttribute('filter');
				if(callback != undefined)
					callback();
			});
		};
	})(jQuery);
    
    
    
    var excerpt = $("#blog a").next("p");
    var dTop = - excerpt.height();
    excerpt.css('top', dTop-80);
    $("#blog a").hover(function() {
		excerpt.animate({opacity: "show", top: dTop - 60}, "slow");
	}, function() {
		excerpt.animate({opacity: "hide", top:dTop - 70}, "fast", function () {
               // $("#blog a").unbind('mouseover').unbind('mouseout');   
        });
	});
    
    
    		
    	var bioWidth = ($('#bios').children().size() * 480) - 30;
        $('#bios').width(bioWidth);
        if(jQuery.browser.msie)
            	$('#bios').prev('h2').width(bioWidth);
                $('#m2').width(bioWidth + 100);
	
    
    	
    $.fn.setWidth = function() {
    	var totalWidth = 1650
        $('div#container').children(".module").each(function() {
            totalWidth = totalWidth + $(this).width();	
        });
        $("#container").width(totalWidth);
    }
    
    $("div#container").setWidth();    
    
					
});

