jQuery(function(){
	// Fancybox support
	jQuery.fn.getTitle = function() {
		var arr = jQuery("a.fancybox");
		jQuery.each(arr, function() {
			var title = jQuery(this).children("img").attr("title");
			jQuery(this).attr('title',title);
		})
	}
	//Add class to links containing an image
	jQuery(".postentry a:has(img)").addClass("imagelink");
	
	// Supported file extensions
	var thumbnails = '#content a:has(img)[href$=".bmp"],#content a:has(img)[href$=".gif"],#content a:has(img)[href$=".jpg"],#content a:has(img)[href$=".jpeg"],#content a:has(img)[href$=".png"],#content a:has(img)[href$=".BMP"],#content a:has(img)[href$=".GIF"],#content a:has(img)[href$=".JPG"],#content a:has(img)[href$=".JPEG"],#content a:has(img)[href$=".PNG"]';
	jQuery(thumbnails).addClass("fancybox").attr("rel","fancybox").getTitle();
		jQuery("a.fancybox").fancybox({
		'imageScale': false,
		'speedIn': 1000,
		'speedOut': 500
	});
})
