
 function light_on(targetId)
 {
   var targetElement;
       targetElement = document.getElementById(targetId);

      targetElement.style.display="";
 }

 function light_off(targetId)
 {
   var targetElement;
       targetElement = document.getElementById(targetId);

      targetElement.style.display="none";
 }

function show_pic(dir,name)
{

  scroll_body=document.body.scrollTop;

  if(scroll_body<230)
  {
   popup("/show_pic.php3?dir="+dir+"&pic="+name,200,200,226-scroll_body,15);
  }
  else
  {
   popup("/show_pic.php3?dir="+dir+"&pic="+name,200,200,25,15);
  }

}

function popup(url, width, height, top, left) {

        iframe = document.getElementById('FM~popupIFRAME');
        div = document.getElementById('FM~popupDIV');
        iframeDIV = document.getElementById('FM~iframeDIV');
        iframeDIV.innerHTML = '<iframe height="100%" width="100%" name=popframe id="FM~popupIFRAME" frameborder="0" style="width:'+width+'px;height:'+height+'px" src="'+url+'" style="display:none;background-color:white;" onload="this.style.display=\'block\'"></iframe>';
        iframeDIV.style.width=width;
        iframeDIV.style.height=height;
        div.style.width=width;
        div.style.height=height;
        div.style.left=-(-left-findScrollLeft());
        div.style.top=-(-top-findScrollTop());

        div.style.display='block';
        div.style.visibility='visible';

}

function closePopup() {
        div = document.getElementById('FM~popupDIV');
        iframeDIV = document.getElementById('FM~iframeDIV');
        div.style.display='none';
        iframeDIV.innerHTML = "";
}


 function normalize_size()
 {
  height = frames['FM~popupIFRAME'].document.body.scrollHeight;

  //if(height>500)
  //{
  // height=500;
  //}

  width = frames['FM~popupIFRAME'].document.body.scrollWidth;
  iframe = document.getElementById('FM~popupIFRAME');

  iframe.style.height=height;
  iframe.style.width=width;

 }

 function resize_preview_to_width(width)
 {
//  height = frames['FM~popupIFRAME'].document.body.scrollHeight;
//  width = frames['FM~popupIFRAME'].document.body.scrollWidth;
  iframe = document.getElementById('FM~popupIFRAME');
//  iframe.style.height=200;
  iframe.style.width=width;
 }


 function resize_preview_to_height(height)
 {
  iframe = document.getElementById('FM~popupIFRAME');
  iframe.style.height=height;
 }

 function popup_loaded()
 {
  iframe = gId('FM~popupIFRAME');
  iframe.style.display='block';
  iframe.style.visibility='visible';
 }

 function loading()
 {
  iframe = document.getElementById('FM~popupIFRAME');
  iframe.style.visibility='hidden';
  resize_preview_to_width(100);
  resize_preview_to_height(100);
 }

 function set_popup_title(title)
 {
  iframe_title = gId('popupTitle');
  iframe_title.innerHTML = title;
 }

