/**
 * Javascript for timothy-armstrong.com.
 *
 * @author Timothy Armstrong
 * @copyright 2010
 */


/**
 * Actions run on document load.
 */
$(document).ready(function() {
			
	// setup the animations for the sidebar
	setupAnimations();
	
	// active textbox
	//activeTextboxes();
    
    // zoom-in images
    setupZoomIn();
    
    // cufon fonts
    //fonts();
    
    // twitter status
    twitter();

});


/**
 * Sets up animations on the sidebar navigation
 */
function setupAnimations() {
	
	$('#sidebar nav li a').append("<span class='hover'></span>").removeClass('n');
	
	$('#sidebar nav li a .hover').css('opacity', 0); // for Internet Explorer, silly browser
	
	$('#sidebar nav li a').hover(function() {
	
		$('.hover', this).stop().animate({
			'opacity': 1
		}, 400, 'easeOutCubic')//, 'easeout')
		
	},function() {
		
		$('.hover', this).stop().animate({
			'opacity': 0
		}, 600, 'easeOutCubic')//, 'easein')
		
	});
	
}

/**
 * Makes the textboxes light up on focus and return to normal on blur
 */
function activeTextboxes() {
	
	$('#content form input.button').css('opacity',0)
    
    .addClass('hover')
    
    .hover(function() {
       
       $(this).stop().animate({
            'opacity': 1
       }, 75)
        
    }, function() {
        
        $(this).stop().animate({
            'opacity': 0
       }, 75)
        
    });
	
}


/**
 * Fancybox zoom-in images
 */
function setupZoomIn() {
    
    /*$("a.zoomin").fancybox({
        'overlayColor': '#000',
        'overlayOpacity': '0.6',
        'speedIn'			: 500,
		'speedOut'			: 500
    });*/
    
    $("a.zoomin").fancybox({
        'transitionIn'  :   'elastic',
        'transitionOut' :   'elastic',
		'speedIn'		:	600, 
		'speedOut'		:	200, 
		'overlayColor'	:	'#000',
        'overlayOpacity':   '0.6',
        'easingIn'      :   'easeInCubic',
        'easingOut'     :   'easeInCubic'
	});
    
}

/**
 * Retrieve the last tweet from twitter
 */
function twitter() {
	
	$("#tweet").lastTwitterMessage("TimothyA");
	
}
