$(document).ready(function(){
	var style = "h7";	// hardcode for now
	var intervalID=0;
	var lastCmtID=0;
	var thisCmtID=1;
	function getComments(firstrun) {
		$.get('/comments.xml',function(xml) {
			thisCmtID=$("lastBuildDate",xml).text();
			if($("item",xml).size() > 0 && lastCmtID != thisCmtID) {
				lastCmtID = thisCmtID;
				var outstr = "";
				$("item",xml).each(function(i) {
					// output wrapper div
					outstr += '<div class="hs-comment-container">';
					// output link
					outstr += '<div class="hs-comment-link"><a href="' +
							  $("link",this).text() +
							  '">' +
							  $("title",this).text() +
							  '</a></div>';
					// output description
					var body = $("description",this).text();
					outstr += '<div class="hs-comment-text">' +
							  body +
							  '</div>';
					outstr += '</div>';
				});
				//alert(outstr);
				if(!firstrun) $("div.helpsquadinner").fadeOut(100);
				$("div.helpsquadinner").html(outstr);
				$("div.helpsquadinner").find('div.spoiler').spoil();
				if(!firstrun) $("div.helpsquadinner").fadeIn("normal");
				//alert($("div.helpsquadinner").html());
			} //else alert("this: "+thisCmtID+"\nlast: "+lastCmtID);
		}); // get
	}
	getComments(true);
	intervalID = window.setInterval(getComments,30000,false);
});
