// Apertura de ventanas auxiliares
var newWindow = null;
var mapa = null;
var ancho = 150;
var alto = 150;
var titulo = "";
var l = 0;
var t = 0;
var fondo = '000000';
var bg = null;
var barras = 0;
var boton = 0;
var tipo = 1;
var linea = "_____________________________________________________________________________________________________________________________________"
var visible = false;
	
function Wurl(URL,ancho,alto,titulo,x,y,barras) {

	var l = (screen.width-ancho)/x;
	var t = (screen.height-alto)/y;
	window.open(URL, titulo+linea, 'height='+ alto +', width='+ ancho +',left='+ l +',top='+ t +',toolbar=0,location=0,directories=0,status=0,menuBar=0,fullscreen=0,scrollBars=' + barras + ',resizable=0');

}

// Ventana de Flash
function Wflash(flash,ancho,alto,titulo,x,y,fondo,bg) {
	var l = (screen.width-ancho)/x;
	var t = (screen.height-alto)/y;
	newWindow = window.open("", titulo, 'height='+ alto +', width='+ ancho +',left='+ l +',top='+ t +',toolbar=0,location=0,directories=0,status=0,menuBar=0,scrollBars=0,resizable=0'); 
	if (newWindow != null) {
	var newContent = "<!DOCTYPE HTML PUBLIC '-//W3C//DTD HTML 4.0 Transitional//EN'><HTML><HEAD><TITLE>" + titulo + linea +"</TITLE></HEAD>";
	newContent += "<BODY bgcolor='#"+ fondo +"' marginheight='0' marginwidth='0' topmargin='0' leftmargin='0' background='" + bg + "' style='border: 0px solid #000000; overflow: hidden; margin: 0pt;'>";
	newContent += "<object classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0'";
	newContent += "width=" + ancho + " height=" + alto +" id=" + titulo + ">";
	newContent += "<PARAM name='movie' value='"+ flash +"'>";
	newContent += "<PARAM name='quality' value='high'>:";
	newContent += "<PARAM name='wmode' value='transparent'>";
	newContent += "<PARAM name='loop' value='false'>";
	newContent += "<PARAM name='bgcolor' value='" + fondo + "'>";
	newContent += "<embed name='" + titulo + "' src='"+ flash +"' width=" + ancho +" height="+ alto +" autostart='true' quality='high bgcolor=#" + fondo + "' hidden='False' wmode='transparent' type='application/x-shockwave-flash' pluginspage='http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash'></EMBED></object>";
	newContent += "</BODY></HTML>";
	newWindow.document.write( newContent );
	newWindow.document.close()
	}
}

// Ventana Grafico
function Wgrafico(grafico,ancho,alto,titulo,x,y,fondo,bg,boton) {
	var l = (screen.width-ancho)/x;
	var t = (screen.height-alto)/y;
	if(boton==0){
	newWindow = window.open("", titulo, 'height='+ (alto+0) +', width='+ ancho +',left='+ l +',top='+ t +',toolbar=0,location=0,directories=0,status=0,menuBar=0,scrollBars=0,resizable=0');
	}else{
	newWindow = window.open("", titulo, 'height='+ (alto+50) +', width='+ ancho +',left='+ l +',top='+ t +',toolbar=0,location=0,directories=0,status=0,menuBar=0,scrollBars=0,resizable=0');
	}
	if (newWindow != null) {
	var newContent = "<!DOCTYPE HTML PUBLIC '-//W3C//DTD HTML 4.0 Transitional//EN'><HTML><HEAD><TITLE>" + titulo + linea + "</TITLE></HEAD>";
	newContent += "<BODY bgcolor='#"+ fondo +"' marginheight='0' marginwidth='0' topmargin='0' leftmargin='0' background='" + bg + "' style='border: 0px solid #000000; overflow: hidden; margin: 0pt;'>";
	newContent += "<IMG SRC=" + grafico +" width=" + ancho +" height=" + alto + "vspace=0 hspace=0>";
	if(boton==1){
		newContent += "<CENTER><FORM><input type='button' value='Cerrar' width=" + ancho + " onClick='self.close()'></FORM></CENTER>";
	}
	newContent += "</BODY></HTML>";
	newWindow.document.write( newContent );
	newWindow.document.close()
	}
}

