//var _obj_BannerNoticias = new BannerNoticias("td_bar_noticias"); 
var _xmlDomBannerNoticias	= null;
var _element_General_BNoticias = null;
var INDEX_BANNER = -1;
function BannerNoticias(_element)
{	
	_element_General_BNoticias = _element;
	this.CONST_DIRECTORY_IMAGES_BANNER_NOTICIAS	= "TV_Banner_Noticias/"
	this.CONST_PATH_IMAGES_BANNER_NOTICIAS		= CONST_PATH_IMAGES + this.CONST_DIRECTORY_IMAGES_BANNER_NOTICIAS;
	
	/**
	* Comentado por: Oscar Angeles (WIKOT)
	* Fecha: 14/04/2010
	*/
	//Inicio
	//_xmlDomBannerNoticias = new ELJS_XMLDOM.ELJS_XMLDOM_File("../../TV_CCIU/TV_Plantillas/PatternNoticias.xml", Method_BNoticias_Render);
	//_xmlDomBannerNoticias.Load();
	//Fin
}

function Method_BNoticias_EjecuteAleatorio()
{
	INDEX_BANNER++;
	if (INDEX_BANNER > 4)
		INDEX_BANNER = 0;

	if (ARRAY_BANERS_NOTICIAS.length == 5)
	{
		//alert(INDEX_BANNER);
		var _titulo = ARRAY_BANERS_NOTICIAS[INDEX_BANNER].getElementsByTagName("Titulo");
		var _src	= ARRAY_BANERS_NOTICIAS[INDEX_BANNER].getElementsByTagName("Imagen");
		var _text	= ARRAY_BANERS_NOTICIAS[INDEX_BANNER].getElementsByTagName("Contenido");
		document.getElementById("img_bnoticias_fondo").src = "../../TV_CCIU/TV_Imagenes/TV_Banner_Noticias/" + _src[0].childNodes[0].nodeValue;
//		document.getElementById("lbl_bnoticias_title").onclick = new Function("Method_Link_Page_Interior_Detalle_Noticia(" + (INDEX_BANNER + 1) + ")");
		//alert("Hola" + INDEX_BANNER);
		switch((INDEX_BANNER + 1))
		{
			case 1:
				document.getElementById("lbl_bnoticias_title").onclick = new Function("Method_Link_Page_Interior_Detalle_Noticia(301)");//112 98 95 113 119 121 127 135 138 146 153 160 171 179 181 188 189 195 196 202 213 229 237 240 250 253 263 270 277 278 285 292 293 299 300
				document.getElementById("img_bnoticias_fondo").onclick = new Function("Method_Link_Page_Interior_Detalle_Noticia(301)");
				break;
			case 2:
				document.getElementById("lbl_bnoticias_title").onclick = new Function("Method_Link_Page_Interior_Detalle_Noticia(300)");//106 99 85 114 120 119 128 136 139 147 154 153 172 171 182 181 188 189 195 197 202 230 229 239 240 250 264 263 276 279 286 285 292 293 299
				document.getElementById("img_bnoticias_fondo").onclick = new Function("Method_Link_Page_Interior_Detalle_Noticia(300)");
				break;
			case 3:
				document.getElementById("lbl_bnoticias_title").onclick = new Function("Method_Link_Page_Interior_Detalle_Noticia(299)");//98 100 86 112 113 120 129 137 140 138 146 154 173 172 179 181 188 189 195 197 213 230 237 239 240 253 264 270 277 278 286 285 292 293
				document.getElementById("img_bnoticias_fondo").onclick = new Function("Method_Link_Page_Interior_Detalle_Noticia(299)");
				break;
			case 4:
				document.getElementById("lbl_bnoticias_title").onclick = new Function("Method_Link_Page_Interior_Detalle_Noticia(293)");//99 96 87 106 114 113 121 127 135 139 147 146 160 173 171 182 181 188 189 195 202 213 229 237 239 250 253 263 264 276 279 278 286 292
				document.getElementById("img_bnoticias_fondo").onclick = new Function("Method_Link_Page_Interior_Detalle_Noticia(293)");
				break;
			case 5:
				document.getElementById("lbl_bnoticias_title").onclick = new Function("Method_Link_Page_Interior_Detalle_Noticia(292)");//100 97 88 98 112 114 119 128 136 140 138 147 153 160 172 179 182 181 188 189 197 202 230 229 237 240 250 253 270 277 279 285 286
				document.getElementById("img_bnoticias_fondo").onclick = new Function("Method_Link_Page_Interior_Detalle_Noticia(292)");
				break;
		}
		
		document.getElementById("lbl_bnoticias_title").innerHTML = _titulo[0].childNodes[0].nodeValue;
		document.getElementById("lbl_bnoticias_content").innerHTML = _text[0].childNodes[0].nodeValue;
	}
	else
	{
		alert("Formato de archivo incorrecto.")
	}
	//alert("Hola")
	setTimeout("Method_BNoticias_EjecuteAleatorio()", 8000);
}

