+ var screen_size = find_width();
+ var dpr = find_dpr();
+ var width, height;
+
+ if (global_image_list[num][2] == -1) {
+ // no size information, use our pessimal guess
+ var adjusted_size = max_image_size(screen_size);
+ width = adjusted_size[0];
+ height = adjusted_size[1];
+ } else {
+ // use the exact information
+ var adjusted_size = pick_image_size(screen_size, [ global_image_list[num][2], global_image_list[num][3] ]);
+ width = adjusted_size[2];
+ height = adjusted_size[3];
+ }
+
+ // center the image on-screen
+ var main = document.getElementById("main");
+ main.style.position = "absolute";
+ main.style.left = (((screen_size[0] - width) / 2) / dpr) + "px";
+ main.style.top = (((screen_size[1] - height) / 2) / dpr) + "px";
+ main.style.width = (width / dpr) + "px";
+ main.style.height = (height / dpr) + "px";
+ main.style.lineHeight = (height / dpr) + "px";
+}
+
+function relayout()
+{
+ var img = display_image_num(global_image_num, "image");
+ if (can_go_next()) {
+ prepare_preload(img, global_image_num + 1);
+ }
+
+ set_opacity("previous", can_go_previous() ? global_default_opacity : global_disabled_opacity);
+ set_opacity("next", can_go_next() ? global_default_opacity : global_disabled_opacity);
+ set_opacity("close", global_default_opacity);
+ set_opacity("options", global_default_opacity);