<!--

$(function() {
	$(".status_submit").click(function() {
	var status = $("#status").val();
	var dataString = 'status='+ status;
		if(status=='') { alert('Please add your status information'); }
		else{
		$("#loading_status").show();
		$("#loading_status").fadeIn(800).html('<img src="/beta/images/ajax-loader.gif" align="absmiddle">&nbsp;<span class="loading">Updating your status... whoopee! Guess what though, nobody cares what you say.</span>');
			$.ajax({
				type: "POST",
				url: "/beta/ajax/post_status.php",
				data: dataString,
				cache: false,
				success: function(html){
					$("ol#update li").hide();
					$("ol#update").append(html);
					$("ol#update li:last").fadeIn("slow");
					document.getElementById('status').value='';
					$("#status").focus();
					$("#loading_status").hide();
				}
			});
		}
		return false;
	});
});


$(function() {
	$(".comment_submit").click(function() {
	var user_id = $("#user_id").val();
	var upload_id = $("#upload_id").val();
	var comment = $("#comment").val();
	var dataString = 'upload_id='+ upload_id + '&user_id=' + user_id + '&comment=' + comment;
		if(comment=='') { alert('Please add your comment!'); }
		else{
		$("#loading_comment").show();
		$("#loading_comment").fadeIn(800).html('<img src="/beta/images/ajax-loader.gif" align="absmiddle">&nbsp;<span class="loading">Adding Comment... as if you care.</span>');
			$.ajax({
				type: "POST",
				url: "/beta/ajax/post_comment.php",
				data: dataString,
				cache: false,
				success: function(html){
					$("ol#update").append(html);
					$("ol#update li:last").animate({opacity: 1.0}, 4000).fadeIn("slow");
					document.getElementById('comment').value='';
					$("#comment").focus();
					$("#loading_comment").hide();
				}
			});
		}
		return false;
	});
});



$(function() {
	$(".comment_delete").click(function() {
		var id = $(this).attr("id");
		var dataString = 'id='+ id ;
		var parent = $(this).parents('#row');
		if(confirm("Sure you want to delete this comment? There is NO undo!")){
		$.ajax({
			type: "POST",
			url: "/beta/ajax/delete_comment.php",
			data: dataString,
			cache: false,
			success: function(){
				if(id % 2){	parent.fadeOut('slow', function() {$(this).remove();});}
				else{		parent.slideUp('slow', function() {$(this).remove();});}
			}
		});
		}
		return false;
	});
});







$(function() {
	$(".event_add").click(function() {
	var id = $(this).attr("id");
	var dataString = 'id='+ id;
		if(id=='') { alert('Please add your event!'); }
		else{
		$("#added_event").show();
		$("#added_event").fadeIn(800).html('<img src="/beta/images/ajax-loader.gif" align="absmiddle">&nbsp;<span class="loading">Adding event...</span>');
			$.ajax({
				type: "POST",
				url: "/beta/ajax/post_event.php",
				data: dataString,
				cache: false,
				success: function(html){
					$("#added_event").append(html);
					$("#added_event").animate({opacity: 1.0}, 2000).fadeIn("slow").html('<p><strong>EVENT ADDED</strong></p>');
					$("#id").focus();
					$("#added_event").animate({opacity: 1.0}, 1000).fadeOut("slow");
					$(".event_add#"+id).animate({opacity: 1.0}, 1000).fadeOut("slow");
				}
			});
		}	
		return false;
	});
});







$(function() {
	$(".friend_add").click(function() {
		var id = $(this).attr("id");
		$("#id").val(id);
		var dataString = 'id='+ id ;
		if(id=='') { alert('Please add your friend'); }
		else{
		$("#added_friend").show();
		$("#added_friend").fadeIn(800).html('<img src="/beta/images/ajax-loader.gif" align="absmiddle">&nbsp;<span class="loading">Adding this person to your friend list.</span>');
			$.ajax({
				type: "POST",
				url: "/beta/ajax/post_friend.php",
				data: dataString,
				cache: false,
				success: function(html){
					$("#added_friend").append(html);
					$("#added_friend").animate({opacity: 1.0}, 2000).fadeIn("slow").html('<h5>Your friend has been added. Congrats, you\'re not a complete idiot.</h5><p>&nbsp;</p>');
					$("#id").focus();
					$("#added_friend").animate({opacity: 1.0}, 2000).fadeOut("slow");
					$("#add."+id).focus();
					$("#add."+id).fadeOut("slow");
				}
			});
		}
		return false;
	});
});


