$.fn.photoborder = function()
{
	var head = "<div align='left' style='float:left;'><table border='0' style='display:inline;line-height:1%;font-size:1%;padding:0px;margin:0px;' cellpadding='0' cellspacing='0' width='1'><tr><td style='height:1'><img src='/images/PhotoBorder/topLeft.jpg'></td><td style='height:1' background='/images/PhotoBorder/topBG.jpg' align='right'><img src='/images/PhotoBorder/topMiddle.jpg'></td><td style='height:1'><img src='/images/PhotoBorder/topRight.jpg'></td></tr><tr><td style='height:1;' background='/images/PhotoBorder/leftBG.jpg' valign='top'><img src='/images/PhotoBorder/leftMiddle.jpg'></td><td style='height:1;'class='content'>";
	var tail = "</td><td style='height:1;' valign='bottom' background='/images/PhotoBorder/rightBG.jpg'><img src='/images/PhotoBorder/rightMiddle.jpg'></td></tr><tr><td style='height:1;'><img src='/images/PhotoBorder/botLeft.jpg'></td><td  style='height:1;' background='/images/PhotoBorder/botBG.jpg' align='left'><img src='/images/PhotoBorder/botMiddle.jpg'></td><td style='height:1;'><img src='/images/PhotoBorder/botRight.jpg'></td></tr></table></div>";
	
	jQuery("img.PhotoEffect").each(function() { 
								var anchor = "<span></span>";
								if ( $(this).parent("a").length > 0 )
								{
									anchor = $(this).parent("a").clone(false);								
								}
								
								$(this).before(head + tail).prev().find('td.content').append( this ).find("img").wrap( anchor );					
							});	
}
