
$j(function(){ 
	
	   fadeLinks(); 
	   navAnimate();
       ctaAnimate(); 
		twitterFeed();

});  

	function navAnimate(){ 
		
		
				       
	  		$j('#nav li a')
		
		   	  .mouseover(function () { 
			
					if (! ($j(this).hasClass('on'))){
				
						$j(this).stop().animate(
						    {backgroundPosition:"0px -31px"}, {duration : 100}  

						)
					   	.find('span').stop().animate(
							    {backgroundPosition:"100% -31px"}, {duration : 100}
						).css({color : '#fff' }); 

					
					} 
			 
		   		}) 

		
		
				.mouseout(function () { 
					
					$j('#nav li a span').css({ color : '#666'})
					$j('#nav li a.on span').css({ color : '#fff'})
					
					  
					if (! ($j(this).hasClass('on'))){ 
					   $j(this).stop().animate(
						    {backgroundPosition:"0px 0px"}, {duration : 100})
					   
						
					  	.find('span').stop().animate(
						   {backgroundPosition:"100% 0px", color: '#fff'}, {duration : 100}
						)
				        
				
					 }
					
					
				}) ; 
				
			 
	  }  
	
	 
	//slide for call to action hovers
	function ctaAnimate(){	
		$j('a.cta')
		   	  .mouseover(function () { 
			 
			            var w = $j(this).width();
		   			
   						$j(this).stop().animate(
						    {backgroundPosition : " "+w+" 0"}, {duration : 250}
						)
		 			 
		   		}) 
		
		
				.mouseout(function () {   
					   $j(this).stop().animate(
						    {backgroundPosition:"0px 0px"}, {duration : 250})
   				}) ;  


        

   }	
   
	
	
	
	
	//fade in for global buttons 
   
	function fadeLinks(){
		

			$j('a.fade').each(function(){
                
				$j(this).css({position:'relative'});

				span = document.createElement('span');
				$j(this).append(span);

				var bg = $j(this).css('background-image');
	            var h  = $j(this).height(); 
				var w  = $j(this).width();
                
				$j(this).find('span').css({
					backgroundImage:bg,
					backgroundPosition:"0px -"+h+"px ",
					position:"absolute",
					display:"block",
					cursor:"pointer",
					top:"0px",
					left:"0px",
					width:w,
					height:h,
				   	opacity:0,
					visibility:"visible"
				}) 
				
				$j('a.fade').mouseover(function(){     
					$j(this).find('span').stop();
					$j(this).find('span:not(:animated)').animate({opacity : 1}, 225);
					
				})
				
					.mouseout(function(){
						$j(this).find('span').animate({opacity : 0}, 225);
				}) 
				
            });


			} 
			
	 
	//force the first link in home page twitter feed black   	
	 function twitterFeed(){    
		
          $j(".twitter-message").find("a:first").css({
			'color' : '#000',
			'textDecoration' : 'none'
			});
	}
 
