dojo.declare("DojoPageTitle", DojoAjax, 
{
	//reviewed - 
	//the DojoAjax constructor that takes the following parameters:
	//
	// servletUrl - the URL of the AJAX servlet
	// portletUniqueName - the unique name of the portlet
	// portletMode - the mode the portlet is currently in
	// namespace - the encoded namespace of the portlet
	constructor: function(servletUrl, portletUniqueName, portletMode, namespace, originalPageName)
	{
		this.servletUrl = servletUrl;
		this.portletUniqueName = portletUniqueName;
		this.portletMode = portletMode;
		this.namespace = namespace;
		//this.originalPageName = originalPageName;
	},
	//this is callback function to build updated context 
	refreshContextLayer: function(response, ioArgs)
	{
		var text = response;
		var products = eval('(' + text + ')');
		return response;
	
	},
	//call to refresh the portlet if different products are seleceted in the filter
	refresh: function(action)
	{
		if (action == UPDATE_PRODUCT_FILTER)
		{
			var parms = {"com.ibm.wplc.controller.action":"com.ibm.spe.pageTitle.action.UpdateSelectedProducts","com.ibm.wplc.controller.uniquePortletName": this.portletUniqueName, "com.ibm.wplc.controller.portletMode": this.portletMode}; 
			this.sendRequest(this.servletUrl, parms, dojo.hitch(this, this.insertProductNames));
			}
	},
	//this is the callback function to insert product choice into the title
	insertProductNames: function(response, ioArgs)
	{
		var text = response;
		var selectedProdSpan = dojo.byId(this.namespace + "_selectedProdSpan");	
		
		//Update the span for the subtitle text in the jsp
		selectedProdSpan.innerHTML = text;
										
	} ,
	//callback function that does nothing
	doNothingCallback: function()
	{
	}
});