$(document).ready(function() {

	// HEADER
		$('#logo, #asterisco').mouseover(function() {
    	$('#asterisco').rotate({
            duration:400,
            angle:0,
            animateTo: 90,
            easing:$.easing.easeInOutExpo
          });
  		}).mouseout(function(){
    	$('#asterisco').rotate({
            duration:400,
            angle:90,
            animateTo: 0,
            easing:$.easing.easeInOutExpo
          });
  		});
		
		$('#logo, #asterisco').toggle(
			function() {
			$('#menu, #fb_top').hide();
    		$('#about_breve').show('bounce','fast');
  			},
  			function() {
			$('#menu, #fb_top').show('drop','fast');
    		$('#about_breve').hide();
  			}
  		);
  	
	// SLIDER
	 $('#slides').orbit({
     	animation: 'fade',                  // fade, horizontal-slide, vertical-slide, horizontal-push
     	animationSpeed: 1000,                // how fast animtions are
     	timer: true, 			 // true or false to have the timer
     	advanceSpeed: 4000, 		 // if timer is enabled, time between transitions 
     	pauseOnHover: true, 		 // if you hover pauses the slider
     	startClockOnMouseOut: true, 	 // if clock should start on MouseOut
     	startClockOnMouseOutAfter: 100, 	 // how long after MouseOut should the timer start again
     	directionalNav: false, 		 // manual advancing directional navs
     	captions: true, 			 // do you want captions?
     	captionAnimation: 'fade', 		 // fade, slideOpen, none
     	captionAnimationSpeed: 800, 	 // if so how quickly should they animate in
     	bullets: true,			 // true or false to activate the bullet navigation
     	afterSlideChange: function(){} 	 // empty function 
     });
     
     
    // POST
    
    	$('#twitter-feedback').change(function() {
    	user_feedback = $("#twitter-feedback").val();
  		$('a#twitter-link').attr("href", "http://twitter.com/home?status=" + user_feedback + post_tweet);
		});
    
    // PORTFOLIO
      
      // metto lo scrolling degli elementi
  	  $(".scrollable").scrollable({easing: 'easeInOutExpo', speed: 700, circular: false});		
  	  
  	  // filtro gli elementi
  	  
  	   $('.filter_portfolio a').click(function() {    
        $('.filter_portfolio a.current').removeClass('current');  
        $(this).addClass('current');  
  
        var filterVal = $(this).attr('id');  
  
        if(filterVal == 'all') {  
            $('.item_portfolio.hidden').fadeIn('slow').removeClass('hidden');  
        } else {  
            $('.item_portfolio').each(function() {  
                if(!$(this).hasClass(filterVal)) {  
                    $(this).fadeOut('normal').addClass('hidden');  
                } else {  
                    $(this).fadeIn('slow').removeClass('hidden');  
                }  
            });  
        }  
  
        return false;  
    });

  	// FOOTER
  	
  		// mostro i miei tweets
  		$("#twitter_updates").getTwitter({
			userName: "lysergicstudio",
			numTweets: 1,
			loaderText: "Loading tweets...",
			slideIn: true,
			showHeading: false,
			headingText: "Latest Tweets",
			showProfileLink: false
		});

});
