/**************************************************************************
Flux Overrideden/Additional Methods are needed for reloading widgets. 
These are essentially hacks to Flux's library before they decide to 
support the reloading functionality.
*************************************************************************/
if(typeof Flux == "object")
{

/******************************************/
/** Flux.WidgetEntry Additional Methods ***/
/******************************************/
Flux.WidgetEntry.prototype.changeTarget__ = function(uri) {
	this._contentId = uri;
	
	if (this._instance.setSetting__) {
		this._instance.setSetting__('uri', uri);
	}
	if (this._instance.setUri) {
		this._instance.setUri(uri);	
	}
	if (this._instance.setDataUrl) {
		this._instance.setDataUrl(uri);	
	}	
	
	this._instance.__settings.uri = uri;	
}

//this is a special function for reloading comments 3.
Flux.WidgetEntry.prototype.reloadComments3__ = function()
{
	this._instance._initialize(this._instance.__settings, "yes");
}



/**************************************/
/** Flux.Widgets Additional Methods ***/
/**************************************/

Flux.Widgets.BaseWidget.prototype.setSetting__ = function(name, value) {
	this.__settings[name] = value;
}


/******************************************/
/** Flux.EventManager Additional Methods **/
/******************************************/
Flux.EventManager.updateWidgetsWithNewContentId__ = function(uri) {

	for (var name in this._widgets) {
		var widgets = this._widgets[name];
		
		if (widgets instanceof(Array)) {
			for (var i = 0; i < widgets.length; i++) {
				var widgetEntry = widgets[i];
				widgetEntry.changeTarget__(uri);
				if(name == "Comments3")
				{
					widgetEntry.reloadComments3__();
				}else
				{				
					widgetEntry.callDataBind('newUri');
				}

			}
		}
	}
}



}//if