var winTitle="Fotografía Ampliada";
// Description you want in the title bar.

var imgWinOn = false;

function showImg(titFoto, path, x, y, imageName, imgWidth, imgHeight)
{
  var scWidth=0; var scHeight=0;
  if (imgWidth>screen.availWidth) { 
    scWidth = screen.availWidth; 
  } else { 
    scWidth= imgWidth; 
  }
  if (imgHeight+34>screen.availHeight-17) { 
    scHeight = screen.availHeight-17; 
  } else { 
    scHeight = imgHeight+34; 
  }

  var winName = imageName.substring(0,imageName.length-4);

  imgWin=window.open('', winName, 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,width=' + scWidth +',height=' + scHeight+',left=' + x +',top=' + y+', screenX=0,screenY=0');

  imgWin.document.write('<HTML><HEAD><TITLE> ' + winTitle +' </TITLE></HEAD><BODY marginheight=0 topmargin=0 leftmargin=0 marginwidth=0>');
  imgWin.document.write('<SCRIPT language="Javascript">imagePos = location.search.indexOf("img=");imageName=location.search.substring(imagePos+4,location.search.length);</SCR');
  imgWin.document.write('IPT><p><img src="' + path + imageName + '"><div align=center><img src="'+ path + titFoto +'" ></div></p></BODY></HTML>');
  imgWin.document.close();

  return false;
}

function showImgSinPie(titulo, path, x, y, imageName, imgWidth, imgHeight)
{
  var scWidth=0; var scHeight=0;
  if (imgWidth>screen.availWidth) { 
    scWidth = screen.availWidth; 
  } else { 
    scWidth= imgWidth; 
  }
  if (imgHeight>screen.availHeight) { 
    scHeight = screen.availHeight; 
  } else { 
    scHeight = imgHeight; 
  }

  var winName = imageName.substring(0,imageName.length-4);

  imgWin=window.open('', winName, 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,width=' + scWidth +',height=' + scHeight+',left=' + x +',top=' + y+', screenX=0,screenY=0');

  imgWin.document.write('<HTML><HEAD><TITLE> ' + titulo +' </TITLE></HEAD><BODY marginheight=0 topmargin=0 leftmargin=0 marginwidth=0>');
  imgWin.document.write('<SCRIPT language="Javascript">imagePos = location.search.indexOf("img=");imageName=location.search.substring(imagePos+4,location.search.length);</SCR');
  imgWin.document.write('IPT><p><img src="' + path + imageName + '"></p></BODY></HTML>');
  imgWin.document.close();

  return false;
}

function showImgSinPieAmpliable(titulo, path, x, y, imageName, imageNameAmp, imgWidth, imgHeight)
{
  var scWidth=0; var scHeight=0;
  if (imgWidth>screen.availWidth) { 
    scWidth = screen.availWidth; 
  } else { 
    scWidth= imgWidth; 
  }
  if (imgHeight>screen.availHeight) { 
    scHeight = screen.availHeight; 
  } else { 
    scHeight = imgHeight; 
  }

  var winName = imageName.substring(0,imageName.length-4);

  imgWin=window.open('', winName, 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,width=' + scWidth +',height=' + scHeight+',left=' + x +',top=' + y+', screenX=0,screenY=0');

  imgWin.document.write('<HTML><HEAD><TITLE> ' + titulo +' </TITLE></HEAD><BODY bgcolor=#000000 marginheight=0 topmargin=0 leftmargin=0 marginwidth=0>');
  imgWin.document.write('<SCRIPT language="Javascript">imagePos = location.search.indexOf("img=");imageName=location.search.substring(imagePos+4,location.search.length);</SCR');
  imgWin.document.write('IPT><a href="'+path+imageNameAmp+'"><img src="' + path + imageName + ' " border="0"></a></BODY></HTML>');
  imgWin.document.close();

  return false;
}

function showImgSinPieConScroll(titulo, path, x, y, imageName, imgWidth, imgHeight)
{
  var scWidth=0; var scHeight=0;
  if (imgWidth>screen.availWidth) { 
    scWidth = screen.availWidth; 
  } else { 
    scWidth= imgWidth; 
  }
  if (imgHeight>screen.availHeight) { 
    scHeight = screen.availHeight; 
  } else { 
    scHeight = imgHeight; 
  }

  var winName = imageName.substring(0,imageName.length-4);

  imgWin=window.open('', winName, 'toolbar=no,location=no,directories=no,status=yes,menubar=no,scrollbars=yes,resizable=no,width=' + scWidth +',height=' + scHeight+',left=' + x +',top=' + y+', screenX=0,screenY=0');

  imgWin.document.write('<HTML><HEAD><TITLE> ' + titulo +' </TITLE></HEAD><BODY marginheight=0 topmargin=0 leftmargin=0 marginwidth=0>');
  imgWin.document.write('<SCRIPT language="Javascript">imagePos = location.search.indexOf("img=");imageName=location.search.substring(imagePos+4,location.search.length);</SCR');
  imgWin.document.write('IPT><p><img src="' + path + imageName + '"></p></BODY></HTML>');
  imgWin.document.close();

  return false;
}

function showImgImprimir(titulo, linkImprimir, titFoto, path, x, y, imageName, imgWidth, imgHeight)
{
  var scWidth=0; var scHeight=0;
  if (imgWidth>screen.availWidth) { 
    scWidth = screen.availWidth; 
  } else { 
    scWidth= imgWidth; 
  }
  if (imgHeight+20>screen.availHeight-10) { 
    scHeight = screen.availHeight-10; 
  } else { 
    scHeight = imgHeight+20; 
  }

  var winName = imageName.substring(0,imageName.length-4);
  winTitle = titulo;

  imgWin=window.open('', winName, 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no,width=' + scWidth +',height=' + scHeight+',left=' + x +',top=' + y+', screenX=0,screenY=0');

  imgWin.document.write('<HTML><HEAD><TITLE> ' + winTitle +'</TITLE></HEAD><BODY marginheight=0 topmargin=0 leftmargin=0 marginwidth=0 link="#FFFFFF" vlink="#FFFFFF" alink="#FFFFFF">');
  imgWin.document.write('<SCRIPT language="Javascript">imagePos = location.search.indexOf("img=");imageName=location.search.substring(imagePos+4,location.search.length);</SCR');
  imgWin.document.write('IPT><p><img src="' + path + imageName + '"><div align=left><a href="' + path + linkImprimir + '"><img src="imagenes/'+ titFoto +'"></a></div></p></BODY></HTML>');
  imgWin.document.close();

  return false;
}


