var InlineLinkUpdater = Class.create({

	initialize: function (linkIdentifier) {
	
	    this.debug = false;

					// css class to watch
	    if (linkIdentifier == null) {
	    	linkIdentifier = 'inlineLink';
	    }
	    this.linkIdentifier = linkIdentifier

     // use the existing AjaxMenu class to handle the url clicks
	    this.inlineAjaxMenu = new AjaxMenu(this.linkIdentifier, {});
	    this.ajaxContent = null;

	},
	

	updateCallback: function(obj,text) {
	// Need to finish fulfilling the page load request by displaying the text, then
	// make sure to update the isRunning flag.
		if (this.debug) console.log('InlineLinkUpdater.updateCallback(): arrived. ');
		$(obj.container).update(text);
		obj.isRunning = false;
		
 // Now we *reinitialize the inlineAjaxMenu object so that it updates its internal
 // list of watched links. Then we set them to be handed by the AjaxContent object.
		this.inlineAjaxMenu.initialize(this.linkIdentifier, {});
		this.inlineAjaxMenu.setClickCallback(this.ajaxContent.getContent.bind(this.ajaxContent));
		
	},
	
	// we will keep a reference to the AjaxContent object created in application.js
	setAjaxContent: function (ajc) {
		if (this.debug) console.log('InlineLinkUpdater.setAjaxContent(): arrived. ');
		this.ajaxContent = ajc;
	}

    
});
