var cur_opacity = 0; var target_opacity = 0; var cur_img = 0; var cur_imgs; var total_imgs = 0; var spinner = "images/spinner.gif"; var pgallery_timer = setInterval("timer_pgallery()", 40); function close_pgallery(){ target_opacity = 0; } function open_pgallery(){ target_opacity = 100; } function swap_pgallery(title, imgs){ var pg_title = document.getElementById("pgallery_title"); pg_title.innerHTML = title; var pg_img = document.getElementById("pgallery_img"); pg_img.src = spinner; pg_img.src = imgs[0]; cur_img = 0; cur_imgs = imgs; total_imgs = imgs.length - 1; open_pgallery(); } function next_pgallery(){ cur_img++; if (cur_img > total_imgs){ cur_img = 0; } var pg_img = document.getElementById("pgallery_img"); pg_img.src = spinner; pg_img.src = cur_imgs[cur_img]; } function timer_pgallery(){ var pg_main = document.getElementById("pgallery"); if (cur_opacity < target_opacity){ cur_opacity += 5; } if (cur_opacity > target_opacity){ cur_opacity -= 5; } var css_opacity = cur_opacity; if (cur_opacity < 10){ css_opacity = "0" + cur_opacity; } if (cur_opacity == 0){ pg_main.style.cssText = "display:none;"; } else { if (cur_opacity == 100){ pg_main.style.cssText = "display:block;"; } else { pg_main.style.cssText = "display:block;-moz-opacity:0." + css_opacity + ";opacity:0." + css_opacity + ";filter:alpha(opacity=" + css_opacity + ")"; } } }