function Method_BNoticias_Render()
{
	if (_xmlDomBannerNoticias != null)
	{
		var _object = document.getElementById(_element_General_BNoticias);
		var _renderHTML = "";
		_renderHTML +=	'<table width="592" height="260" border="0" align="center" cellpadding="0" cellspacing="0" style="font-size: 0pt;">';
		_renderHTML +=	'<tr>';
		_renderHTML +=	'<td background="../../TV_CCIU/TV_Imagenes/TV_Banner_Noticias/newsbg.gif">';
		_renderHTML +=	'<table width="98%" border="0" align="center" cellpadding="0" cellspacing="0" style="font-size: 0pt;">';
		_renderHTML +=	'<tr>';
		_renderHTML +=	'<td height="34" colspan="2" background="../../TV_CCIU/TV_Imagenes/TV_Banner_Noticias/newsbg2.gif">';
		_renderHTML +=	'<table width="100%" border="0" cellspacing="0" cellpadding="0" style="font-size: 0pt;">';
		_renderHTML +=	'<tr>';
		_renderHTML +=	'<td>';
		_renderHTML +=	'<img src="../../TV_CCIU/TV_Imagenes/TV_Banner_Noticias/n1.gif" width="129" height="34" />';
		_renderHTML +=	'</td>';
		_renderHTML +=	'<td align="right">&nbsp;</td>';
		_renderHTML +=	'</tr>';
		_renderHTML +=	'</table>';
		_renderHTML +=	'</td>';
		_renderHTML +=	'</tr>';
		_renderHTML +=	'<tr>';
		_renderHTML +=	'<td width="33%" height="210"><img id="img_bnoticias_fondo" style="cursor: hand; cursor: pointer;" width="256" height="197" /></td>';
		_renderHTML +=	'<td width="67%">';
		_renderHTML +=	'<table width="90%" border="0" align="center" cellpadding="0" cellspacing="0" style="font-size: 0pt;">';
		_renderHTML +=	'<tr height="50">';
		_renderHTML +=	'<td><span class="lbl_bnoticias_title" id="lbl_bnoticias_title" style="cursor: pointer;"></span></td>';
		_renderHTML +=	'</tr>';
		_renderHTML +=	'<tr>';
		_renderHTML +=	'<td><img src="../../TV_CCIU/TV_Imagenes/TV_Banner_Noticias/n3.jpg" width="294" height="12" /></td>';
		_renderHTML +=	'</tr>';
		_renderHTML +=	'<tr height="130">';
		_renderHTML +=	'<td >';
		_renderHTML +=	'<div align="justify" height="100%"><span class="lbl_bnoticias_content" id="lbl_bnoticias_content"></span>';
		_renderHTML +=	'</div>';
		_renderHTML +=	'</td>';
		_renderHTML +=	'</tr>';
		_renderHTML +=	'<tr>';
		_renderHTML +=	'<td align="right">';
		_renderHTML +=	"<img style='cursor: hand; cursor: pointer;' onclick='Method_Link_Page_Interior_Wong_Services(6);' src='../../TV_CCIU/TV_Imagenes/TV_Banner_Noticias/b1-off.gif' width='160' height='29' border='0' id='img_bnoticias_link' onmouseover='Method_Swap_Image(this,\"../../TV_CCIU/TV_Imagenes/TV_Banner_Noticias/b1-on.gif\");' onmouseout='Method_Swap_Image(this,\"../../TV_CCIU/TV_Imagenes/TV_Banner_Noticias/b1-off.gif\");' /></td>";
		_renderHTML +=	'</tr>';
		_renderHTML +=	'</table>';
		_renderHTML +=	'</td>';
		_renderHTML +=	'</tr>';
		_renderHTML +=	'</table>';
		_renderHTML +=	'</td>';
		_renderHTML +=	'</tr>';
		_renderHTML +=	'</table>';
		_object.innerHTML = _renderHTML;
		ARRAY_BANERS_NOTICIAS = _xmlDomBannerNoticias.XMLDOM.documentElement.getElementsByTagName('Banner');
		Method_BNoticias_EjecuteAleatorio();
	}
}