// Ventana Video
function Wvideo(tipo,video,ancho,alto,titulo,x,y,fondo,bg,visible) {
	var l = (screen.width-ancho)/x;
	var t = (screen.height-alto)/y;
	newWindow = window.open("", titulo, 'height='+ (alto+0) +', width='+ ancho +',left='+ l +',top='+ t +',toolbar=0,location=0,directories=0,status=0,menuBar=0,scrollBars=0,resizable=0');
	if (newWindow != null) {
	var newContent = "<!DOCTYPE HTML PUBLIC '-//W3C//DTD HTML 4.0 Transitional//EN'><HTML><HEAD><TITLE>" + titulo + linea +"</TITLE></HEAD>";
	newContent += "<BODY bgcolor='#"+ fondo +"' marginheight='0' marginwidth='0' topmargin='0' leftmargin='0' background='"+bg+"' style='border: 0px solid #000000; overflow: hidden; margin: 0pt;'>";
	if (tipo==1){
		newContent += "<img border='0' dynsrc='" + video + "' width='" + ancho + "' height='" + alto + "' loop='infinite' start='fileopen' hspace='0' vspace='0' alt='" + titulo +"' controls>'";
	}else{
		newContent += "<embed name='" + titulo + "' src='" + video + "' width='" + ancho + "' height='" + alto + "' hidden='" + visible + "' bgcolor='#" + fondo ;
		newContent += "' border='0' hspace='0' vspace='0' autostart='true' loop='True' wmode='transparent'>";
	}
	newContent += "</BODY></HTML>;"
	newWindow.document.write( newContent );
	newWindow.document.close()
	}
}

// Ventana Sonido
function Wsonido(sonido,ancho,alto,titulo,x,y,fondo,bg,visible) {
	var l = (screen.width-ancho)/x;
	var t = (screen.height-alto)/y;
	newWindow = window.open("", titulo, 'height='+ alto +', width='+ ancho +',left='+ l +',top='+ t +',toolbar=0,location=0,directories=0,status=0,menuBar=0,scrollBars=0,resizable=0'); 
	if (newWindow != null) {
	var newContent = "<!DOCTYPE HTML PUBLIC '-//W3C//DTD HTML 4.0 Transitional//EN'><HTML><HEAD><TITLE>" + titulo + linea + "</TITLE></HEAD>";
	newContent += "<BODY bgcolor='#"+ fondo +"' marginheight='0' marginwidth='0' topmargin='0' leftmargin='0' background='"+bg+"' style='border: 0px solid #000000; overflow: hidden; margin: 0pt;'>";
	newContent += '<embed border="1" src="' + sonido + '" width="' + ancho + '" height="' + alto + '" hidden="' + visible + '" hspace="0" vspace="0"  autostart="true" loop="True">';
	newContent += "</BODY></HTML>";
	newWindow.document.write( newContent );
	newWindow.document.close()
	}
}

