	jQuery(function() {
		jQuery(".comment_button").click(function()
		{
			var element = jQuery(this);
		    var blog = jQuery("#blogarea").val();
		    var dataString = 'blog='+ blog;
			if(blog=='')
			{
				alert("Please Enter Some Text");
			}
			else
			{
			jQuery.ajax({
				type: "POST",
 				url: "index.php?option=com_htmicroblog&amp;task=addblog",
   				data: dataString,
  				cache: false,
  				success: function(html){

 				jQuery("table#update").prepend(html);
  				jQuery("table#update").slideDown("slow");
   					document.getElementById('blogarea').value='';
  			}
 			});
		}
		return false;
		});

		jQuery(".morebutton").click(function()
		{
		    jQuery("#flashmore").show();
			jQuery("#flashmore").fadeIn(400).html('<span class="loading">Loading Update...</span>');
			var ID = jQuery(this).attr("id");
			var pos = ID.search(";");
			var buser = ID.slice(0,pos)
			var page = ID.slice(pos+1)
		    var dataString = 'buser='+ buser;

			jQuery.ajax({
				type: "POST",
 				url: "index.php?option=com_htmicroblog&amp;task=more&amp;limit=no&amp;page="+page+"",
   				data: dataString,
  				cache: false,
  				success: function(html){

  				jQuery("#flashmore").hide();
 				jQuery("table.microbloglist").replaceWith(html);
  				jQuery("table.microbloglist").slideDown("slow");
  			}
 			});

		return false;
		});

		jQuery(".search_button").click(function()
		{
		    var search = jQuery("#search_box").val();
		    if(search==""){}
		    else{
		    jQuery("#flash").show();
			jQuery("#flash").fadeIn(400).html('<span class="loading">Loading Results...</span>');

		    var dataString = 'searchterm='+ search;

			jQuery.ajax({
				type: "POST",
 				url: "index.php?option=com_htmicroblog&amp;task=search",
   				data: dataString,
  				cache: false,
  				success: function(html){

 				jQuery("table.microbloglist").replaceWith(html);
  				jQuery("table.microbloglist").slideDown("slow");
  				jQuery("#flash").hide();

  			}
 			});
			}
		return false;
		});

		jQuery('.deletebutton').live("click",function()
		{
			var ID = jQuery(this).attr("id");
 			var dataString = 'bid='+ ID;
			if(confirm("Sure you want to delete this update? There is NO undo!"))
			{

				jQuery.ajax({
					type: "POST",
 					url: "index.php?option=com_htmicroblog&amp;task=delete",
  					data: dataString,
 					cache: false,
 					success: function(html){
 					jQuery("#microblog"+ID).slideUp('slow', function() {jQuery(this).remove();});
 				}
			});
		}
		return false;
		});

		jQuery('.minusbutton').live("click",function()
		{
			var ID = jQuery(this).attr("id");
 			var dataString = 'bid='+ ID;
				jQuery.ajax({
					type: "POST",
 					url: "index.php?option=com_htmicroblog&amp;task=negativevote",
  					data: dataString,
 					cache: false,
 					success: function(html){
 					jQuery("#microblog"+ID).replaceWith(html);
 				}
			});
		return false;
		});

		jQuery('.plusbutton').live("click",function()
		{
			var ID = jQuery(this).attr("id");
 			var dataString = 'bid='+ ID;
				jQuery.ajax({
					type: "POST",
 					url: "index.php?option=com_htmicroblog&amp;task=positivevote",
  					data: dataString,
 					cache: false,
 					success: function(html){
 					jQuery("#microblog"+ID).replaceWith(html);
 				}
			});
		return false;
		});

		jQuery('.followbutton').live("click",function()
		{
			var ID = jQuery(this).attr("id");
 			jQuery("#follow"+ ID).hide();
 			var dataString = 'uid='+ ID;
				jQuery.ajax({
					type: "POST",
 					url: "index.php?option=com_htmicroblog&amp;task=follow",
  					data: dataString,
 					cache: false,
 					success: function(html){
 					jQuery("#follow"+ ID).replaceWith(html);
 				}
			});
		return false;
		});

		jQuery('.unfollowbutton').live("click",function()
		{
			var ID = jQuery(this).attr("id");
			jQuery("#follow"+ ID).hide();
 			var dataString = 'uid='+ ID;
				jQuery.ajax({
					type: "POST",
 					url: "index.php?option=com_htmicroblog&amp;task=unfollow",
  					data: dataString,
 					cache: false,
 					success: function(html){
 					jQuery("#follow"+ ID).replaceWith(html);
 				}
			});
		return false;
		});

		jQuery('.replybutton').live("click",function()
		{
			var ID = jQuery(this).attr("id");
 			document.getElementById('blogarea').value='@'+ID+' ';
 			document.getElementById('blogarea').focus();
 			jQuery("#hidden").show("slow");
			return false;
		});

	});

