var NOTIFY_TYPE_FORUM = 1;
var NOTIFY_TYPE_PICTU = 2;
var NOTIFY_TYPE_GROUP = 3;
var NOTIFY_TYPE_GRCAL = 4;
var NOTIFY_TYPE_BLOGS = 5;

function delNotification(type, primaryID, secondaryID) {
 if( !confirm("Willst du diese Benachrichtigung wirklich löschen?") ) {
  return;
 }
 new Ajax.Request('/p_myprofile_notifications.ajax.php', {
 	method:		'post',
	parameters:	{'action': 'del', 'type': type, 'primaryID': primaryID, 'secondaryID': secondaryID},
	onSuccess:	function(transport) {
			 var res = transport.responseText.evalJSON(true);
			 if( res['fail'] == 0 ) {
			  $('tab-' + type + '-' + primaryID + '-' + secondaryID).remove();
			 }
			 alert(res['status']);
		}
 });
}

function readNotification(type, primaryID, secondaryID) {
 if( !confirm("Willst du diese Benachrichtigung wirklich als gelesen markieren?") ) {
  return;
 }
 new Ajax.Request('/p_myprofile_notifications.ajax.php', {
 	method:		'post',
	parameters:	{'action': 'read', 'type': type, 'primaryID': primaryID, 'secondaryID': secondaryID},
	onSuccess:	function(transport) {
			 var res = transport.responseText.evalJSON(true);
			 if( res['fail'] == 0 ) {
			  $('tab-' + type + '-' + primaryID + '-' + secondaryID).remove();
			 }
			 alert(res['status']);
		}
 });
}

function jump(type, primaryID, secondaryID) {
 new Ajax.Request('/p_myprofile_notifications.ajax.php', {
 	method:		'post',
	parameters:	{'action': 'jmp', 'type': type, 'primaryID': primaryID, 'secondaryID': secondaryID},
	onSuccess:	function(transport) {
			 var res = transport.responseText.evalJSON(true);
			 if( res['fail'] == 0 ) {
			  location.href = res['destURL'];
			 } else {
			  alert(res['status']);
			 }
		}
 });
}

function addNotification(type, primaryID, secondaryID) {
 new Ajax.Request('/p_myprofile_notifications.ajax.php', {
 	method:		'post',
	parameters:	{'action': 'add', 'type': type, 'primaryID': primaryID, 'secondaryID': secondaryID},
	onSuccess:	function(transport) {
			 var res = transport.responseText.evalJSON(true);
			 alert(res['status']);
		}
 });
}

