/**
 * Image editor
 * 
 */
var imageEditor = new function (){
    
    this.originalImage       = null;
    this.originalImageWidth  = null;
    this.originalImageHeight = null;

    
    /**
     * Init
     */
	this.init = function(type){
        this.originalImage = $('#originalImage');
        this.cloneImage = $('#cloneImage');
		$("#zoom").slider({
		    min: 200,
		    max: 20,
		    startValue: 105,
			axis: 'vertical',
		    slide: imageEditor.resizeOriginal,
			range: true
		});
	}

    
    /**
     * resize 
     */
    this.resizeOriginal = function(e, ui)
    {
        var sliderValue = ui.value;
        
        if (!imageEditor.originalImageWidth) {
            imageEditor.originalImageWidth = imageEditor.originalImage.width();
            imageEditor.originalImageHeight = imageEditor.originalImage.height();
        }
                
        var newWidth = Math.round(imageEditor.originalImageWidth * (sliderValue / 100));
//        var newHeight = Math.round(imageEditor.originalImageHeight * (sliderValue / 100));
        
        imageEditor.originalImage.width(newWidth);
        imageEditor.cloneImage.width(newWidth);

//        imageEditor.originalImage.height(newHeight);
//        $('#sizeInfo').html(sliderValue + ": " + newWidth + "x" + newHeight);
    }
}
