$('document').ready(function(){
	var count = 0;
	$('.t_replybtn').die('click').live('click', function(){
		obj = this;
		if (count == 0){
		var tweet_id = $(this).parents('.re_menu').prev().find('.tweet_tweet').attr('id');
		var screen_name = $(this).parents('.re_menu').prev().find('.tweet_name').children().html();
		var selector = $(this);
		$.ajax({
			type: "GET",
			url: "twitter/actions/tweet.php",
			data: {
				'tweet_id': tweet_id,
				'screen_name': screen_name
			},
			async: true,
			dataType: "HTML",
			success: function(data){
					$(selector).parents('.tweet').append($('<div></div>').addClass('tweet tweet-form').html(data).hide());
					$('.tweet-form').slideDown(1000);
					$('#ajax_form').submit(function(){
						$('.tweet-form').find('#tweet_container').hide();
						$('.tweet-form').find('#tweet_container').parent().append('<div class="formsection" id="tweet_container"><img src="images/ajax-loader.gif" width="32" height="32" style="margin: 10px 130px;"></div>');
						return true;
					});
					$('.t_rtbtn').click(function(){
						$(this).parents('.tweet').append('<div class="formsection" id="tweet_container"><img src="images/ajax-loader.gif" width="32" height="32" style="margin: 10px 130px;"></div>');
					});
					$('#reset_button').die('click').live('click', function(){
						$(this).parents('.tweet-form').slideUp(1000, function(){
							$(this).remove();
						});

					});
			}
		});
		//count++;
		}
	});
});
