$(function(){
	// grobal menu
	$("#menu ul li").hover(function(){
		$(this).animate({marginTop: "0"}, "normal");
	},
	function(){
		$(this).animate({marginTop: "-28px"}, "fast");
	})
	
	// counter
	var hash = $(".hashText").text().length;
	var def = 140 - hash - 1;
	$(".countTweet").text(def);
	$("textarea").keyup(function(){
		var counter = 140 - hash - $(this).val().length - 1;
		$(".countTweet").text(counter);
		
		// form count submit check
		if (Number(counter) < 0) {
			$("input#tweetSubmit").attr("disabled", true);
			$(".countTweet").css("color", "#f00");
		} else {
			$("input#tweetSubmit").attr("disabled", false);
			$(".countTweet").css("color", "#ccc");
		}
	})
	
	// form reply
	$("a.reply").click(function(){
		var user = "@"+$(this).parent().parent().parent().find(".hiddenName").text()+" ";
		$("textarea").text(user);
		$("textarea").focus();
		return false;
	})
	
	// form retweet
	$("a.retweet").click(function(){
		var user = "RT @"+$(this).parent().parent().parent().find(".hiddenName").text()+": "+
					$(this).parent().parent().parent().find(".hiddenPost").text();
		$("textarea").text(user);
		$("textarea").focus();
		return false;
	})
	
	var name = "@"+$("#shops .profUserName em").text()+" ";
	$("#shops textarea#tweet").text(name);
	


})
