var MilkboxTS = new Class({
    Extends: Milkbox,
    
    options:{//set all the options here
		minHeight: 50,
		minWidth: 50
	},
    
	showFile:function(file){
		if(this.closed){ return; };//if you close the Milkbox and an onload event is still running
		
		var fileSize = new Hash();
		var targetSize = {};
		var b = null;
		var p = null;
		if(this.options.canvasBorderWidth.toInt() != 0 && this.canvas.getStyle('borderWidth').toInt() == 0){
			b = this.options.canvasBorderWidth + ' solid ' + this.options.canvasBorderColor;
			this.canvas.setStyle('border',b);
		}
		
		if(this.options.canvasPadding.toInt() != 0 && this.canvas.getStyle('padding').toInt() == 0){
			p = this.options.canvasPadding;
			this.canvas.setStyle('padding',p);
		}
		
		var canvasSize = this.canvas.getSize();
		var canvasAddSize = this.canvas.getStyle('borderWidth').toInt()*2 + this.canvas.getStyle('padding').toInt()*2;
		this.canvas.setStyles({'opacity':0, 'width':'', 'height':''});
		
		if(!file.retrieve('width')){//is an image file
			fileSize = fileSize.extend(file.getProperties('width','height')).map(function(item, index){ return item.toInt(); });
		} else {//is an swf file
			fileSize.extend({ 'height':file.retrieve('height').toInt(), 'width':file.retrieve('width').toInt() });
		}
		if (fileSize.width < this.options.minWidth) {
			fileSize.width = this.options.minWidth;
		}
		if (fileSize.height < this.options.minHeight) {
			fileSize.height = this.options.minHeight;
		}

		var centerSize = new Hash(this.center.getStyles('width','height')).map(function(item, index){ return item.toInt(); });

		if(fileSize.width != centerSize.width){ 
			targetSize.width = fileSize.width + canvasAddSize;
			targetSize.marginLeft = -(targetSize.width/2).round();
		}
		 		
		var gap = (canvasSize.y-canvasAddSize > 0) ? centerSize.height - canvasSize.y : 0; 

	   targetSize.height = fileSize.height + canvasAddSize + gap;
	   
		//so nav doesn't move when you click next/prev
		this.canvas.setStyles({'width':fileSize.width, 'height':fileSize.height});

		this.center.removeClass('mbLoading');
		
		var d = 0;
		if(this.first){ d = 500; this.first = false; }
		(function(){ this.center.morph(targetSize); }).delay(d,this)//onComplete: show all items
	}
});
