$(document).ready(function() {
	var f_box=0;
	var t_box=0;
	
	$(document).click(function(){
		f_box++;
		if (f_box==2){ f_box=0; }
		else {
			$("#facebox").hide();
			f_box=0;
		}
		t_box++;
		if (t_box==2){ t_box=0; }
		else{
			$("#twittbox").hide();
			t_box=0;
		}
	});
	
	$('.socicon').click(function(){
		$('.socbox').hide();
		var id='#'+$(this).attr('id')+'box';
		if ($(this).attr('id')=='face'){
			f_box++;
		}
		else {
			t_box++;
		}
		$(id).css('margin-top',-($(id).height()+56)+'px');
		$(id).show();
	});

	$('.socicon').nudge({
	  property: 'marginTop',
	  direction: '',
	  amount: -10,
	  duration: 166
	});
	
	$(".tweet").tweet({
		username: tw_username,
		join_text: "auto",
		avatar_size: 32,
		count: 4,
		auto_join_text_default: "we said,",
		auto_join_text_ed: "we",
		auto_join_text_ing: "we were",
		auto_join_text_reply: "we replied to",
		auto_join_text_url: "we were checking out",
		loading_text: "loading tweets..."
	});
	
	$('.close').click(function(){
		var id='#'+$(this).attr('id').substring(5)+'box';
		$(id).hide();
	});
});	

