
// nav & show hide -> © Copyright 2011 - MARU ARTS di Marcello Bianchi - www.maruarts.it)
 
 // home page
// $(document).ready(function() {
//   $('.n1active').click( function() {
//	$(this).removeClass("n1"); 
//	$(this).addClass("n1active");
//	$('.n2active').removeClass("n2active").addClass("n2");
//	$('.n3active').removeClass("n3active").addClass("n3");
//    $('#header,#wall,#wall-list').show('slow');
//	$('#portfolio,#aboutMe').hide('slow');
//   });
//   $('.n2').click( function() {
//	$(this).removeClass("n2"); 
//	$(this).addClass("n2active");
//	$('.n1active').removeClass("n1active").addClass("n1");
//	$('.n3active').removeClass("n3active").addClass("n3");
//    $('#header,#aboutMe').hide('slow');
//	$('#portfolio,#wall,#wall-list').show('slow');
//   });
//   $('.n3').click( function() {
//	$(this).removeClass("n3"); 
//	$(this).addClass("n3active");
//	$('.n1active').removeClass("n1active").addClass("n1");
//	$('.n2active').removeClass("n2active").addClass("n2");
//	$('.n4active').removeClass("n4active").addClass("n4");
//    $('#header,#portfolio,#wall,#wall-list,#blog').hide('slow');
//    $('#aboutMe').show('slow');
//   });
//   
//   // portfolio
//   $('.n1').click( function() {
//	$(this).removeClass("n1"); 
//	$(this).addClass("n1active");
//	$('.n2active').removeClass("n2active").addClass("n2");
//	$('.n3active').removeClass("n3active").addClass("n3");
//    $('#header,#wall,#wall-list').show('slow');
//	$('#portfolio,#aboutMe').hide('slow');
//   });
//   $('.n2active').click( function() {
//	$(this).removeClass("n2"); 
//	$(this).addClass("n2active");
//	$('.n1active').removeClass("n1active").addClass("n1");
//	$('.n3active').removeClass("n3active").addClass("n3");
//    $('#header,#aboutMe').hide('slow');
//	$('#portfolio,#wall,#wall-list').show('slow');
//   });
//   
//   // blog
//   $('.n4active').click( function() {
//	$(this).removeClass("n4"); 
//	$(this).addClass("n4active");
//	$('.n3active').removeClass("n3active").addClass("n3");
//    $('#blog').show('slow');
//	$('#aboutMe').hide('slow');
//   });
//   
//   $('.aboutMe').click( function() {
//	$('.n1active').removeClass("n1active").addClass("n1");
//	$('.n3').removeClass("n3").addClass("n3active");
//    $('#header,#portfolio,#wall,#wall-list,#blog').hide('slow');
//    $('#aboutMe').show('slow');
//   });
//
//});
// 
 
 

// alert -> © Copyright 2011 - MARU ARTS di Marcello Bianchi - www.maruarts.it)

 // cv
 $(document).ready(function() {
   $('.cv,#DownloadCV').click( function() {
    $('#cv').fadeIn('fast');
   });
   $('.close').click( function() {
    $('#cv').fadeOut('slow');
   });
});
 
  // vCard
 $(document).ready(function() {
   $('.vCard').click( function() {
    $('#vCard').fadeIn('fast');
   });
   $('.close').click( function() {
    $('#vCard').fadeOut('slow');
   });
});

 
 
 // sidebar animation
 
 $(function() {

    var $sidebar   = $("sidebar"),
        $window    = $(window),
        offset     = $sidebar.offset(),
        topPadding = 10;

    $window.scroll(function() {
        if ($window.scrollTop() > offset.top) {
            $sidebar.stop().animate({
                marginTop: $window.scrollTop() - offset.top + topPadding
            });
        } else {
            $sidebar.stop().animate({
                marginTop: 0
            });
        }
    });

});
 
 
 // sidebar ribbon awards -> © Copyright 2011 - MARU ARTS di Marcello Bianchi - www.maruarts.it)
 
$(document).ready(function() {
   
   $('.ribbonSmall').click( function() {
	$(this).removeClass("ribbonSmallReturn"); 
	$(this).addClass("ribbonSmallActive");
    $('.awardsDetail').fadeIn('fast');
   });
   $('.closeSmall').click( function() {
	$('.ribbonSmall').removeClass("ribbonSmallActive").addClass("ribbonSmallReturn");
    $('.awardsDetail').fadeOut('slow');
   });

});





