$(window).load(function(){
		$("img.rightcaption").each(function(i) { 
			var imgwidth = $(this).width(); 
			var thetext = $(this).attr("alt"); 
			$(this).wrap("<div class='captionborderright'></div>");	
			$(this).parent().width(imgwidth);     
				if ((thetext != null)&&(thetext != "")) 
				{$(this).parent().append("<p class='captiontext'>" + thetext + "</p>");}	 
			}); 
			$("img.leftcaption").each(function(i) { 
				var imgwidth = $(this).width(); 
				var thetext = $(this).attr("alt"); 
				$(this).wrap("<div class='captionborderleft'></div>");	 
				$(this).parent().width(imgwidth);  
				if ((thetext != null)&&(thetext != "")) 
				{$(this).parent().append("<p class='captiontext'>" + thetext + "</p>");}	 
		});  
			$("img.caption").each(function(i) { 
				var imgwidth = $(this).width(); 
				var thetext = $(this).attr("alt"); 
				$(this).wrap("<div class='captionborder'></div>");	 
				$(this).parent().width(imgwidth);  
				if ((thetext != null)&&(thetext != "")) 
				{$(this).parent().append("<p class='captiontext'>" + thetext + "</p>");}	 
		});  
	});

jQuery(function($) {
$("a[href$='.jpg'], a[href$='.jpeg'], a[href$='.gif'], a[href$='.png'], a[href$='.JPG'], a[href$='.JPEG'], a[href$='.GIF'], a[href$='.PNG']").attr( {rel: "lytebox[page]"});
});