$(function() {
	$(".friend_remove").click(function() {
		var id = $(this).attr("id");
		var dataString = 'id='+ id ;
		var parent = $(this).parents('ol#update li');
		if(confirm("Sure you want to delete this friend? There is NO undo!")){
		$.ajax({
			type: "POST",
			url: "/beta/ajax/delete_friend.php",
			data: dataString,
			cache: false,
			success: function(){
				$("#removed_friend").show();
				$("#removed_friend").fadeIn(800).html('<img src="/beta/images/ajax-loader.gif" align="absmiddle">&nbsp;<span class="loading">Removing this friend... </span>');
				$("#id").focus();
				$("#removed_friend").animate({opacity: 1.0}, 2000).fadeOut("slow");
				$("#remove."+id).focus();
				$("#remove."+id).fadeOut("slow");
			}
		});
		}
		return false;
	});
});







$(function() {
	$(".team_submit").click(function() {
	var team_id = $(this).attr("id");
	$("#team_id").val(team_id);
	var dataString = 'team_id='+ team_id;
		if(team_id=='') { alert('Please add your team!'); }
		else{
		$("#loading_team").show();
		$("#loading_team").fadeIn(800).html('<img src="/beta/images/ajax-loader.gif" align="absmiddle">&nbsp;<span class="loading">Adding Team... now do something</span>');
			$.ajax({
				type: "POST",
				url: "/beta/ajax/post_team.php",
				data: dataString,
				cache: false,
				success: function(html){
					$("ol#update").append(html);
					$("ol#update li:last").animate({opacity: 1.0}, 4000).fadeIn("slow");
					$("#team_id").focus();
					$("#loading_team").hide();
				}
			});
		}
		return false;
	});
});


$(function() {
	$(".team_add").click(function() {
	var team_id = $(this).attr("id");
	$("#team_id").val(team_id);
	var dataString = 'team_id='+ team_id;
		if(team_id=='') { alert('Please add your team!'); }
		else{
		$("#added_team").show();
		$("#added_team").fadeIn(800).html('<img src="/beta/images/ajax-loader.gif" align="absmiddle">&nbsp;<span class="loading">Adding Team... now do something</span>');
			$.ajax({
				type: "POST",
				url: "/beta/ajax/post_team.php",
				data: dataString,
				cache: false,
				success: function(html){
					$("#added_team").append(html);
					$("#added_team").animate({opacity: 1.0}, 2000).fadeIn("slow").html('<p>Your team has been added. Congrats, you\'re not a complete idiot.</p>');
					$("#team_id").focus();
					$("#added_team").animate({opacity: 1.0}, 2000).fadeOut("slow");
					$("#add p a#"+team_id).focus();
					$("#add p a#"+team_id).fadeOut("slow");
				}
			});
		}
		return false;
	});
});


$(function() {
	$(".team_remove").click(function() {
		var id = $(this).attr("id");
		$("#id").val(id);
		var dataString = 'id='+ id;
		if(confirm("Sure you want to delete this team? There is NO undo!")){
		$.ajax({
			type: "POST",
			url: "/beta/ajax/delete_team.php",
			data: dataString,
			cache: false,
			success: function(){
				$("#removed_team").show();
				$("#removed_team").fadeIn(800).html('<img src="/beta/images/ajax-loader.gif" align="absmiddle">&nbsp;<span class="loading">Removing this team... </span>');
				$("#id").focus();
				$("#removed_team").animate({opacity: 1.0}, 2000).fadeOut("slow");
				$("#add p a#"+id).focus();
				$("#add p a#"+id).fadeOut("slow");
			}
		});
		}
		return false;
	});
});



$(function() {
	$(".team_delete").click(function() {
		var id = $(this).attr("id");
		var dataString = 'id='+ id;
		var parent = $(this).parents('ol#update li');
		if(confirm("Sure you want to delete this team? There is NO undo!")){
		$.ajax({
			type: "POST",
			url: "/beta/ajax/delete_team.php",
			data: dataString,
			cache: false,
			success: function(){
				if(id % 2){	parent.fadeOut('slow', function() {$(this).remove();});}
				else{		parent.slideUp('slow', function() {$(this).remove();});}
			}
		});
		}
		return false;
	});
});


//-->
