Degri.Pin = function(name, width, height, image)
{
    this.id = name;
    this.x = 0;
    this.y = 0;
    this.width = width;
    this.height = height;
    this.image = image;
    
    this.Draw = function()
    {
        $('#pins').append($('<div id="' + this.id + '" class="png"><img src="' + this.image + '" width="' + this.width + '" height="' + this.height + '" alt=""/></div>'));
        $('#' + this.id).css('top',this.y);
        $('#' + this.id).css('left',this.x);
    };
    
    this.Shake = function()
    {
        var shakeType = Math.round(Math.random() * 9);
        //var obj = $('#' + this.id);
        switch(shakeType)
        {
            case 0:
                $('#' + this.id).effect("bounce", { direction:"left", distance:12, times: 3 }, 10);
            break;

            case 1:
                $('#' + this.id).effect("bounce", { direction:"right", distance:12, times: 3 }, 10);
            break;

            case 2:
                $('#' + this.id).effect("bounce", { direction:"up", distance:12, times: 2 }, 10);
            break;
            
            case 3:
                $('#' + this.id).effect("bounce", { direction:"down", distance:12, times: 3 }, 10);
            break;

            case 4:
                $('#' + this.id).effect("shake", { direction:"left", distance:12, times: 2 }, 10);
            break;

            case 5:
                $('#' + this.id).effect("shake", { direction:"right", distance:12, times: 2 }, 10);
            break;
            
            case 6:
                $('#' + this.id).effect("shake", { direction:"up", distance:12, times: 3 }, 10);
            break;

            case 7:
                $('#' + this.id).effect("shake", { direction:"down", distance:12, times: 2 }, 10);
            break;

            case 8:
                $('#' + this.id).effect("pulsate", { times: 1 }, 100);
            break;
            
            case 9:
                $('#' + this.id).effect("pulsate", { times: 1 }, 100);
            break;
        }
        
        //$('#' + this.id).css("left",this.x);
        //$('#' + this.id).css("top",this.y);
    };

};

