var WinOpen;

function cl() {
  close();
}

function show(img_src, img_width, img_height) {
 	height = parseInt(img_height) + 30;
 	width = parseInt(img_width) + 30;
    if(WinOpen != null){
     	  WinOpen.close();
          WinOpen  =  window.open("", "Foto", "closed=yes, toolbar=no, location=no, top=20, left=20, directories=no, status=no, menubar=no, scrollbars=yes, resizable=no, width="+width+", height="+height+"");
    }else{
          WinOpen  =  window.open("", "Foto", "closed=yes, toolbar=no, location=no, top=20, left=20, directories=no, status=no, menubar=no, scrollbars=yes, resizable=no, width="+width+", height="+height+"");
}
    if(WinOpen != null){
          WinOpen  =  window.open("", "Foto", "closed=yes, toolbar=no, location=no, top=20, left=20, directories=no, status=no, menubar=no, scrollbars=yes, resizable=no, width="+width+", height="+height+"");
          WinOpen.document.write("<html><head><title></title>");
          WinOpen.document.write("<SCRIPT language=javascript>function cl() { close(); }</SCRIPT></head>");
          WinOpen.document.write("<body style='padding:0; margin:0;'><table width='100%' height='100%'><tr><td align='center' style='vertical-align:middle;'><img src="+img_src+" style='cursor:pointer;' alt=\"Закрыть\" onClick=\"cl()\";></td></tr></table></body></html>");
    }
 return WinOpen;
}

function show_big(img_src, img_width, img_height) {
 	height = parseInt(img_height) + 30;
 	width = parseInt(img_width) + 30;
    if(WinOpen != null){
     	  WinOpen.close();
          WinOpen  =  window.open("", "Foto", "closed=yes, toolbar=no, location=no, top=20, left=20, directories=no, status=no, menubar=no, scrollbars=yes, resizable=no, width="+width+", height=720");
    }else{
          WinOpen  =  window.open("", "Foto", "closed=yes, toolbar=no, location=no, top=20, left=20, directories=no, status=no, menubar=no, scrollbars=yes, resizable=no, width="+width+", height=720");
}
    if(WinOpen != null){
          WinOpen  =  window.open("", "Foto", "closed=yes, toolbar=no, location=no, top=20, left=20, directories=no, status=no, menubar=no, scrollbars=yes, resizable=no, width="+width+", height=720");
          WinOpen.document.write("<html><head><title></title>");
          WinOpen.document.write("<SCRIPT language=javascript>function cl() { close(); }</SCRIPT></head>");
          WinOpen.document.write("<body style='padding:0; margin:0;'><table width='100%' height='100%'><tr><td align='center' style='vertical-align:middle;'><img src="+img_src+" style='cursor:pointer;' alt=\"Закрыть\" onClick=\"cl()\";></td></tr></table></body></html>");
    }
 return WinOpen;
}

startList = function() {
 if (document.getElementById) {
   navRoot = document.getElementById("nav");
   visptr = document.getElementById("ptr");
   for (i=0; i<navRoot.childNodes.length; i++) {
     node = navRoot.childNodes[i];
     if (node.nodeName=="LI" && node.className!="chap") {
       node.onmouseover=function() {
         if (document.all) { this.className+=" over"; }
         if (this.childNodes.length>2 && this.childNodes[2].nodeName=="UL") {
           visptr.style.top=this.offsetTop+this.offsetHeight+160+'px';
           visptr.style.height=this.childNodes[2].offsetHeight-this.offsetHeight+'px';
           visptr.style.display='block';
         }
       }
       node.onmouseout=function() {
         visptr.style.display='none';
         if (document.all) { this.className=this.className.replace(" over",""); }
       }
     }
   }
 }
}
window.onload=startList;
