// Azione
var UserActions = {
	// Overlay
	modified: new Array(),

	// chiama_on: function (profile_id, nick, aaa_fn) { alert('Chiama on\nprofile_id: ' + profile_id + '\nnick: ' + nick); },
	
	// vedi_on: function (profile_id, nick, aaa_fn) { alert('Vedi profilo on\nprofile_id: ' + profile_id + '\nnick: ' + nick); },
	
	message_on: function (t_pid, t_nick, aaa_fn) {
		OverlayManager.show('sendmessage', 'message', aaa_fn, t_nick, t_pid);
	},
	
	sms_on: function (t_pid, t_nick, aaa_fn) {
		OverlayManager.show('sendsms', 'sms', aaa_fn, t_nick, t_pid, 0.30);
	},
	
	mms_on: function (t_pid, t_nick, aaa_fn) {
		OverlayManager.show('sendmms', 'mms', aaa_fn, t_nick, t_pid, 0.70);
	},
	
	friendlist_add_on: function (t_pid, t_nick, aaa_fn, elId, pType) {
		OverlayManager.show('addfriend', t_pid, t_nick, aaa_fn, elId, pType);
	},
	
	friendlist_remove_on: function (t_pid, t_nick, aaa_fn, elId, pType) {
		OverlayManager.show('removefriend', t_pid, t_nick, aaa_fn, elId, pType);
	},
	
	blacklist_add_on: function (t_pid, t_nick, aaa_fn, elId, pType) {
		OverlayManager.show('addblacklist', t_pid, t_nick, aaa_fn, elId, pType);
	},
	
	blacklist_remove_on: function (t_pid, t_nick, aaa_fn, elId, pType) {
		OverlayManager.show('removeblacklist', t_pid, t_nick, aaa_fn, elId, pType);
	},
	
	chat_on: function (t_pid, t_nick, aaa_fn) {
		// Utilities.openChat(profile_id, application_id);
		var callback = {
		    success : function (o) {				
				if(Utilities.needLP(o.responseText))
					Utilities.checkFeature(o.responseText);
				else
					Utilities.openChat(t_pid, t_nick, aaa_fn);
		    },
		    failure : function (o) { }
		};

		var actionString = 't_pid=' + t_pid + '&t_nick=' + t_nick + '&aaa_fn=' + aaa_fn;
		YAHOO.util.Connect.asyncRequest('POST', 'http://' + conf.baseUrl + '/gui_manager/chat', callback, actionString);	
	},
	
	kiss_on: function (t_pid, t_nick, aaa_fn) {
		OverlayManager.show('kiss', t_pid, t_nick, aaa_fn);
	},
	
	/*chiama_off: function () {
		OverlayManager.show('genericMessage', 'Chiama', 'Non ti č permesso utilizzare questa funzionalitą', 'rosso');
	},
	
	vedi_off: function () {
		OverlayManager.show('genericMessage', 'Vedi profilo', 'Non ti č permesso utilizzare questa funzionalitą', 'rosso');
	},*/
	
	message_off: function () {
		// OverlayManager.show('genericMessage', 'Invia messaggio', 'Non ti č permesso utilizzare questa funzionalitą', 'rosso');
		UserActions._showNotAllowed('Invia messaggio');
	},
	
	sms_off: function () {
		// OverlayManager.show('genericMessage', 'Invia sms', 'Non ti č permesso utilizzare questa funzionalitą', 'rosso');
		UserActions._showNotAllowed('Invia messaggio');
	},
	
	mms_off: function () {
		// OverlayManager.show('genericMessage', 'Invia sms', 'Non ti č permesso utilizzare questa funzionalitą', 'rosso');
		UserActions._showNotAllowed('Invia messaggio');
	},
	
	friendlist_add_off: function () {
		// OverlayManager.show('genericMessage', 'Aggiungi amico', 'Non ti č permesso utilizzare questa funzionalitą', 'rosso');
		UserActions._showNotAllowed('Aggiungi un amico');
	},
	
	friendlist_remove_off: function () {
		// OverlayManager.show('genericMessage', 'Rimuovi amico', 'Non ti č permesso utilizzare questa funzionalitą', 'rosso');
		UserActions._showNotAllowed('Togli un amico dalla tua lista');
	},
	
	blacklist_add_off: function () {
		// OverlayManager.show('genericMessage', 'Aggiungi amico', 'Non ti č permesso utilizzare questa funzionalitą', 'rosso');
		UserActions._showNotAllowed('Aggiungi alla blacklist');
	},
	
	blacklist_remove_off: function () {
		// OverlayManager.show('genericMessage', 'Rimuovi amico', 'Non ti č permesso utilizzare questa funzionalitą', 'rosso');
		UserActions._showNotAllowed('Togli dalla blacklist');
	},
	
	chat_off: function (t_pid, t_nick, aaa_fn) {
		OverlayManager.show('genericMessage', 'Chatta', 'Non ti č permesso utilizzare questa funzionalitą', 'rosso');
		// UserActions._showNotAllowed('Chatta');
		// Utilities.openChat(t_pid, t_nick);
	},
	
	kiss_off: function () {
		// OverlayManager.show('genericMessage', 'Bacia', 'Non ti č permesso utilizzare questa funzionalitą', 'rosso');
		UserActions._showNotAllowed('Bacia');
	},
	
	_showNotAllowed: function (action) {
		OverlayManager.show('genericMessage', action, 'Non ti č permesso utilizzare questa funzionalitą', 'rosso');
	},
	
	// Notification panel
	acceptChat: function (nid, tpid, tnick) {
		Utilities.openChat(tpid, tnick);
		DwrManager.consumeChatRequest(nid);
		notifies.removeNotify(nid, "chat");
	},
	
	rejectChat: function (nid) {
		DwrManager.consumeChatRequest(nid);
		notifies.removeNotify(nid, "chat");
	},
	
	readMessage: function (nid) {
		DwrManager.consumeMessageRequest(nid);
		location.href = 'http://' + my_profile.nick + '.' + conf.domain + '/message/inbox';
	},
	
	deleteMessage: function (nid) {
		alert('Cancella messaggio');
		DwrManager.consumeMessageRequest(nid);
	},
	
	readKiss: function (nid) {
		DwrManager.consumeMessageRequest(nid);
		location.href = 'http://' + my_profile.nick + '.' + conf.domain + '/message/kisses';	
	},
	
	rejectKiss: function (nid) {
		alert('Bacio rifiutato');
		DwrManager.consumeKissRequest(nid);
	}
};