///////////////////////////////////////////////////////////////////////////////
//
//  ExtendedPlayer
//
//  This extends the base player class, you may override the base player
//  member functions or add additional player functionality here. 
//
///////////////////////////////////////////////////////////////////////////////
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._controls = new  ExpressionPlayer.HotspotButton( this, "Controls" ); 
	},
	
	// override video gallery functions so we close it when click on an item.
	set_galleryInfo : function ( galleryItems, callbackDelegate ) {
		this._clickedGalleryItemDelegate = callbackDelegate;
		ExtendedPlayer.Player.callBaseMethod(this, 'set_galleryInfo', [galleryItems, Function.createDelegate(this, this._onClickGalleryItem)]);
	},
	
	_onClickGalleryItem : function (galleryItemIndex) {
		this._clickedGalleryItemDelegate.apply(this, [galleryItemIndex]);
		this._gallery.set_visible( false );
	},
		
	_onChapterClick : function (index) {
		ExtendedPlayer.Player.callBaseMethod(this, '_onChapterClick', [index]);    
		this._setProperties("visible", ["ChapterArea"], false);    
	},

	pluginDispose: function() {
		if (this._controls ) {
			this._controls.dispose();
		}
		this._controls=null;
		ExtendedPlayer.Player.callBaseMethod(this, 'pluginDispose');
	}    
}   
ExtendedPlayer.Player.registerClass('ExtendedPlayer.Player',ExpressionPlayer.Player);

