$(document).ready(function() {
	// Image captions						   
	$('#content img[title]').each(function() {
		var el = $(this);								  
		el
			.attr("tooltip", el.attr("title"))
			.removeAttr("title")
			// .after('<img class="tooltip_presence" src="/media/images/general/tooltip_presence_red.png" />')
		 	.qtip({										
				content: {
					text: el.attr("tooltip") 
				},
				position: {
					corner: 'bottomMiddle',
					adjust: {
						// x: 25,
						y: -50,
						screen: true
					}
				},
				show: {
					solo: true,
					delay: 70,
					effect: {
						length: 0	
					}
				},
				hide: {
					fixed: true
				},
				style: {
					name: 'red',
				  color: '#ffffff',
				  background: '#D1234B',
				  border: {
					  color: '#D1234B',
					  width: 1,
					  radius: 3
				  },
				  'text-align': 'center',
				  classes: { 
					tooltip: 'caption'
				  },
				  width: {
					  min: 300,
					  max: el.width()-50
				  }
				  // width: el.width()-50
				},
				api: {
					/*beforeShow: function() {
						el.next(".tooltip_presence").hide();
					},
					onHide: function() {
						el.next(".tooltip_presence").show();
					}*/
				}
			})
			.parent().css("position", "relative");
	});
	// Read more rollover effects
	$("a.readon").hover(
		function() {
			$(this).children("img").attr("src", "/media/images/general/read_more_red_over.jpg"); 
		},
		function() {
			$(this).children("img").attr("src", "/media/images/general/read_more_red.jpg");
		}
	);
});

