function isScrollBottom() { 
	var documentHeight = $(document).height();
	var scrollPosition = $(window).height() + $(window).scrollTop();
	return (documentHeight == scrollPosition);
}

function get_reply(id)
{
	$.ajax({
		type: 'POST',
		url: 'ajax/get.php',
		data: {id: id, zone: $('input#zone').val()},
		cache: false,
		success: function(html) {
			var isScrollBototm = isScrollBottom();

			if ($('input#zone').val() == 'forum,,reply' || $('input#zone').val() == 'photo,,reply' || $('input#zone').val() == 'sing,,reply')
				$('div#new_share').append(html);
			else
				$('div#new_share').prepend(html);

			$('div#new_share div.forum_post').fadeIn('slow');

			if (isScrollBototm)
				$.scrollTo('#bottom');
		}
	});
}

function get_topic(id)
{
	$.ajax({
		type: 'POST',
		url: 'ajax/get.php',
		data: {id: id, zone: $('input#zone').val()},
		cache: false,
		success: function(html) {
			$('div#new_share').prepend(html);
			$('div#new_share div.forum_topic').fadeIn('slow');
		}
	});
}

function get_post(id)
{
	$.ajax({
		type: 'POST',
		url: 'ajax/get.php',
		data: {id: id, zone: $('input#zone').val()},
		cache: false,
		success: function(html) {
			$('div#new_share').prepend(html);
			$('div#new_share div.row').fadeIn('slow');
		}
	});
}

function get_message_reply(id)
{
	$.ajax({
		type: 'POST',
		url: 'ajax/get.php',
		data: {id: id, zone: $('input#zone').val()},
		cache: false,
		success: function(html) {
			var isScrollBototm = isScrollBottom();

			$('div.message_wrapper').append(html);
			$('div.message_wrapper div').fadeIn('slow');

			if (isScrollBototm)
				$.scrollTo('#bottom');
		}
	});
}