// Ventana mapa
function Wmapa(grafico,ancho,alto,titulo,x,y,fondo,bg,boton) {
	var l = (screen.width-ancho)/x;
	var t = (screen.height-alto)/y;
	if(boton==0){
	newWindow = window.open("", titulo, 'height='+ (alto+0) +', width='+ ancho +',left='+ l +',top='+ t +',toolbar=0,location=0,directories=0,status=0,menuBar=0,scrollBars=0,resizable=0');
	}else{
	newWindow = window.open("", titulo, 'height='+ (alto+60) +', width='+ ancho +',left='+ l +',top='+ t +',toolbar=0,location=0,directories=0,status=0,menuBar=0,scrollBars=0,resizable=0');
	}
	if (newWindow != null) {
	var newContent = "<!DOCTYPE HTML PUBLIC '-//W3C//DTD HTML 4.0 Transitional//EN'><HTML><HEAD><TITLE>" + titulo + linea + "</TITLE></HEAD>";
	newContent += "<BODY bgcolor='#000000' marginheight='0' marginwidth='0' topmargin='0' leftmargin='0' style='border: 0px solid #000000; overflow: hidden; margin: 0pt;'>";
	newContent += "<CENTER><FORM><table background='" + bg + "' bgcolor='#"+ fondo +"' width=" + ancho +" height=" + alto + " border=0 cellpadding=0 cellspacing=0><tr><td colspan=2>";
	newContent += "<IMG SRC=" + grafico +" width=" + ancho +" height=" + alto + " vspace=0 hspace=0 border=0>";
	if(boton==1){
		newContent += "</td></tr><tr>"
		//newContent += "<input hspace=10 type='button' value=' Cerrar ' width=" + ancho + " onClick='self.close()' style='background-color: #ffffff; border: thin solid #000000;	border-bottom-width: 1px;	border-left-width: 1px;	border-right-width: 1px; border-top-width: 1px;	font-family: arial;	font-size: 8pt;	height: auto;	letter_spacing: normal;	line-height: normal; padding-left: 3px;'>";
		//newContent += "<input hspace=10 type='button' value=' Iprimir ' width=" + ancho + " onClick='window.print()' style='background-color: #ffffff; border: thin solid #000000;	border-bottom-width: 1px;	border-left-width: 1px;	border-right-width: 1px; border-top-width: 1px;	font-family: arial;	font-size: 8pt;	height: auto;	letter_spacing: normal;	line-height: normal; padding-left: 3px;'>";
		newContent += "<td bgcolor='#000000' align='center' valign='middle' height=60><a href='javascript:window.print();'><img src='../../graf/impresora.gif' alt=' Imprimir ' width=32 height=32 border=0 align='absmiddle' hspace=10></a></td>";
		newContent += "<td bgcolor='#000000' align='center' valign='middle'><a href='javascript:self.close();'><img src='../../graf/cerrar.gif' alt=' Cerrar ' width=32 height=31 border=0 align='absmiddle' hspace=10></a></td>";
		newContent += "</tr></table></FORM></CENTER>"
	}
	newContent += "</BODY></HTML>";
	newWindow.document.write( newContent );
	newWindow.document.close()
	}
}
// Ventana mapa localizacion
function WmapaP(grafico,ancho,alto,titulo,x,y,fondo,bg,boton,xx,yy) {
	var l = (screen.width-ancho)/x;
	var t = (screen.height-alto)/y;
	if(boton==0){
	newWindow = window.open("", titulo, 'height='+ (alto+0) +', width='+ ancho +',left='+ l +',top='+ t +',toolbar=0,location=0,directories=0,status=0,menuBar=0,scrollBars=0,resizable=0');
	}else{
	newWindow = window.open("", titulo, 'height='+ (alto+60) +', width='+ ancho +',left='+ l +',top='+ t +',toolbar=0,location=0,directories=0,status=0,menuBar=0,scrollBars=0,resizable=0');
	}
	if (newWindow != null) {
	var newContent = "<!DOCTYPE HTML PUBLIC '-//W3C//DTD HTML 4.0 Transitional//EN'><HTML><HEAD><TITLE>" + titulo + linea + "</TITLE></HEAD>";
	newContent += "<div style='position: absolute;  top:" + yy + "; left:" + xx + ";'><IMG SRC=" + grafico +" width=20 height=20 vspace=0 hspace=0 border=0></div>";
	newContent += "<BODY bgcolor='#000000' marginheight='0' marginwidth='0' topmargin='0' leftmargin='0' style='border: 0px solid #000000; overflow: hidden; margin: 0pt;'>";
	//newContent += "<CENTER><FORM><table background='" + bg + "' bgcolor='#"+ fondo +"' width=" + ancho +" height=" + alto + " border=0 cellpadding=0 cellspacing=0><tr><td colspan=2 height='340'>&nbsp;";
	newContent += "<CENTER><FORM><table bgcolor='#"+ fondo +"' width=" + ancho +" height=" + alto + " border=0 cellpadding=0 cellspacing=0><tr><td colspan=2 height='340'>&nbsp;";
	newContent += "<IMG SRC=" + bg +" width=" + ancho +" height=" + alto + " vspace=0 hspace=0 border=0>";
	if(boton==1){
		newContent += "</td></tr><tr>"
		newContent += "<td bgcolor='#000000' align='center' valign='middle' height=60><a href='javascript:window.print();'><img src='graf/impresora.gif' alt=' Imprimir ' width=32 height=32 border=0 align='absmiddle' hspace=10></a></td>";
		newContent += "<td bgcolor='#000000' align='center' valign='middle'><a href='javascript:self.close();'><img src='graf/cerrar.gif' alt=' Cerrar ' width=32 height=31 border=0 align='absmiddle' hspace=10></a></td>";
		newContent += "</tr></table></FORM></CENTER>"
	}
	newContent += "</BODY></HTML>";
	newWindow.document.write( newContent );
	newWindow.document.close()
	}
}