GupShup.callback.processSubscribeResp = function(xhr){
	var status = GupShup.util.getJsonFromResponse(xhr.responseText);
	switch(status.status)
	{
		case 'SUCCESS':
		{
			switch(status.errorCode)
			{
				case 'SUCCESS':
				case 'NO_ERROR':
				case 'TRIAL':
				case 'JOIN': GupShup.util.postData(GupShup.conf.contextPath + '/subscribedGroupMessages?entityName=' + status.entityDetails.orgName,'status','joined','message',status.message); 
							 break;
			}
		}
		break;
		case 'FAILURE' :
		{
			GupShup.forms.showNotification(status.message,{failure:true});
		}
	}
};

GupShup.callback.processComSubscribeResp = function(xhr){
	var status = GupShup.util.getJsonFromResponse(xhr.responseText);
	var comName = status.params.comName;
	var id = status.params.entityId;
	switch(status.status)
	{
		case 'SUCCESS':
		{
			switch(status.errorCode)
			{
				case 'SUCCESS':
				case 'NO_ERROR':
				case 'JOIN': GupShup.forms.showNotification('You joined the community ' + comName + '.',{success:true});
							 GupShup.html.util.hideElement('communityJoinBtn_' + id);
							 break;
			}
		}
		break;
		case 'FAILURE' :
		{
			GupShup.forms.showNotification('There was internal error while joining community ' + comName + ', please try again later.',{failure:true});
		}
	}
};
