$(document).ready( function() {
	var hints = ['Краткий просмотр', 'Гружу...'];

	$('.tip_post')
		.html(hints[0])
		.css({ display: '', color: '#888888', cursor: 'pointer', borderBottomWidth: '1px', borderBottomStyle: 'dotted', borderColor: '#888888' })
		.attr('title', 'Подглядеть текст поста...');
	
	var elem = $('.tip_post');
	
	elem.each(function(i)
	{
		var e = $(this);
	
		$(this).qtip(
		{
			content:
			{
				text: '<p>' + hints[1] + '</p>',
				method: 'get',
				url: '/ajax/post.php',
				data: {	id: $(this).attr('path') }
			},
			api:
			{
				onRender: function() { e.css('border-bottom', 'none').html(hints[1]); },
				onContentLoad: function() {	e.css({borderBottomWidth: '1px', borderBottomStyle: 'dotted', borderColor: '#888888'}).html(hints[0]); }
			},
			position:
			{
				corner: { target: 'topLeft' },
				type: 'static',
				container: $('#tip_post_'+$(this).attr('path'))
			},
			show:
			{
				when: { event: 'click' },
				effect:
				{
					type: 'slide',
					length: 500
				}
			},
			hide:
			{
				when: { event: 'click' },
				effect:
				{
					type: 'slide',
					length: 500
				}
			},
			style:
			{
				padding: '5px 15px',
				width: '100%',
				border:
				{
					width: 1,
					color: '#F2EED8'
				},
				background: '#FFFFFF',
				color: '#021E08'
			}
		});
	});
});
