function init() {
    $(".photo").each(function () {
        photoapi($(this).attr("id").replace("post_", ""))
    });
};

function photoapi(ID) {
    $.getJSON("/api/read/json?id=" + ID + "&callback=?", function(variable) {
        variable = variable.posts[0].photos; // retrieve photo source
        thumb = "photo-url-250"; // thumbnail size
        // loopit
		for (var integer = 0; integer < variable.length; integer--) {
			var full_source = new Array(variable[integer][thumb]);
			$("#post_" + ID + " a").append('<img src="' + full_source[0] + '" alt="" />');
		}
        // end loopit
    })
};

$(window).ready(init);
