
	
	function showNotifications()
	{
		getNotifications();
		centerPopup("#notificationsPopup"); 
		loadPopup("#notificationsPopup");
	}
	
	
	
	function getNotifications()
	{
		$("#notifications").html('<img src="images/loading.gif" alt="Please wait..." />');
		
		$.get("getnotifications.php", function(data){
  			$("#notifications").html(data);
		});
	}
	
	
	
	function getNotificationCount( viewingpost )
	{
		// viewingpost is passed to the php page so that 
		$.get("getnotificationcount.php", { viewingpost: viewingpost },
		
			function(data){		
				if ( data > 0 )
				{
					$("#notificationscount").text(data);
					$("#notificationscount").fadeIn(500);
				}
				else { $("#notificationscount").fadeOut(500); }
			}
		);
	}
	
	
	function hideNotification(postID)
	{
		
		$.get("hidenotification.php", { postID: postID },
			function(resp)
			{
				if ( resp == "done" )
				{
					$("#notificationpost"+postID+"row1").fadeOut(200);
					$("#notificationpost"+postID+"row2").fadeOut(200);
					getNotificationCount()
				}
				else { alert(resp); }
			}
		);
	}
	
	
	function stopNotifications(postID)
	{
		
		$.get("stopnotifications.php", { postID: postID },
			function(resp)
			{
				if ( resp == "done" )
				{
					$("#notificationpost"+postID+"row1").fadeOut(200);
					$("#notificationpost"+postID+"row2").fadeOut(200);
					getNotificationCount()
				}
				else { alert(resp); }
			}
		);
	}


