// tweeter script
var Tweeter = {
	Init: function(username, tweets) {
		// get twitter cloud <div>
		var $t=$('#twitter');
		// * get tweets from tweeter:
		$t.tweet({
			username: username,
			join_text: null,
			avatar_size: null,
			count: tweets,
			loading_text: "loading tweets..."
		});

		// * sillhouette pop-up speech bubble animation
		$t
			// set opacity and change display mode - this is needed to determine top & left margin
			.css('opacity',0)
			.css('display','block')
			// save original position for later - to reset the bubble back
			.data('top', $t.css('top'));
		$('#hope')
			// remove alt attribute to prevent showing
			.attr('alt','')
			// add mouseover/mouseout:
			.hover(function(){
				$t.stop()
					.animate({
						'z-index':18,
						opacity:1,
						top:50
					}, 500);
			},function(){
				if($t.css('opacity') < 1) {
					$t
						.stop()
						.animate({
						
							opacity:0
							
							}, 300, function(){
								$t.css('top', $t.data('top'));
							});
					return;
				}
				$t.stop()
					.delay(1500)
						.animate({
							'z-index':10,
							opacity:0
							}, 300, function(){
								$t.css('top', $t.data('top'));
							});
		});
	}
}

