Studio.Shape.Image = function(){};

Studio.Shape.Image.prototype = 
{
    x               : 0,
    y               : 0,
    width           : "",
    height          : "",
    origwidth       : "",
    origheight      : "",
    url             : "",
    filename        : "",
    
    createDetails : function(oElement, aParams)
    {
        this.x          = aParams['x'];
        this.y          = aParams['y'];
        this.width      = aParams['width'];
        this.height     = aParams['height'];
        this.origwidth  = aParams['origwidth'];
        this.origheight = aParams['origheight'];
        this.url        = aParams['url'];
        this.filename   = aParams['filename'];
    },

    getUrlAttach : function()
    {
        var sUrl = '';
        sUrl += 'shapetype/'        + 'image'                 + '/';
        sUrl += 'x/'                + this.x                  + '/';
        sUrl += 'y/'                + this.y                  + '/';
        sUrl += 'width/'            + Math.round(this.width)  + '/';
        sUrl += 'height/'           + Math.round(this.height) + '/';
        sUrl += 'origwidth/'        + this.origwidth          + '/';
        sUrl += 'origheight/'       + this.origheight         + '/';
        sUrl += 'filename/'         + this.filename           + '/';
        return sUrl;
    },
    
    getPostArray : function()
    {
    	return null;
    },
    
    getX : function()
    {
        var iX, iStartX;
        iX = this.x;
        if (Studio.Zoom.iX > 0 && Studio.Zoom.iY > 0)
        {
            iStartX = Math.min(Studio.Canvas.iWidth - Studio.Canvas.iWidth / Studio.Zoom.iZoom, Math.max(Studio.Zoom.iX - Studio.Canvas.iWidth / ( 2 * Studio.Zoom.iZoom ), 0));
            iX = Math.max(  (this.x - iStartX) * Studio.Zoom.iZoom, 0  );
        }
        return iX;
    },
    
    getY : function()
    {
        var iY, iStartY;
        iY = this.y;
        if (Studio.Zoom.iX > 0 && Studio.Zoom.iY > 0)
        {
            iStartY = Math.min(Studio.Canvas.iHeight - Studio.Canvas.iHeight / Studio.Zoom.iZoom, Math.max(Studio.Zoom.iY - Studio.Canvas.iHeight / ( 2 * Studio.Zoom.iZoom ), 0));
            iY = Math.max(  (this.y - iStartY) * Studio.Zoom.iZoom, 0  );
        }
        return iY;
    },
    
    getWidth : function()
    {
        return Number(this.width);
    },
    
    getHeight : function()
    {
        return Number(this.height);
    },
    
    getCanvasWidth : function()
    {
        return Number(Math.round(this.width));
    },
    
    getCanvasHeight : function()
    {
        return Number(Math.round(this.height));
    }

};