addScopeJS(["Approach", "Component", "Slide"], {

	Attach:function(updated_component){

		let me =  $(updated_component).closest(".ComponentInstance.SlideLayout").data("self");
		let id = $(updated_component).data("self");
		let which_component = $(updated_component).closest(".ComponentGroup").data("component");

		let token = [ "__self_id", "_that", "_which_component"];
		let value = [me, id, which_component];

		let DataIntent = {
			"command": {
				"DATA":{
					"Component": "Push"
				}
			},
			"support": {
				"component_id": me,
				"which_component" : "Slide",
				'component://Slide':{
					"__self_id" : me,
					"_that" : id,
					"_which_component" : which_component
				}
			}
		};

		console.log("Attaching component to Slide:"+me+"~>PUSH", token, value);

		var ReqData = { json: JSON.stringify(DataIntent) };

		$.ajax({
			url: "//service.suiteux.com/Utility.php",   //url of Utility.php
			type: "post",
			data: ReqData,  //the json data
			dataType: "json",
			xhrFields: {                    withCredentials: true                },
			crossDomain: true,
			success: Interface.call.Ajax
		});

		return true;
	},
	Dettach:function(e){
		let updated_component = $(e.target).closest(".ComponentGroup");
		let me =  $(updated_component).closest("ComponentInstance.SlideLayout").data("self");
		let id = $(updated_component).data("self");
		let which_component = $(updated_component).closest("ComponentGroup").data("component");

		let token = [ "__self_id", "_that", "_which_component"];
		let value = [me, null, null];

		let DataIntent = {
			"command": {
				"REFRESH":{
					"Component": "Push"
				}
			},
			"support": {
				"component_id": me,
				"which_component" : "Slide",
				"token": token,
				"value": value
			}
		};

		console.log("Detaching component with Slide:"+me+"~>PUSH", token, value);

		var ReqData = { json: JSON.stringify(DataIntent) };

		$.ajax({
			url: "//service.suiteux.com/Utility.php",   //url of Utility.php
			type: "post",
			data: ReqData,  //the json data
			dataType: "json",
			xhrFields: {                    withCredentials: true                },
			crossDomain: true,
			success: Interface.call.Ajax
		});

		return true;
	}

});
