﻿/* Webfusion Front End Logic */

Blog = {};

(function($) {

	$.extend(Blog, {
		// Set this to the initial number of entries on the page
		numEntries: 5,
		// Set this to the number of entries added per page
		entriesPerPage: 5,

		morePosts: function() {
			var self = this;
			$.call({
				url: "/WebServices/Low/FusionWebService.asmx/Invoke",
				data: { entity: "BlogEntry", method: "PresentNextPage", parameters:
					{
						month: 0,
						year: 0,
						skip: self.numEntries
					}
				},
				success: function(xhr) {
					if (!xhr.d || !xhr.d.More) {
						$("#morePostsMarker").hide();
					}
					if (xhr.d) {
						$("<div>" + xhr.d.Content + "</div>").hide().insertBefore("#morePostsMarker").slideDown('slow');
					}
					self.numEntries += self.entriesPerPage;
				}
			});
		}

	});

})(jQuery);