z++; shapes.push(r.rect(x, y, 95, 25, 20).attr({ fill: fcolor, stroke: scolor, "stroke-width": 2, cursor: "move" }).data("shape", z) .click(function () { alert(this.data("shape")); }));