$(document).ready(function () {
	var col = 1;
	var count = albumName.length-1;
	var HTML = "";
	var imgurl = "";

    HTML += "<center><table cellspacing=\"5\"><tr>";
    
    while (count > (-1))
	{
		imgurl = "albums/" + albumFolder[count] + "/" + albumFolder[count] + albumFront[count] + "s.jpg";
		HTML += "<td class=\"galleryBox\">";

		HTML += "<table><tr><td class=\"galleryBoxTitle\"><a href=\""+ albumLink[count] +".htm\">"+ albumName[count] +"</a></td></tr>";
		
		HTML += "<tr><td class=\"galleryBoxPhoto\"><a href=\""+ albumLink[count] +".htm\"><img src=\""+ imgurl +"\"</a></td></tr>";
		
		HTML += "<tr><td class=\"galleryBoxSpacer\"></td></tr></table>";
		
		HTML += "</td>";
		col++;
		count--;
		if (col > 4)
		{
			col = 1;
			HTML += "</tr></table><table cellspacing=\"5\"><tr>";
		}
	}
	
	HTML += "</tr></table></center>";
	
	$("#galleryContainer").append(HTML);
	
	$(".galleryBox").click(function () { 
		window.location = $(this).children("table").children("tbody").children("tr").children("td").children("a").attr("href");
    });
    
    
    $(".galleryBox").hover(
      function () {
        $(this).addClass("galleryBoxHover");
      }, 
      function () {
        $(this).removeClass("galleryBoxHover");

      }
    );

	
	
	
});








