$(document).ready(function() {
	$("table.striped tr:odd").each(function() { $(this).addClass("even"); });
	$("div.itemdrilldown ul.images li").each(function() {
		// Clear every 4 images
		var i = $("div.itemdrilldown ul.images li").index($(this));
		if (i > 1 && i % 4 == 1) $(this).addClass("clear");

		// NS Bug - Remove any images that do not have a value
		var anchor = $(this).find("a:first");
		if (anchor.attr("href") == "") anchor.remove();
		else $(this).show();

		//centerImagesInContainer($(this));
	});
	/*
	$(".listing .listingimage").each(function() {
		centerImagesInContainer($(this));	
	});
	*/
});
/*
function centerImagesInContainer(target) {
	// Position image in the center of container
	var img = target.find("img:first");
	var imgW = img.width();
	var imgH = img.height();
	var cW = target.width();
	var cH = target.height();
	if (imgW < cW) img.css("margin-left", (cW - imgW)/2 + "px");
	if (imgH < cH) img.css("margin-top", (cH - imgH)/2 + "px");
	img.show();
}
*/