/* picturize function -
	adds a border and shadow to images to
	make them look like photos
	element.pictures(borderSize, shadowSize, cornerRadius)

	Jason Yee
	November 16, 2009
*/
Raphael.el.picturize = function(b, s, c) {
	// setup attribute variables
	var i = this.attrs.src;
	var x = this.attrs.x;
	var y = this.attrs.y;
	var w = this.attrs.width;
	var h = this.attrs.height;

	// get the paper
	var paper = this.paper;

	// destroy the image (we're replacing the image with a set)
	this.remove();
	
	// create the set
	var pictureSet = paper.set();

	// setup shadow variables
	var sStart = .6;
	var sStep = sStart/s;

	// create shadow
	for(j=1; j<=s; j++) {
		pictureSet.push(paper.rect(x-b-j, y-b-j, w+((b+j)*2), h+((b+j)*2), c+j).attr({'stroke':'#000000', 'stroke-opacity':sStart-(sStep*j)}));
	}

	// create the picture border
	pictureSet.push(paper.rect(x-b, y-b, w+(b*2), h+(b*2), c).attr({'fill':'#FFFFFF', 'stroke':'#999999', 'stroke-opacity':1}));

	// create the image and add the click to bring the image to the front
	pictureSet.push(paper.image(i,x,y,w,h));

	// return the set
	return pictureSet;
};

