/// ******************************************************************************************************************
/// ExtendedPlayer - volume slider animates out when you hover over it, chapters show when hovered over.
Type.registerNamespace('ExtendedPlayer');

ExtendedPlayer.Player = function(domElement) {
	ExtendedPlayer.Player.initializeBase(this, [domElement]);    
}
ExtendedPlayer.Player.prototype =  {
	onPluginLoaded: function(args) {    
		ExtendedPlayer.Player.callBaseMethod(this, 'onPluginLoaded', [args]);       
		this._volumeHotspot = new ExpressionPlayer.HotspotButton(this, "VolumeControl");            
		this._chapterHotspot = new ExpressionPlayer.HotspotButton(this, "ChapterAreaHotspot");          
	},    

	numVisibleChapters: function (chaptersList) {
		var cVisibleChapters=0;
		if (chaptersList) {
			for (var i = 0, l = chaptersList.length; i < l; i++) {
				if (chaptersList[i].get_thumbnailSource()) 
					cVisibleChapters++;
			}
		}
		return cVisibleChapters;
	},
		
	set_chapters: function(value){
		ExtendedPlayer.Player.callBaseMethod(this, 'set_chapters', [value]);   
		this._chapterHotspot.get_element().Visibility =  (this.numVisibleChapters(value)>0)?0:1;   		
	},    

	pluginDispose: function() {
	    if (this._volumeHotspot) {
	        this._volumeHotspot.dispose();
	    }    
		this._volumeHotspot=null;
		if (this._chapterHotspot) {
		    this._chapterHotspot.dispose();
		}
		this._chapterHotspot=null;
		ExtendedPlayer.Player.callBaseMethod(this, 'pluginDispose');    		
	} 
}
ExtendedPlayer.Player.registerClass('ExtendedPlayer.Player', ExpressionPlayer.Player);