// mailmask

$.fn.noSpam = function() {
	at = '@';
	return this.each(function(){
		e = null;
		$(this).find('span').replaceWith(at);
		e = $(this).text();
		$(this).attr('href', 'mailto:' + e);
	});
};



// Twitter Call

getTwitters('twitter', { 
  id: 'maruarts', 
  count: 1, 
  enableLinks: true, 
  ignoreReplies: true, 
  clearContents: true,
  template: '"%text%" <a href="http://twitter.com/%user_screen_name%/statuses/%id%/"></a>'
});

// Twitter Call for Blog

(function($) {
	/*
		jquery.twitter.js v1.0
		Last updated: 26 October 2008

		Created by Damien du Toit
		http://coda.co.za/blog/2008/10/26/jquery-plugin-for-twitter

		Licensed under a Creative Commons Attribution-Non-Commercial 3.0 Unported License
		http://creativecommons.org/licenses/by-nc/3.0/
	*/

	$.fn.getTwitter = function(options) {
		var o = $.extend({}, $.fn.getTwitter.defaults, options);
	
		// hide container element
		$(this).hide();
	
		// add heading to container element
		if (o.showHeading) {
			$(this).append('<h2>'+o.headingText+'</h2>');
		}

		// add twitter list to container element
		$(this).append('<ul id="twitter_update_list"><li></li></ul>');

		// hide twitter list
		$("ul#twitter_update_list").hide();

		// add preLoader to container element
		var pl = $('<p id="'+o.preloaderId+'">'+o.loaderText+'</p>');
		$(this).append(pl);

		// add Twitter profile link to container element
		if (o.showProfileLink) {
			$(this).append('<a id="maruarts" href="http://twitter.com/'+o.userName+'">http://twitter.com/'+o.userName+'</a>');
		}

		// show container element
		$(this).show();
	
		$.getScript("http://twitter.com/javascripts/blogger.js");
		$.getScript("http://twitter.com/statuses/user_timeline/"+o.userName+".json?callback=twitterCallback2&count="+o.numTweets, function() {
			// remove preLoader from container element
			$(pl).remove();

			// show twitter list
			if (o.slideIn) {
				$("ul#twitter_update_list").slideDown(1000);
			}
			else {
				$("ul#twitter_update_list").show();
			}

			// give first list item a special class
			$("ul#twitter_update_list li:first").addClass("firstTweet");

			// give last list item a special class
			$("ul#twitter_update_list li:last").addClass("lastTweet");
		});
	};

	// plugin defaults
	$.fn.getTwitter.defaults = {
		userName: null,
		numTweets: 5,
		preloaderId: "preloader",
		loaderText: "Loading tweets...",
		slideIn: false,
		showHeading: true,
		headingText: "Latest Tweets",
		showProfileLink: true
	};
})(jQuery);




// scroll fade

$(document).ready(function(){
$('a[href*=#]').click(function() {
if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'') 
	&& location.hostname == this.hostname) {
		var $target = $(this.hash);
		$target = $target.length && $target || $('[name=' + this.hash.slice(1) +']');
		if ($target.length) {
			var targetOffset = $target.offset().top;
			$('html,body').animate({scrollTop: targetOffset}, 1000);
			return false;
		}
	}
});
	


// go to top	



//jQuery.fn.topLink = function(settings) {
// settings = jQuery.extend({
// min: 1,
// fadeSpeed: 200,
// ieOffset: 50
// }, settings);
// return this.each(function() {
// //Listen for scroll
// var el = $(this);
// el.css('display','none'); //in case the user forgot
// $(window).scroll(function() {
// if(!jQuery.support.hrefNormalized) {
// el.css({
// 'position': 'absolute',
// 'top': $(window).scrollTop() + $(window).height() - settings.ieOffset
// });
// }
// if($(window).scrollTop() >= settings.min)
// { el.fadeIn(settings.fadeSpeed); }
// else
// { el.fadeOut(settings.fadeSpeed); }
// });
// });
//};


							
$('.goToTop').topLink({min: 800, fadeSpeed: 500});

});
