jQuery(document).ready(function($) {
	var ltg = 140 - $('#tweet_text').val().length;
	$('#char_cnt').html(ltg);
	
	$('#tweet_text').keyup(function(e) {
		var ltg = 140 - $('#tweet_text').val().length;
		if (ltg < 0) {
			$('#char_cnt').html('<span class="red">'+ltg+'</span>');
		} else {
			$('#char_cnt').html(ltg);
		}
		
	});
	getTwitter();
	$.timer(10000,function (timer) {
		getTwitter();
	});
	
	
	$('#tweet_it_btn').click(function() {
		window.open('http://twitter.com/home?status='+escape($('#tweet_text').val()));
	})
	
	$("#more_info").hide();
	$(".expando").click(function(){
		$("#more_info").slideToggle(250);
		return false;
	});
	
});
function getTwitter() {
	$("#tweets").html('');
	$("#tweets").tweet({
		join_text: "auto",
		count: 3,
		avatar_size: 48,
		auto_join_text_default: "", // [string] auto text for non verb: "i said" bullocks
		auto_join_text_ed: "", // [string] auto text for past tense: "i" surfed
		auto_join_text_ing: "", // [string] auto tense for present tense: "i was" surfing
		auto_join_text_reply: "", // [string] auto tense for replies: "i replied to" @someone "with"
		auto_join_text_url: "",
		loading_text: "loading...",
		query: '%23UNFIdol'
	});
	//setTimeout(getTwitter(),5000);
}