var ciudad = ciudades.split("|");
var haytabla = false;
var ciudadmostrada = "";

function muestratabla(nombreciudad)
{
	if (ciudadmostrada == nombreciudad) return;
	var indice = -1;
	var x = 0;
	for (x = 0; x < ciudad.length; x++) // busca la posición dentro del arreglo de la ciudad
		{
		if ( ciudad[x] == nombreciudad) indice = x;
		}
	if (indice<0) // la ciudad no fue encontrada o ya se esta viendo
		{ return; }


	var label = "";
	label += "<!DOCTYPE HTML PUBLIC '-//W3C//DTD HTML 4.01 Transitional//EN' 'http://www.w3.org/TR/html4/loose.dtd'>";
	label += "<html><head><meta http-equiv='Content-Type' content='text/html; charset=iso-8859-1'><title>Informe del tiempo</title>";
	label += "<!--[if gte IE 5.5000]>";
	label += "<script type=\"text/javascript\" src=\"http://www.123.cl/noticia_scroll/tiempo123/png.js\"></script>";
	label += "<![endif]-->";
	label += "<link href='http://homeweb.entelchile.net/home_img/internet/123_cl/img/canales/eltiempo/tiempo_styles.css' rel='stylesheet' type='text/css'>";
	label += "</head>";

        var icono = iconos[ciudad[indice]].split("|");
        var pronostico = pronosticos[ciudad[indice]].split("|");
        var tempnx = temperaturas[ciudad[indice]].split("|");
        var fecha = fechas[ciudad[indice]].split("|");
        var x = 0;
        var total = icono.length;

	var pathimagentiempo = "http://homeweb.entelchile.net/home_img/internet/123_cl/img/canales/eltiempo/";
	//icono[0].replace(/gif/,"png")

	var temppre = tempnx[0].split("/");
	var tempresumen;

	if ( temppre[0] != "" )
		tempresumen = temppre[0] +"&ordm;/";
	else
		tempresumen = "";

	label += "<body onload='PNG_loader()'><table width='285' border='0' cellspacing='0' cellpadding='0'><tr>";
	label += "<td height='53' align='center' valign='middle' background='http://homeweb.entelchile.net/home_img/internet/123_cl/img/canales/eltiempo/headpng8.png'><table width='285' height='45' border='0' cellpadding='0' cellspacing='0'>";
	label += "<tr><td width='5'>&nbsp;</td><td class='titulos'>" + ciudad[indice].replace(/&apos;/, "'") + "</td><td align='right' class='titulos'>";
	label += "<table width='10%' border='0' align='right'><tr><td valign='top'><img src='"+ pathimagentiempo + icono[0] +"' width='45' height='45'></td><td valign='top' align='center'><font color='#ffffff' face='arial, helvetica' size='4'><b>HOY<br>"+ tempresumen + temppre[1] +"&ordm;</b></td></tr></table></td><td width='14' class='titulos'>&nbsp;</td>";
	label += "</tr></table></td></tr>";
 
                // encabezados de dias (primer bloque)

		label += "<tr><td height='15' align='center' valign='middle' background='http://homeweb.entelchile.net/home_img/internet/123_cl/img/canales/eltiempo/2.png'><table width='285' border='0' cellspacing='0' cellpadding='0'>";
		label += "      <tr><td width='10'>&nbsp;</td>";
		label += "	    <td width='86' align='center' valign='middle' class='dias'>";

		// primer dia
                numerotmp = x;
                if (numerotmp < icono.length)
			label += fecha[numerotmp] +"</td>";
		else
			label += "&nbsp;</td>";
		// segundo dia
                label += "          <td width='86' align='center' valign='middle' class='dias'>";
                numerotmp = x+1;
                if (numerotmp < icono.length)
                        label += fecha[numerotmp] +"</td>";
                else
                        label += "&nbsp;</td>";
		// tercer dia
                label += "          <td width='86' align='center' valign='middle' class='dias'>";
                numerotmp = x+2;
                if (numerotmp < icono.length)
                        label += fecha[numerotmp] +"</td>";
                else
                        label += "&nbsp;</td>";

		label += "        <td width='17'>&nbsp;</td>";
		label += "      </tr></table></td></tr>";
		
		// fin encabezados de dias


                // IMAGENES CLIMAS BLOQUE 1
                label += "  <tr><td height='50' align='center' valign='top' background='http://homeweb.entelchile.net/home_img/internet/123_cl/img/canales/eltiempo/9.png'>";
                label += "  <table width='285' height='50' border='0' cellpadding='0' cellspacing='0'><tr><td>&nbsp;</td>";
                label += "  <td colspan='2' align='center' valign='middle' class='dias'>";

                // primer dia
                imagentmp = x;

		// comentar lo siguiente (solo se usa para pruebas)
	        //icono[imagentmp] = "solparcialnieve.gif";
                if (imagentmp > icono.length || icono[imagentmp] == 'vacio.gif' )
                        label +=  "&nbsp;</td>";
                else
                        label += "<img src='"+ pathimagentiempo + icono[imagentmp]+"' width='45' height='45'></td>";

                // segundo dia
                label += "  <td colspan='2' align='center' valign='middle' class='dias'>";
                imagentmp = x +1;

                // comentar lo siguiente (solo se usa para pruebas)
                //icono[imagentmp] = "vientonube.gif";

                if (imagentmp > icono.length || icono[imagentmp] == 'vacio.gif' )
                        label +=  "&nbsp;</td>";
                else
                        label += "<img src='"+ pathimagentiempo + icono[imagentmp] +"' width='45' height='45'></td>";

                // tercer dia
                label += "  <td colspan='2' align='center' valign='middle' class='dias'>";
                imagentmp = x +2;
                if (imagentmp > icono.length || icono[imagentmp] == 'vacio.gif' )
                        label +=  "&nbsp;</td>";
                else
                        label+="<img src='"+pathimagentiempo+icono[imagentmp]+"' width='45' height='45'></td>";

                label += "  <td>&nbsp;</td></tr>";

		// FIN BLOQUE CLIMAS 1


		// inicio bloque temperaturas 1

                label += "<tr><td width='10' height='19'>&nbsp;</td>";

		// temp dia 1
		var temp = tempnx[x].split("/");
		label += "<td width='43' height='19' align='center' valign='middle' class='datos'>";
		if ( temp[0] != '' ) {
			label +=  temp[0] +"&ordm;</td>";
		}
		label += "</td><td width='43' height='19' align='center' valign='middle' class='datos'>";
                if ( temp[1] != '' ) {
                        label +=  temp[1] +"&ordm;</td>";
		}
		label += "</td>";

                // temp dia 2
                temp = tempnx[x +1].split("/");
                label += "<td width='43' height='19' align='center' valign='middle' class='datos'>";
                if ( temp[0] != '' ) {
                        label +=  temp[0] +"&ordm;</td>";
                }
                label += "</td><td width='43' height='19' align='center' valign='middle' class='datos'>";
                if ( temp[1] != '' ) {
                        label +=  temp[1] +"&ordm;</td>";
                }
                label += "</td>";

                // temp dia 3
                temp = tempnx[x +2].split("/");
                label += "<td width='43' height='19' align='center' valign='middle' class='datos'>";
                if ( temp[0] != '' ) {
                        label +=  temp[0] +"&ordm;</td>";
                }
                label += "</td><td width='43' height='19' align='center' valign='middle' class='datos'>";
                if ( temp[1] != '' ) {
                        label +=  temp[1] +"&ordm;</td>";
                }
                label += "</td>";

		label += "<td width='17' height='19'>&nbsp;</td></tr></table></td></tr>";
		// FIN BLOQUE TEMPERATURAS

                // encabezados de dias (segundo bloque)

                label += "<tr><td height='15' align='center' valign='middle' background='http://homeweb.entelchile.net/home_img/internet/123_cl/img/canales/eltiempo/2.png'><table width='285' border='0' cellspacing='0' cellpadding='0'>";
                label += "      <tr><td width='10'>&nbsp;</td>";
                label += "          <td width='86' align='center' valign='middle' class='dias'>";

                // primer dia
                numerotmp = x +3;
                if (numerotmp < icono.length)
                        label += fecha[numerotmp] +"</td>";
                else
                        label += "&nbsp;</td>";
                // segundo dia
                label += "          <td width='86' align='center' valign='middle' class='dias'>";
                numerotmp = x+4;
                if (numerotmp < icono.length)
                        label += fecha[numerotmp] +"</td>";
                else
                        label += "&nbsp;</td>";
                // tercer dia
                label += "          <td width='86' align='center' valign='middle' class='dias'>";
                numerotmp = x+5;
                if (numerotmp < icono.length)
                        label += fecha[numerotmp] +"</td>";
                else
                        label += "&nbsp;</td>";

                label += "        <td width='17'>&nbsp;</td>";
                label += "      </tr></table></td></tr>";

                // fin encabezados de dias



                // IMAGENES CLIMAS BLOQUE 2
                label += "  <tr><td height='50' align='center' valign='top' background='http://homeweb.entelchile.net/home_img/internet/123_cl/img/canales/eltiempo/9.png'>";
                label += "  <table width='285' height='50' border='0' cellpadding='0' cellspacing='0'><tr><td>&nbsp;</td>";
                label += "  <td colspan='2' align='center' valign='middle' class='dias'>";

                // primer dia
                imagentmp = x +3;
                if (imagentmp > icono.length || icono[imagentmp] == 'vacio.gif' )
                        label += "&nbsp;</td>";
                else
                        label+="<img src='"+pathimagentiempo+icono[imagentmp]+"' width='45' height='45'></td>";

                // segundo dia
                label += "  <td colspan='2' align='center' valign='middle' class='dias'>";
                imagentmp = x +4;
                if (imagentmp > icono.length || icono[imagentmp] == 'vacio.gif' )
                        label += "&nbsp;</td>";
                else
                        label+="<img src='"+pathimagentiempo+icono[imagentmp]+"' width='45' height='45'></td>";

                // tercer dia
                label += "  <td colspan='2' align='center' valign='middle' class='dias'>";
                imagentmp = x +5;
                if (imagentmp >= icono.length || icono[imagentmp] == 'vacio.gif' )
                        label += "&nbsp;</td>";
                else
                        label+="<img src='"+pathimagentiempo+icono[imagentmp]+"' width='45' height='45'></td>";


                label += "  <td>&nbsp;</td></tr>";

                // FIN BLOQUE CLIMAS 2


                // inicio bloque temperaturas 2

                label += "<tr>";
		label += "<td width='10' height='19'>&nbsp;</td>";

                // temp dia 1
		numerotmp = x+3;
		label += "<td width='43' height='19' align='center' valign='middle' class='datos'>";
                if (numerotmp < icono.length) {
                	temp = tempnx[x +3].split("/");
                	if ( temp[0] != '' ) {
                        	label +=  temp[0] +"&ordm;";
                	}
		} else {
			label += "&nbsp;";
			temp[0] = "";
                        temp[1] = "";
		}

                label += "</td><td width='43' height='19' align='center' valign='middle' class='datos'>";
                if ( temp[1] != '' ) {
                        label +=  temp[1] +"&ordm;</td>";
                }
                label += "</td>";

                // temp dia 2
                numerotmp = x+4;
                label += "<td width='43' height='19' align='center' valign='middle' class='datos'>";
                if (numerotmp < icono.length) {
                        temp = tempnx[x +3].split("/");
                        if ( temp[0] != '' ) {
                                label +=  temp[0] +"&ordm;";
                        }
                } else {
                        label += "&nbsp;";
                        temp[0] = "";
                        temp[1] = "";
                }

                label += "</td><td width='43' height='19' align='center' valign='middle' class='datos'>";
                if ( temp[1] != '' ) {
                        label +=  temp[1] +"&ordm;</td>";
                }
                label += "</td>";

                // temp dia 3
                numerotmp = x+5;
                label += "<td width='43' height='19' align='center' valign='middle' class='datos'>";
                if (numerotmp < icono.length) {
                        temp = tempnx[x +3].split("/");
                        if ( temp[0] != '' ) {
                                label +=  temp[0] +"&ordm;";
                        }
                } else {
                        label += "&nbsp;";
                        temp[0] = "";
                        temp[1] = "";
                }

                label += "</td><td width='43' height='19' align='center' valign='middle' class='datos'>";
                if ( temp[1] != '' ) {
                        label +=  temp[1] +"&ordm;</td>";
                }
                label += "</td>";

                label += "<td width='17' height='19'>&nbsp;</td></tr></table></td></tr>";
                // FIN BLOQUE TEMPERATURAS























		label += "<tr><td height='16' background='http://homeweb.entelchile.net/home_img/internet/123_cl/img/canales/eltiempo/8.png'></td></tr></table></body></html>";


	haytabla = true;
	ciudadmostrada = nombreciudad;
	return overlib(label,VAUTO,HAUTO,WIDTH,250,BACKGROUND, 'http://homeweb.entelchile.net/home_img/internet/123_cl/img/portal/2003/pix_transparent.gif', FGCOLOR, '',BGBACKGROUND,'http://homeweb.entelchile.net/home_img/internet/123_cl/img/portal/2003/pix_transparent.gif', BGCOLOR,'');
}

function no_mostrar()
{
 nd();
 haytabla = false;
 ciudadmostrada = "";
}

function poneicono(nombreDiv,posleft,postop,nombreciudad)
{
var indice = -1;
var x = 0;
for (x = 0; x < ciudad.length; x++)
	{
	if ( ciudad[x] == nombreciudad) indice = x;
	}
if (indice<0) return;
var icono = iconos[nombreciudad].split("|");
var myDiv = '<div id="'+nombreDiv+'" style="position:absolute; left: '+posleft+'; top: '+postop+'; visibility:visible; z-index:'+((indice+1)*10)+';">\n';
myDiv += '<img src="http://homeweb.entelchile.net/home_img/internet/123_cl/img/canales/eltiempo/png32/'+icono[0].replace(/gif/,"png")+'" border=0 alt="" onmouseover="javascript:muestratabla(\''+nombreciudad+'\');">\n';
myDiv += '</div>';
document.write(myDiv);
}


