var img_fondo = 'imagenes/ip_fnd_color_fondo_popups.gif';


function openWindow(imagen, title, w, h) {
	var userAgent = navigator.userAgent;
	
	openWindowNotIE(imagen, title, w, h);
}


function openWindowNotIE(imagen, title, w, h) { //v2.0
  var h2 = h + 50;

  var features = 'width=' + w + ',height=' + h2 + ',resizable=no';

  var win = window.open('about:blank','_blank', features);

  win.moveTo((screen.availWidth - w) / 2, (screen.availHeight - h2) / 2);

  var doc = win.document;

  doc.open("text/html", "replace");

  doc.writeln('<html>');
  doc.writeln('<head>');
  doc.writeln('<title>' + title + '</title>');
  doc.writeln('</head>');
  doc.writeln('<body background="' + img_fondo + '" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">');
  doc.writeln('<table width="' + w + '" height="' + h2 + '" border="0" cellpadding="0" cellspacing="0">');
  doc.writeln('<tr>');
  doc.writeln('<td>');
  doc.writeln('<table width="' + w + '" height="' + h + '" border="0" cellpadding="0" cellspacing="0">');
  doc.writeln('<tr>');
  doc.writeln('<td align="center"><img src="' + imagen + '" /></td>');
  doc.writeln('</tr>');
  doc.writeln('</table>');
  doc.writeln('</td>');
  doc.writeln('</tr>');
  doc.writeln('<tr>');
  doc.writeln('<td>');
  doc.writeln('<table width="' + w + '" height="50" border="0" cellpadding="0" cellspacing="0">');
  doc.writeln('<tr>');
  doc.writeln('<td align="center"><div id=btDiv><img src="imagenes/sr_btn_imprimir_reposo.gif" onclick="btDiv.style.display = \'none\';window.print();btDiv.style.display = \'block\'" onmouseover="this.style.cursor=\'hand\'; this.src=\'imagenes/sr_btn_imprimir_sobre.gif\'" onmouseout="this.src=\'imagenes/sr_btn_imprimir_reposo.gif\'"/>&nbsp;&nbsp;&nbsp;<img src="imagenes/sr_btn_cerrar_reposo.gif" onclick="window.close()" onmouseover="this.style.cursor=\'hand\'; this.src=\'imagenes/sr_btn_cerrar_sobre.gif\'" onmouseout="this.src=\'imagenes/sr_btn_cerrar_reposo.gif\'"/></div></td>');
  doc.writeln('</tr>');
  doc.writeln('</table>');
  doc.writeln('</td>');
  doc.writeln('</tr>');
  doc.writeln('</table>');
  doc.writeln('</body>');
  doc.writeln('</html>');

  doc.close();
}

function openWindowIE(imagen, w, h) {

	var iFrame = parent.document.body.children['iFrameWindow']; 
	
	if (iFrame != null) {
		parent.document.body.removeChild(iFrame);
	}

	var h2 = h + 50;

	var iFrame = document.createElement("iframe");

	iFrame.style.position="absolute";
	iFrame.id="iFrameWindow";
	iFrame.style.border = '0.1cm groove red';
	iFrame.style.posTop = ((screen.availHeight - h2) / 2) - window.screenTop;
	iFrame.style.posLeft = ((screen.availWidth - w) / 2)  - window.screenLeft;
	iFrame.style.posWidth = w + 4;
	iFrame.style.posHeight = h2 + 4;

	document.body.appendChild(iFrame);
	
	iFrame.contentWindow.document.open('text/html', 'replace');
	
	iFrame.contentWindow.document.write('<body background="' + img_fondo + '" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0"><table width="' + w + '" height="' + h2 + '" border="0" cellpadding="0" cellspacing="0"><tr><td><table width="' + w + '" height="' + h + '" border="0" cellpadding="0" cellspacing="0"><tr><td align="center"><img src="' + imagen + '" /></td></tr></table></td></tr><tr><td><table width="' + w + '" height="50" border="0" cellpadding="0" cellspacing="0"><tr><td align="center"><div id="btDiv"><img src="imagenes/sr_btn_imprimir_reposo.gif" onclick="btDiv.style.display = \'none\';window.print();btDiv.style.display = \'block\'" />&nbsp;&nbsp;&nbsp;<img src="imagenes/sr_btn_cerrar_reposo.gif" onclick="var iFrame = parent.document.body.children[\'iFrameWindow\']; parent.document.body.removeChild(iFrame);" /></div></td></tr></table></td></tr></table></body>');

	iFrame.contentWindow.document.close();

}


