
	var Options = AFL_JS.ActionDispatcher.MemberOptions = new Object();
	
	Options.Storage = {
			Data : null
	}
	
	Options.GetData = function() {
		return Options.Storage.Data;
	}
	
	Options.SetData = function(sJSONString, bPlain) {
		if(bPlain) {
			Options.Storage.Data = sJSONString;
			return;
		}
		Options.Storage.Data = sJSONString.evalJSON();
	}
	
	Options.requestCallbackConnect = function() {
		var Data = Options.GetData();
		
		var JSON = Data.Data.CallbackConnect;
		
		
		if (!AFL_JS.Common.Busyness.IsBusy('CallbackConnect')) {
			AFL_JS.Common.Busyness.Set('CallbackConnect', true, 20000);
			advAJAX.post({
				userCheck : true,
				url: '/ajax/getCallback.php',
				cli: null,
				country: JSON.Country,
				is_op : JSON.IsOperator,
				live_C : JSON.LiveCode,
				cli_type: 1, //is_mobile, 1 for mobile 0 for landlines
				service_name: JSON.Service,
				conference: JSON.Number,
				returnType : 'JSON',
				onLoading: function(){
					AnimatedOverlay.Open('animated_overlay_style_small');
				},
				onSuccess: function(obj){
					Panel.MemberOptions.ProcessCallbackConnect(obj.responseJSON);
				}
			});
		} else {
			AnimatedOverlay.ShowByContent('Sorry - You must wait at least 20 seconds before placing another callback request.', 'animated_overlay_style_small');
		}			
	}
	
	Options.requestShoutSubscription = function() {
		
		var JSON = Options.GetData();
		
		if (!AFL_JS.Common.Busyness.IsBusy('ShoutSubscription')) {
			AFL_JS.Common.Busyness.Set('ShoutSubscription', true, 20000);

			advAJAX.post({
				url: '/ajax/smsSubscriptions.php',
				returnType : 'JSON',
				event : 'Shout',
				is_op : JSON.Data.SMSSubscriptions.Shouts.TargetIsOperator,
				target_mem_id : JSON.Data.SMSSubscriptions.Shouts.TargetId,
				direction : !JSON.Data.SMSSubscriptions.Shouts.IsSubscribed,
				onLoading: function(){
					AnimatedOverlay.Open('animated_overlay_style_small');
				},
				onSuccess : function(obj) {
					Panel.MemberOptions.ProcessShoutSubscription(obj.responseJSON, JSON);
				}
			});
		} else {
			AnimatedOverlay.ShowByContent('Sorry - You must wait at least 20 seconds before placing another subscription request.', 'animated_overlay_style_small');
		}
	}
	
	Options.requestIVRAudioDescription = function() {
		if (AFL_JS.Common.Busyness.IsBusy('OrderDescription')) return;
		
		var Data = Options.GetData();
		
		if(!Data.FMN.Descriptions.HasAudio || !Data.FMN.Descriptions.AudioOrderId) {
			Panel.MemberOptions.ShowInfo("This guy doesn't have an audio profile. There are thousands of guys with audio profiles on Maleforce, so why not choose another guy and download his audio profile instead.");
			return;
		}
		
		AFL_JS.Common.Busyness.Set('OrderDescription', true);
				
		
		advAJAX.post({
			url: '/ajax/orderDescription.php',
			returnType: 'JSON',
			d_id: Data.FMN.Descriptions.AudioOrderId,
			onLoading: function(){
				AnimatedOverlay.Open('animated_overlay_style_main');
			},
			onSuccess : function(obj) {
				Panel.MemberOptions.ProcessDescriptionOrder(obj.responseJSON);
			}
		});
		
		//Panel.MemberOptions.ShowInfo("This guy doesn't have an audio profile. There are thousands of guys with audio profiles on Maleforce, so why not choose another guy and download his audio profile instead. ");
		AFL_JS.Common.Busyness.Set('OrderDescription', false);
		return;
	}
	
	Options.requestIVRVideoDescription = function() {
		
		
		if (AFL_JS.Common.Busyness.IsBusy('OrderDescription')) return;
		
		var Data = Options.GetData();

		if(!Data.FMN.Descriptions.HasVideo || !Data.FMN.Descriptions.VideoOrderId) {
			Panel.MemberOptions.ShowInfo("This guy doesn't have a video profile. There are plenty of guys with video profiles on Maleforce, so why not choose another guy and download his video profile instead.");
			return;
		}
		
		AFL_JS.Common.Busyness.Set('OrderDescription', true);
				
		
		advAJAX.post({
			url: '/ajax/orderDescription.php',
			returnType: 'JSON',
			d_id: Data.FMN.Descriptions.VideoOrderId,
			onLoading: function(){
				AnimatedOverlay.Open('animated_overlay_style_main');
			},
			onSuccess : function(obj) {
				Panel.MemberOptions.ProcessDescriptionOrder(obj.responseJSON);
			}
		});
		
		//Panel.MemberOptions.ShowInfo('This great new feature is currently being developed. Please check back in the next few days.');
		AFL_JS.Common.Busyness.Set('OrderDescription', false);
		return;
	}
	
	Options.prepareNotesEdit = function() {
		Options.Storage.CurrentNotes = $F('profile_item_notes');
	}
	
	Options.requestNotesSave = function() {
		
		var Current = $F('profile_item_notes');
		
		if(Options.Storage.CurrentNotes == Current) return;
		
		if (AFL_JS.Common.Busyness.IsBusy('SaveNote')) return;
		AFL_JS.Common.Busyness.Set('SaveNote', true);
			
		var Data = Options.GetData();
	
		advAJAX.post({
			url: '/ajax/saveNotes.php',
			content: Current,
			target_id :  Data.Data.MemberId,
			onLoading: function(){
				AnimatedOverlay.Open('animated_overlay_style_small');
			},
			onSuccess: function(obj){
				Data.Member.Notes = $F('profile_item_notes');
				Options.SetData(Data, true);
				AFL_JS.Common.Busyness.Set('SaveNote', false);
				AnimatedOverlay.Close();
			}
		});
	}

	Options.sendMessage = function() {
		
		var Data = MainGrid.GetData(Panel.Current);
		location.href= '/messages/new/' + Data.Data.MemberId;	
	}

	
	Options.requestSMSChatSend = function() {
		if (AFL_JS.Common.Busyness.IsBusy('SendSMSChat')) {
			Panel.MemberOptions.SMS.ShowInfo('<div class="warning_color bold center error_pos">Sorry - You must wait at least 10 seconds before placing another sms request.</div>');
			return;
		}
		
		var Data = Options.GetData();

		var CLI = $F('sms_chat_cli');
		var Content =  $F('profile_item_sms');
				
		if(!Content.length) {
			Panel.MemberOptions.SMS.ShowInfo('<div class="warning_color bold center error_pos">Please enter a message.</div>', Panel.MemberOptions.LoadSMSChatSend);
			return;
		}
		
		advAJAX.post({
			url: '/ajax/smsChat.php',
			content: Content,
			cli : CLI,
			returnType : 'JSON',
			is_op : Data.IsOperator,
			target_mem_id : Data.Data.MemberId,
			onLoading: function(){
				Panel.MemberOptions.SMS.ShowInfo('<div id="sms_send_loader"></div>');
			},
			onSuccess : function(obj) {
				AFL_JS.Common.Busyness.Set('SendSMSChat', true, 10000);
				Panel.MemberOptions.ProcessSMSChatSend(obj.responseJSON, Data.IsOperator);
			}
		});
	}
	