// -----------------------------------------------------------------------------------
//  Icbeberg Commerce 2010
//  Video Gallery
// -----------------------------------------------------------------------------------
VideoGallery_View = Class.create();
VideoGallery_View.prototype = {
		
	width : 260,
	height : 240,
	container : '',
	videoBlocks: new Array(),
	
	initialize : function(width, height , container ) {
        this.width = width;
        this.height = height;
        this.container = container;
    },
	
	setVideo : function(video_id)
	{	
    	if (!video_id)
    	{
    		return false;
    	}
    	
    	if (this.prev_video && video_id != this.prev_video)
    	{
    		Element.hide('video-container-' + this.prev_video );
    		$('video-container-' + this.prev_video).innerHTML = '';
    	}
    	
    	this.prev_video = video_id;
    	$('video-container-' + video_id).innerHTML = this.videoBlocks[video_id];
    	Element.show( 'video-container-' + video_id );
		return false;
	},
	
	setPrevVideo : function()
	{
		this.setVideo(this.prev_video);
	},
	
	setHeight : function ( height )
	{
		this.height = height;
	},
	
	setWidth : function( width )
	{
		this.width = width;
	},
	
	grow : function()
	{
		if( $('video-container-' + this.prev_video + ' video-object' ).getWidth() > 300 )
		{
			return this.shrink();
		}
		
		new Effect.Scale( 'video-container-' + this.prev_video + ' video-object' , 240 );
		Element.show( 'video-shrink');
		Element.hide( 'video-grow');
	},
	
	shrink : function( )
	{
		new Effect.Scale('video-container-' + this.prev_video + ' video-object' , 41.667 );
		Element.show('video-grow');
		Element.hide('video-shrink');
	},
	
	hide : function()
	{
		$('video-container-' + this.prev_video).innerHTML = '';
	}
}
