if (FJ === undefined) alert('fj.js must be included first');
else {
	FJ.DisplayManager = Class.create({
		
		CLASSNAME: 'DisplayManager',
		
		UI: null,
		
		initialize: function() {
			// initialize the extensions via BaseModule mixin
			this.initialize_extensions();
			
			// initialize the UI object
			this.UI = new FJ.UI();
			
			// add browser listeners
			this.enhance();
			this.setup_agent_styles();
		},
		
		enhance: function() {
			this._perform_op("enhance");
		},
		degrade: function() {
			this._perform_op("degrade");
		},
		_perform_op: function(operation) {
			for (var varName in this.UI) {
				var object = this.UI[varName];
				if (object && object[operation]) {
					object[operation]();
				}
			}
		},
		
		setup_agent_styles: function () {
			if (Prototype.Browser.Gecko) {
				$$('head')[0].appendChild(
					new Element(
						'link', { 'href': THEMEBASE + "/stylesheets/content.gecko.css",  'media':"screen", 'rel':"stylesheet", 'type':"text/css"} 
					)
				);
			}
		},
		
		scroll_to_top: function() {
			if ($$('body')[0]) $$('body')[0].scrollTo();
		}
		
	});
	
	// mixin modules
	FJ.DisplayManager.addMethods(FJ.Modules.BaseModule);
	FJ.DisplayManager.addMethods(FJ.Modules.InstanceRegistration);
	
	// place an instance method on the FJ superobject
	FJ.display = function () {
		var instance = FJ.get_singleton("DisplayManager");
		if (instance == null) instance = FJ.set_singleton("DisplayManager", new FJ.DisplayManager());
		return instance;
	};
}