function AbrirVentana() {
//Función de imprimir si no deseamos que una pagina use esta función, solo nos basta no definir
// objetoimprimir, en otro caso definimos objetoimprimir y titulo imprimir con un id dentro de un td
// esta función esta hecha tanto para IE y N
var texto1 =document.getElementById("objetoimprimir");
var titulo1=document.getElementById("tituloimprimir");



if ((texto1==null)&&(titulo1==null)) { 
	alert("Utilice el icono que trae el navegador por defecto para imprimir."); 
}
else {
	texto=texto1.innerHTML;
	titulo=titulo1.innerHTML;	
	Ventana=open("","Imprime","toolbar=no,scrollbars=yes,directories=no,menubar=no,status=no,width=620,height=480,resizable=no");
	
	Ventana.document.write("<HTML><HEAD><TITLE>MálagaenFlamenco - Página de impresión</TITLE>");
	Ventana.document.write("<link rel='stylesheet' type='text/css' href='dibujos/malagaenflamenco_imprimir.css'>");	
	Ventana.document.write("<script>");	
	Ventana.document.write("var ns = false; ");
	Ventana.document.write("var ie = false; ");
	Ventana.document.write("if (navigator.appName=='Netscape') ");			
	Ventana.document.write("{ ");
	Ventana.document.write("	ns = true; ");
	Ventana.document.write("} ");
	Ventana.document.write("if (navigator.appName=='Microsoft Internet Explorer') ");
	Ventana.document.write("{ ");	
	Ventana.document.write("ie = true; ");
	Ventana.document.write("} ");	
	Ventana.document.write("</script> ");
	
	
	Ventana.document.write("<script>");	
	Ventana.document.write("function abreimagen(imagen) ");
	Ventana.document.write("{ ");
	Ventana.document.write("var cad1, cad2, img, pos1, pos2 ;");						
	Ventana.document.write("var ruta= imagen.src; ");
	Ventana.document.write("pos1=ruta.lastIndexOf('.',ruta.lenght); ");
	Ventana.document.write("pos2=ruta.lastIndexOf('/',ruta.lenght); ");		
	Ventana.document.write("cad1= ruta.substring(0,pos1); ");
	Ventana.document.write("cad2= ruta.substring(pos1, ruta.length); ");	
	Ventana.document.write("img=ruta.substring(pos2+1, ruta.length); ");		
	Ventana.document.write("ruta=cad1+'_g'+cad2; ");		
	Ventana.document.write("ampliar=abre_url('ampliar.asp?ima='+ruta+'&com='+img, 40, 30, 100, 100); ");
	Ventana.document.write("}");	
	Ventana.document.write("function abre_url(url, ancho, alto, leftPos, topPos) ");
	Ventana.document.write("{ ");
	Ventana.document.write("var w = 800, h = 600; ");
	Ventana.document.write("if (document.all || document.layers) ");
	Ventana.document.write("{ ");
	Ventana.document.write(" w = screen.availWidth; ");
	Ventana.document.write(" h = screen.availHeight; ");
	Ventana.document.write("} ");
	Ventana.document.write("if (leftPos==undefined) leftPos = (w-ancho)/2; ");
	Ventana.document.write("if (topPos==undefined) topPos = (h-alto)/2; ");
	Ventana.document.write("return window.open(url,null,'directories=no,location=no,menubar=no,status=no,titlebar=no,toolbar=no,resizable=no,width='+ancho+',height='+alto + ',top=' + topPos + ',left=' + leftPos); ");
    Ventana.document.write("} ");
	Ventana.document.write("</script> ");	
	
	
	Ventana.document.write("<script Language='Javascript'> ");
	
	Ventana.document.write("function MM_findObj(n, d) { ");
	Ventana.document.write("var p,i,x;  if(!d) d=document; if((p=n.indexOf('?'))>0&&parent.frames.length) { ");
	Ventana.document.write("d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);} ");
	Ventana.document.write("if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n]; ");
	Ventana.document.write(" for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document); return x; ");
	Ventana.document.write("} ");
	
	Ventana.document.write("function MM_swapImage() { ");
	Ventana.document.write("var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3) ");
	Ventana.document.write("if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];} ");
	Ventana.document.write("}" );
	
	Ventana.document.write("function MM_swapImgRestore() { ");
	Ventana.document.write(" var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc; ");
	Ventana.document.write("} ");
	
	Ventana.document.write("function MM_preloadImages() { ");
	Ventana.document.write("var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array(); ");
	Ventana.document.write("var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++) ");
	Ventana.document.write("if (a[i].indexOf('#')!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}} ");
	Ventana.document.write("} ");
	
	Ventana.document.write("function MM_displayStatusMsg(msgStr) {  ")
    Ventana.document.write("status=msgStr; ")
    Ventana.document.write("document.MM_returnValue = true; ")
    Ventana.document.write("} ")
    Ventana.document.write("function MM_openBrWindow(theURL,winName,features) {  ")
    Ventana.document.write("window.open(theURL,winName,features); ")
    Ventana.document.write("} ")

	Ventana.document.write("</script >");	
	Ventana.document.write("</HEAD>");
	
	Ventana.document.write("<body topmargin='5' leftmargin='5' marginheight='5' marginwidth='5' rightmargin='5' bottommargin='5'>");
	Ventana.document.write("<table cellpadding='4' cellspacing='0' border='0'  width='100%'>");
	Ventana.document.write("<tr>");
	Ventana.document.write("<td align='right' bgcolor='#000000'>");
	impresora="<a href='JavaScript:window.print();'><img  style='cursor:hand;cursor:pointer' onmouseout='MM_swapImgRestore();return true' onmouseover='MM_swapImage("
	impresora=impresora+'"i_imprimir","","dibujos/impresora_1.gif"'
	impresora=impresora+",1);return true' name='i_imprimir' border='0' alt='Imprimir' src='dibujos/impresora.gif'></a>";
	Ventana.document.write(impresora);
	Ventana.document.write("<a href='JavaScript:cerrar_ventana()'>");
	cerrar="<img style='cursor:hand;cursor:pointer'onmouseout='MM_swapImgRestore();return true' onmouseover='MM_swapImage("
	cerrar=cerrar+'"cerrar","","dibujos/cerrar_1.gif"'
	cerrar=cerrar+",1);return true' onclick='javascript:window.close();' name='cerrar' border='0' alt='Cerrar' src='dibujos/cerrar.gif'>";
	Ventana.document.write("</a>");
	Ventana.document.write(cerrar);
	Ventana.document.write("</td></tr>");
	
	Ventana.document.write("<tr>");
	Ventana.document.write("<td bgcolor='#7B8086'>");
	Ventana.document.write(titulo);
	Ventana.document.write("</td>");
	Ventana.document.write("</tr>");
	
	Ventana.document.write("<tr><td valign='top'>");
	Ventana.document.write(texto);
	Ventana.document.write("</td>");
	Ventana.document.write("</tr>");
	Ventana.document.write("</table>");
	
	Ventana.document.write("</BODY>");
	Ventana.document.write("</HTML>");
	Ventana.document.close();
	}
}

