function OpenImg(path,id) {

 if (path=='') return;

 var win = open('',id,'toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=yes,resizable=yes,width=100,height=100');

 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(100,100); \n");
 win.document.write("      width=250-(document.body.clientWidth-document.images[0].width); \n");
 win.document.write("      height=105-(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=\"\" />\n");
 win.document.write("</body> \n");
 win.document.write("</html> \n");

 win.document.close();
 win.focus();

 }

function OpenWin(url,id, w, h) {

 if (url=='') return;
 if (w===undefined) w='870';
 if (h===undefined) h='680';

 var win = open(url,id,'toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=yes,resizable=yes,width='+w+',height='+h);
 //win.focus();

 }

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 SimpleSwap(el,which){
  el.src=el.getAttribute(which || "origsrc");
}

function SimpleSwapSetup(){
  var x = document.getElementsByTagName("img");
  for (var i=0;i<x.length;i++){
    var oversrc = x[i].getAttribute("oversrc");
    if (!oversrc) continue;
      
    // preload image
    // comment the next two lines to disable image pre-loading
    x[i].oversrc_img = new Image();
    x[i].oversrc_img.src=oversrc;
    // set event handlers
    x[i].onmouseover = new Function("SimpleSwap(this,'oversrc');");
    x[i].onmouseout = new Function("SimpleSwap(this);");
    // save original src
    x[i].setAttribute("origsrc",x[i].src);
  }
}

var PreSimpleSwapOnload =(window.onload)? window.onload : function(){};
window.onload = function(){PreSimpleSwapOnload(); SimpleSwapSetup();}