/* Get my blog posts from about life and put them in my own website thank you very much. 
   Requires prototype.js */
function getBlog(){
	// Do an ajax request to get my blog home page
	var blogAjax = new Ajax.Request(
		"feed.xml",
		{
			method: 'get',
			onComplete: showBlog
		});
}

// Called when the blog from about life has been retrieved
function showBlog(request){
	if(request.responseXML){
		var docHolder = $("blogHolder");
		var root = request.responseXML.documentElement;
		var entries = root.getElementsByTagName("item");
		for(var i = 0; i < entries.length; i++){
			// build the entries
			
			// Make the title that is also a link
			var link = document.createElement("A");
			link.href = entries[i].getElementsByTagName("link")[0].firstChild.nodeValue;
			link.innerHTML = entries[i].getElementsByTagName("title")[0].firstChild.nodeValue;
			var title = document.createElement("H2");
			title.appendChild(link);
			title.className = "entryTitle";
			
			// Get the text for the teaser
			var teaser = document.createElement("P");
			teaser.innerHTML = entries[i].getElementsByTagName("description")[0].firstChild.nodeValue;
			teaser.className = "blogEntry";
			
			var post = document.createElement("DIV");
			post.className = "blogNode"
			post.appendChild(title);
			post.appendChild(teaser);
			docHolder.appendChild(post);
			
		}
	}
}
 
