
function toggleLayer(_w,_h) {

   var isIE=document.all?true:false;
   var isDOM=document.getElementById?true:false;
   var isNS4=document.layers?true:false;

  if (isDOM)
  {
    if (_h=='s') { document.getElementById(_w).style.display = 'block'; document.getElementById(_w).style.visibility='visible'; }
    if (_h=='h') { document.getElementById(_w).style.display = 'none'; document.getElementById(_w).style.visibility='hidden'; }
  }
  else if (isIE) {
    if (_h=='s') { eval("document.all."+_w+".style.display='block';"); eval("document.all."+_w+".style.visibility='visible';"); }
    if (_h=='h') { eval("document.all."+_w+".style.display='none';"); eval("document.all."+_w+".style.visibility='hidden';"); }
  }
  else if(isNS4)
  {
    if (_h=='s') { eval("document.layers['"+_w+"'].display='block';"); eval("document.layers['"+_w+"'].visibility='show';"); }
    if (_h=='h') { eval("document.layers['"+_w+"'].display='none';"); eval("document.layers['"+_w+"'].visibility='hide';"); }
  }
}

function OpenWin(targ,name,wt,ht) {

   var win=window.open(targ,name,"toolbar=0,width=" + wt + ",height=" + ht + ",directories=0,status=1,scrollbars=1,resizable=1,menubar=0");
   win.focus();

   }

function OpenImg(path,id) {

 if (path=='') return;

 var win = open('',id,'toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=no,resizable=yes,width=300,height=200');

 win.document.write("<html> \n");
 win.document.write("<head><title>Imagem Ampliada</title> \n");
 win.document.write("<style> \n");
 win.document.write("body{margin:0px;} \n");
 win.document.write("</style> \n");
 win.document.write("<script language=\"JavaScript\"> \n");
 win.document.write("var isNN,isIE; \n");
 win.document.write("if (parseInt(navigator.appVersion.charAt(0))>=4){ \n");
 win.document.write("isNN=(navigator.appName==\"Netscape\")?1:0; \n");
 win.document.write("isIE=(navigator.appName.indexOf(\"Microsoft\")!=-1)?1:0;} \n");
 win.document.write("function reSizeToImage() { \n");
 win.document.write("   if (isIE){ \n");
 win.document.write("      window.resizeTo(300,200); \n");
 win.document.write("      width=300-(document.body.clientWidth-document.images[0].width); \n");
 win.document.write("      height=186-(document.body.clientHeight-document.images[0].height); \n");
 win.document.write("      window.resizeTo(width,height); \n");
 win.document.write("	  } \n");
 win.document.write("   if (isNN){ \n");
 win.document.write("      window.innerWidth=document.images[\"id"+id+"\"].width; \n");
 win.document.write("      window.innerHeight=document.images[\"id"+id+"\"].height;} \n");
 win.document.write("	  } \n");
 win.document.write("</script> \n");
 win.document.write("</head> \n");
 win.document.write("<body onload='reSizeToImage();'> \n");
 win.document.write("<img name=\"id"+id+"\" src=\""+path+"\" alt=\"Imagem ampliada\"> \n");
 win.document.write("</body> \n");
 win.document.write("</html> \n");

 win.document.close();
 win.focus();

 }

