
    var mm_piece = function (x, y, color, title)
        
        {
        this . color = color;       // one of {"white", "black"}
        this . title = title;       // one of {"pawn", "knight", "bishop", "rook", "queen", "king"}
        this . x = x - 0;           // in squares
        this . y = y - 0;           // in squares
        this . x_offset = x - 0;    // in squares
        this . y_offset = y - 0;    // in squares

        this . frozen = NO;
        this . frozen_title = null;
        this . frozen_x = 0;        // in squares
        this . frozen_y = 0;        // in squares

        this . height = 64; // in pixels
        this . width = 64;  // in pixels

        this . move = function (x, y, animate)
        
            {
            this . x_offset = animate ? this . x - (x - 0) : 0;
            this . y_offset = animate ? this . y - (y - 0) : 0;
            this . x = x - 0;
            this . y = y - 0;

            return;
            };
        
        this . hold = function (x, y)
        
            {
            this . x_offset = (x - 0) - this . x;
            this . y_offset = (y - 0) - this . y;

            return;
            };

        this . promote = function (title)
        
            {
            this . title = (title == null) ? this . title : title;

            return;
            };
        
        this . demote = function (title)
        
            {
            this . title = (title == null) ? this . title : "pawn";
            
            return;
            };
        
        this . freeze = function ()
        
            {
            this . frozen = YES;

            this . frozen_title = this . title;

            this . frozen_x = this . x;
            this . frozen_y = this . y;
            
            return;
            };
        
        this . unfreeze = function ()
        
            {
            this . title = this . frozen_title;

            this . x = this . frozen_x;
            this . y = this . frozen_y;

            this . x_offset = 0;
            this . y_offset = 0;

            this . frozen = NO;
            
            return;
            };
        };