// javascript function that converts the following blogger archive template
// output to a more compact listing.

// <script type="text/javascript">
// var archives = new Array();
// <BloggerArchives>archives[archives.length] = new Array('<$BlogArchiveURL$>', '<$BlogArchiveName$>');</BloggerArchives>
// reorder_archives(archives);
// </script>
// <noscript><BloggerArchives><a href='<$BlogArchiveURL$>'><$BlogArchiveName$></a>  &nbsp;</BloggerArchives></noscript>


function monthchunks(archives)
{
	// initialize variables
	var year_links = new Array();
	var month;
	var year;

	year_index = 0;
	year_links[0] = "";

	// loop through each archive month
	for (var i = 0; i < archives.length; i++)
	{
		if (archives[i][1].charAt(0) != "0")
		{
			month = archives[i][1].charAt(0) + archives[i][1].charAt(1);
		}
		else
		{
			month = archives[i][1].charAt(1);
		}		
		
		year = "<strong>20" + archives[i][1].charAt(3) + archives[i][1].charAt(4) + "</strong><br />";	

		// print out year
		if (i == 0)
		{
			year_links[year_index] += year;
		}
		else if(archives[i][1].charAt(4) != archives[i-1][1].charAt(4))
		{
			year_index++;
			year_links[year_index] = "";
			year_links[year_index] += year;
		}
		
		year_links[year_index] += '<a href=\"' + archives[i][0] + '\">' + month + '</a> '
	}

	year_links.reverse();

	for (var i = 0; i < year_links.length; i++)
	{
		document.write("<div class='sidebar-content-item'>");
		document.write(year_links[i] + "<BR>");
		document.write("</div>");
	}
}