
		
		
/**
 *
 * A class to initialize and run the vidoe popover
 *
 **/
var VideoPopover  = Class.$extend({
	
	__init__ : function(){
		var self = this;
		this._sOverlayTrigger = '.overlayTrigger';
		
		this._bReloadOnClose = false;
		this._oConfig = {
			target:'#videoOverlay',
			expose:'black',
			closeOnClick:false,
			speed:300,
			onBeforeClose: function (){
				//Reload the base page (if it should)
				if(self._bReloadOnClose){
					window.location.href=window.location.href;
				}
			}
		};
		this._jOverlayObj = $(this._sOverlayTrigger).overlay(this._oConfig);
		this._jOverlayContainer = $(this._oConfig['target']);
		this._jOverlayContent = $('#videoOverlayContents');
	},
	
	/**
	 * Show the popover
	 **/
	show : function(new_config){
		
		this.deploy_config(new_config);
		this._jOverlayObj.load();
		console.log(this._jOverlayObj);
	},
	
	deploy_config : function(oConfig){
		if(oConfig != undefined){
			if(oConfig['width']!=undefined){
				this._jOverlayContainer.width(oConfig['width']);
			}
			if(oConfig['height']!=undefined){
				this._jOverlayContainer.height(oConfig['height']);
			}
			if(oConfig['iframe_src']!=undefined){
				
				this._jOverlayContent.html("<iframe src='"+oConfig['iframe_src']+"' ></iframe>");
			} 
			if(oConfig['reload_on_close']!=undefined && oConfig['reload_on_close']==true){
				this._bReloadOnClose = true;
			} else {
				this._bReloadOnClose = false;
			}
			if(oConfig['swf_video_name']!=undefined){
				this._sSWFVideoName = oConfig['swf_video_name'];
			}
		}
	}
});
