if (top.location != location) { top.location.href = document.location.href; }

function aggiornaFlusso(){	
	$("#flow_content").html('').tweet({
		debug: false,
		container_class: 'general',
		username: ["parnanzio"],
		query: "user_timeline",
		join_text: "auto",
		avatar_size: 32,
		show_user: true,
		count: 20,
		auto_join_text_default: "",
		auto_join_text_ed: "",
		auto_join_text_ing: "",
		auto_join_text_reply: "",
		auto_join_text_url: "",
		loading_text: "carico i tweets..."
	});
	setTimeout('aggiornaFlusso()', 1000*60);
}

$(document).ready(function() {
	
	$('.expander_100').expander({
		slicePoint:			100,
		expandText:			'[+]',
		userCollapseText:	'[-]',
		expandSpeed: 500
	});
	$('.expander_200').expander({
		slicePoint:			200,
		expandText:			'[+]',
		userCollapseText:	'[-]',
		expandSpeed: 500
	});
	
	$('#skills div div').each(function(){
		val = $(this).find('span').html();
		$(this).find('span').append('%');
		$(this).delay(500).animate({width: val+'%', opacity: val / 100}, 4000, 'swing');
	}).hover(
		function(){ $(this).find('span').show() },
		function(){ $(this).find('span').hide() }
	);
	
	$("#tweets").tweet({
		username: ["parnanzio"],
		join_text: "auto",
		/* avatar_size: 32, */
		count: 10,
		auto_join_text_default: "",
		auto_join_text_ed: "",
		auto_join_text_ing: "",
		auto_join_text_reply: "",
		auto_join_text_url: "",
		loading_text: "carico i tweets..."
	});
	
	aggiornaFlusso();
	
	$("#portfolio .item").hover(
		function() {
			$(this).addClass('hover').css({'z-index' : '10'}); /*Add a higher z-index value so this image stays on top*/ 
			$(this).find('img').animate({ top: '-12px', left: '-20px', width: '240px', height: '168px' }, 200);
			$(this).find('.nuovo').animate({ top: '-12px', right: '-20px' }, 200);
			$(this).find('.info').delay(150).slideDown(300);
		},
		function() {
			$(this).removeClass('hover').css({'z-index' : '0'}); /* Set z-index back to 0 */
			$('.info').stop(true, true).hide();
			$(this).find('img').animate({ top: '0', left: '0', width: '200px', height: '140px' }, 200);
			$(this).find('.nuovo').animate({ top: '0', right: '0' }, 200);
		}
	);
	
	$('#single a > img').parent().attr('rel', 'gallery').fancybox();
	
	// animate to top
	$("#back_top").hide();
	$(function () {
		$(window).scroll(function () {
			if ($(this).scrollTop() > 50) {
				$('#back_top').fadeIn();
			} else {
				$('#back_top').fadeOut();
			}
		});

		$('#back_top').click(function () {
			$('body,html').animate({ scrollTop: 0 }, 800);
			return false;
		});
	});
	
	if ($('#ifttt_twitter').length > 0){
		$('#ifttt_twitter').append('<div class="bird"></div>');
	}

	/*
	$('.wp-pagenavi a').each(function(){
		var url = $(this).attr('href').replace("com/blog/page", "com/_/blog/page");
		$(this).attr('href', url);
	});
	*/
});

