Gallery.prototype.playVideo = function(video_path, size){
	
	if(video_path != this.old_video_path){
		
		this.old_video_path = video_path;
		
		var _me = this;
			
		var canvas_width = this.big_image.width();
		var canvas_height = this.big_image.height();
		
		this.big_image.find('img, #'+this.player_id).remove();
		this.selected_item = [];
		
		
		var d_canvas_width = size.width - canvas_width;
		var d_canvas_height = size.height - canvas_height;
	
		if(d_canvas_height || d_canvas_width){
			var video_tween = new Tween(this.big_image, '', this.anim_func, 0, 1, this.anim_dur);
			video_tween.onMotionChanged = function(obj){
				obj.style.width = (this.position * d_canvas_width + canvas_width) + 'px';
				obj.style.height = (this.position * d_canvas_height + canvas_height) + 'px';
			};
			video_tween.onMotionFinished = function(obj){
				_me.writeFlash(video_path, size);
				_me.big_image.css({width:size.width+'px', height:size.height+'px'});
			}
		}
		else{
			_me.writeFlash(video_path, size);
		}
		
	}
}

Gallery.prototype.writeFlash = function(video_path, size){
	var video_node = $('<div>').attr('id', this.player_id);
	this.big_image.prepend(video_node);
	
	var so = new SWFObject(Gallery.video_player_url, this.player_id+'_flv', size.width, size.height, 8, '#17191c');
	so.addVariable('skin_path', Gallery.video_player_skin_url);

	var video_path = video_path.replace(/\.\w+$/, '.flv');
	
	so.addVariable('flv_path', video_path);
	so.write(this.player_id);
}