explain why alert-boxes appear
[phpfspot.git] / phpfspot.js
index ad4a63e088bdc12ee06f5227a0ac8dc329cb9625..a2c848e5715bf5faf254eb39ceeab348d869c39c 100644 (file)
@@ -29,11 +29,21 @@ function moveToThumb(thumb_id)
       return;
 
    if(thumbimg = document.getElementById('thumbimg' + thumb_id)) {
       return;
 
    if(thumbimg = document.getElementById('thumbimg' + thumb_id)) {
-      window.scrollTo(0, thumbimg.offsetTop-100);
+      window.scrollTo(0, findPos(thumbimg)-100);
    }
 
 } // moveToThumb()
 
    }
 
 } // moveToThumb()
 
+function findPos(obj) {
+   var curtop = 0;
+   if (obj.offsetParent) {
+      do {
+         curtop += obj.offsetTop;
+      } while (obj = obj.offsetParent);
+   }
+   return [curtop];
+}
+
 function showCredits()
 {
    var credits = document.getElementById("content");
 function showCredits()
 {
    var credits = document.getElementById("content");
@@ -67,7 +77,7 @@ function Tags(mode, id)
       refreshPhotoIndex();
    }
    else {
       refreshPhotoIndex();
    }
    else {
-      window.alert(retr);
+      window.alert("Server message: "+ retr);
    }
 
 } // Tags()
    }
 
 } // Tags()
@@ -167,7 +177,7 @@ function startSearch()
       showPhotoIndex();
    }
    else {
       showPhotoIndex();
    }
    else {
-      window.alert(retr);
+      window.alert("Server message: "+ retr);
    }
 
 } // startSearch()
    }
 
 } // startSearch()
@@ -524,7 +534,7 @@ function update_sort_order(obj)
       showPhotoIndex();
    }
    else {
       showPhotoIndex();
    }
    else {
-      window.alert(retr);
+      window.alert("Server message: "+ retr);
    }
 
 } // update_sort_order()
    }
 
 } // update_sort_order()