/**
 * NetcastSettingProvider
 * 
 */

var NetcastSettingsProvider = Class.create(AbstractContentProvider, {
	initialize: function($super, showFnc) {
		$super('/netcast/web/settings', showFnc);
	},

	renderXML: function(xml) {
		var data = new NetcastSettings(xml);
		return data;
	}
});

/**
 * NavNetcastProvider
 *
 */

var NavNetcastProvider = Class.create(AbstractContentProvider, {
	initialize: function($super, showFnc) {
		$super('/netcast/web/menu', showFnc);
	},

	renderXML: function(xml) {
		netcastMenu = new NetcastMenu(xml);
		return netcastMenu;
	}
});

/**
 * NavNetcastPluginsProvider
 *
 */

var NavNetcastPluginsProvider = Class.create(AbstractContentProvider, {
	initialize: function($super, showFnc) {
		$super('/netcast/web/external', showFnc);
	},

	renderXML: function(xml) {
		var ext = new NetcastPluginList(xml);
		var data = {
				'externals' : ext.getArray(),
				'anyGui' : ext.anyGui
			};
		return data;
	}
});

/**
 * NetcastListProvider
 * 
 */

var NetcastListProvider = Class.create(AbstractContentProvider, {
	/**
	 * initialize
	 * See the description in AbstractContentProvider
	 */
	initialize: function($super, showFnc) {
		$super('/netcast/web/list', showFnc);
		this.netcasts='';
		this.INDEX=0;
		this.NAME=1;
		this.BITRATE=2;
	},

	sort: function(by){
		var data = { netcasts : sortBy(this.netcasts, by) };
		this.show(data);
	},

	/**
	 * renderXML
	 * See the description in AbstractContentProvider
	 */
	renderXML: function(xml) {
		this.netcasts = new NetcastList(xml).getArray();
		return { netcasts : this.netcasts };
	},
	
});

var CurrentNetcastProvider = Class.create(AbstractContentProvider, {
	/**
	 * initialize
	 * Parameters:
	 * @target: the html target id
	 */
	initialize: function($super, showFnc){
		$super('/netcast/web/current', showFnc);
	},

	/**
	 * renderXML
	 * See the description in AbstractContentProvider
	 */
	renderXML: function(xml){
		var volume = new Vol(xml).toJSON();
		var current = new Netcastinfo(xml);
		var data = {
			'station' : current.station,
			'info' : current.info,
			'title' : current.title,
			'title_txt' : current.title_txt,
			'bitrate_txt' : current.bitrate_txt,
			'bitrate' : current.bitrate,
			'location' : current.location,
			'codec' : current.codec,
			'volume' : volume
			};
		return data;
	}
});
