+function next_pic() {
+}
+
+function load_pic(myid) {
+ ID=myid;
+ update_page_index();
+ update_thumbnails();
+ load_content();
+}
+
+function tagcloud() {
+
+ url = webbase+"/getjson.php?CLOUD=1";
+
+ pics.selectAll("li").remove();
+
+ var svgelement=pics.append("li")
+ .append("svg").attr("width",400).attr("height",400);
+
+ /* update pics */
+ d3.json(url, function(json) {
+ svgelement.selectAll("text").data(json).enter().append("text")
+ .style("font-size", function(d){return (Math.log(d.count+1)/2.0)+"em"})
+ .text(function(d) { return d.name+" "; })
+ .on("mouseover", function(d){ d3.select(this).style("color","red")} )
+ .on("mouseout", function(d){ d3.select(this).style("color","white")} )
+ .on("click", function(d) { document.location.href=webbase+'/tag/'+d.name })
+ });
+}
+
+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); });
+
+ });
+}
+
+function checkbutton()
+{