$(document).ready(function() {
	$.get('/index.php?page=placeholder-for-blog-features&rand=' + new Date().getTime(), 
	function(data){
		$('div#blog-features').html(data);

		modal_links = $('div#blog-features a.modal');
		for (var i = 0; i < modal_links.length; i++) {
			var pof = modal_links[i];
			var code = pof['href'];

			if (pof['title'].length > 0) {
				var title = pof['title'];
			} else {
				var title = '<img src="/images/modal-header-logo.png" />';
			}

			$(pof).qtip({
				content: {
					title: {
						text: title,
						button: '<img onclick="return false;" src="/images/modal-header-close.gif" style="padding-top: 5px;" alt="Close" />'
					},
					url: code
				},
				position: {
					target: $(document.body),
					corner: 'center'
				},
				show: {
					when: 'click',
					solo: true,
					effect: {
						type: 'fade',
						length: 0
					}
				},
				hide: false,
				style: {
					border: {
						width: 8,
						radius: 6,
						color: '#729317'
					},
					background: '#fffdf6',
					color: '#000',
					padding: 0,
					width: 800
				},
				api: {
					beforeShow: function () {
						$('#qtip-blanket').fadeIn(this.options.show.effect.length);
					},
					beforeHide: function () {
						$('#qtip-blanket').fadeOut(this.options.hide.effect.length);
					}
				}
			});
		}

		$('div#blog-features a.modal').click(function () {
			return false;
		});

		$('div#blog-features a.modal').removeAttr('title');

	});
});
