+function update_thumbnails(){
+ if(T!="")
+ url2 = webbase+"/getjson.php?NP=1&T="+T+"&ID="+ID;
+ else
+ url2 = webbase+"/getjson.php?NP=1&ID="+ID;
+
+ var IDprev=-1;
+ var IDnext=-1;
+ var IDcurr=-1;
+ d3.json(url2, function(json2) {
+ /* figure out where the arrows on the pic should link to */
+ all=""
+ for (var i in json2){
+ if( IDcurr != ID )
+ {
+ IDprev = IDcurr;
+ IDcurr = IDnext;
+ IDnext = json2[i].id;
+ };
+ }
+
+ var thumbs= d3.select(".nextprev").select("ul").selectAll("li").data(json2, function(d) {return d.id;});
+
+ thumbs.enter().append("li")
+ .append("a")
+ .on("click", function(d) {
+ load_pic(d.id); }
+ )
+ .append("img")
+ .attr("src",function(d) {
+ s= d.base_uri+'/'+d.filename;
+ s = s.replace('file:\/\/<?php echo "".str_replace("/","\/",$dbprefix); ?>',webbase+'/Photos-tiny/');
+ return s;
+ })
+ .style("height","0")
+ .transition().duration(1000)
+ .style("height","100px");
+
+ thumbs.exit().select("img").transition().duration(1000).style("height","0");
+ thumbs.exit().transition().duration(1050).remove();
+
+ /* resort elements */
+ d3.select(".nextprev").select("ul").selectAll("li").sort(function(a,b){return a.id-b.id;});
+ d3.select(".nextprev").select("ul").selectAll("li").select("a").select("img").classed("current",false);
+ d3.select(".nextprev").select("ul").selectAll("li").select("a").select("img").classed("current",function(d){return (d.id==IDcurr);});
+
+
+ /* add links for left/right arrows */
+ if (IDprev != -1 )
+ d3.select(".left").on("click", function() { load_pic(IDprev); });
+ if (IDnext != -1 )
+ d3.select(".right").on("click", function() { load_pic(IDnext); });
+
+ });
+}
+