// JavaScript Document
var idNoticiaFiltro;
var tipoNoticia;

function CargarEventos(indice, idNoticia)
{	
	indiceImagenes = indice;
		
	idNoticiaFiltro = idNoticia;
	
	var req = new Request({

		url: '../fcms/php_sitio/consultar_noticias.php?id=' + idNoticia + '&indice=' + indice,

		onSuccess: function(resultado){
			
			document.getElementById("listadoNoticias").innerHTML = resultado;
			InicializarObjetosNoticia();
		},

		onFailure: function(){
			alert('Request fallo!!');
		}

	});
	
	req.send();
}

function RegistrarVisita(idNoticia)
{
	var req = new Request({

		url: '../fcms/php_sitio/registrar_visita.php?id=' + idNoticia,

		onSuccess: function(resultado){

		},

		onFailure: function(){
			alert('Request fallo!!');
		}

	});
	
	req.send();
}

function InicializarObjetosNoticia()
{
	
	if($('imagen0') != null)
	{
	
		var el1 = $('imagen0');
		var el11 = $('principalImagen0');
		var anotherEl1 = $('fecha0');
		
		el1.setStyle("opacity", "0");
	
		el11.addEvent('mouseout', function(e) {
			e.stop();
			el1.fade(0);
			anotherEl1.morph('.noti_tex_white');
			
		});
		
		el11.addEvent('mouseover', function(e) {
			e.stop();
			el1.fade(1);
			// Changes the element's style to .myClass defined in the CSS
			anotherEl1.morph('.cat_tex_yellow');
		});
	
	}
	
	if($('imagen1') != null)
	{
	
		var el2 = $('imagen1');
		var el12 = $('principalImagen1');
		var anotherEl2 = $('fecha1');
		
		el2.setStyle("opacity", "0");
	
		el12.addEvent('mouseout', function(e) {
			e.stop();
			el2.fade(0);
			anotherEl2.morph('.noti_tex_white');
			
		});
		
		el12.addEvent('mouseover', function(e) {
			e.stop();
			el2.fade(1);
			// Changes the element's style to .myClass defined in the CSS
			anotherEl2.morph('.cat_tex_yellow');
		});
	
	}
	
	if($('imagen2') != null)
	{
	
		var el3 = $('imagen2');
		var el13 = $('principalImagen2');
		var anotherEl3 = $('fecha2');
		
		el3.setStyle("opacity", "0");
	
		el13.addEvent('mouseout', function(e) {
			e.stop();
			el3.fade(0);
			anotherEl3.morph('.noti_tex_white');
		});
		
		el13.addEvent('mouseover', function(e) {
			e.stop();
			el3.fade(1);
			// Changes the element's style to .myClass defined in the CSS
			anotherEl3.morph('.cat_tex_yellow');
		});
	
	}
	
	if($('imagen3') != null)
	{
	
		var el4 = $('imagen3');
		var el14 = $('principalImagen3');
		var anotherEl4 = $('fecha3');
		
		el4.setStyle("opacity", "0");
	
		el14.addEvent('mouseout', function(e) {
			e.stop();
			el4.fade(0);
			anotherEl4.morph('.noti_tex_white');
		});
		
		el14.addEvent('mouseover', function(e) {
			e.stop();
			el4.fade(1);
			// Changes the element's style to .myClass defined in the CSS
			anotherEl4.morph('.cat_tex_yellow');
		});
	
	}
	
	if($('imagen4') != null)
	{
	
		var el5 = $('imagen4');
		var el15 = $('principalImagen4');
		var anotherEl5 = $('fecha4');
		
		el5.setStyle("opacity", "0");
	
		el15.addEvent('mouseout', function(e) {
			e.stop();
			el5.fade(0);
			anotherEl5.morph('.noti_tex_white');
		});
		
		el15.addEvent('mouseover', function(e) {
			e.stop();
			el5.fade(1);
			// Changes the element's style to .myClass defined in the CSS
			anotherEl5.morph('.cat_tex_yellow');
		});
	
	}
	
	if($('imagen5') != null)
	{
	
		var el6 = $('imagen5');
		var el16 = $('principalImagen5');
		var anotherEl6 = $('fecha5');
		
		el6.setStyle("opacity", "0");
	
		el16.addEvent('mouseout', function(e) {
			e.stop();
			el6.fade(0);
			anotherEl6.morph('.noti_tex_white');
		});
		
		el16.addEvent('mouseover', function(e) {
			e.stop();
			el6.fade(1);
			// Changes the element's style to .myClass defined in the CSS
			anotherEl6.morph('.cat_tex_yellow');
		});
	
	}
	
	if($('imagen6') != null)
	{
	
		var el7 = $('imagen6');
		var el17 = $('principalImagen6');
		var anotherEl7 = $('fecha6');
		
		el7.setStyle("opacity", "0");
	
		el17.addEvent('mouseout', function(e) {
			e.stop();
			el7.fade(0);
			anotherEl7.morph('.noti_tex_white');
		});
		
		el17.addEvent('mouseover', function(e) {
			e.stop();
			el7.fade(1);
			// Changes the element's style to .myClass defined in the CSS
			anotherEl7.morph('.cat_tex_yellow');
		});
	
	}
	
	if($('imagen7') != null)
	{
	
		var el8 = $('imagen7');
		var el18 = $('principalImagen7');
		var anotherEl8 = $('fecha7');
		
		el8.setStyle("opacity", "0");
	
		el18.addEvent('mouseout', function(e) {
			e.stop();
			el8.fade(0);
			anotherEl8.morph('.noti_tex_white');
		});
		
		el18.addEvent('mouseover', function(e) {
			e.stop();
			el8.fade(1);
			// Changes the element's style to .myClass defined in the CSS
			anotherEl8.morph('.cat_tex_yellow');
		});
	
	}
}