 	  	

	/*
	 * Clase agenda
	 * ---------------
	 *  - Almacena los datos de las noticias recibiendo un JSON a traves de PHP.
	 *  - Aņade funcionalidades de visualizacion
	 * 
	 */
  
  	var Noticia = new Class({
  		initialize : function(objeto){
  			this.id = objeto.id;
  			this.titulo = objeto.titulo;
  			this.cuerpo	= $ZVK.sinQuots(objeto.cuerpo);
  			this.fecha = objeto.fecha;
  			this.categoria = objeto.categoria;
  			this.web = objeto.web;
  			this.fuente = objeto.fuente;
  			if(objeto.foto){
  				this.foto = objeto.foto;
  				this.copy = objeto.copy;
  				}
  			},
  		
  		extracto : function(){
			if(this.cuerpo.length<400){return this.cuerpo; }
			else { return this.cuerpo.substr(0,400)+'[...]';}
  			},
  			
  		verFecha : function(){
			var fecha = this.fecha;
			arrayfecha_hora= fecha.split(" ");
			arrafecha = arrayfecha_hora[0].split('-');
			
			ano = arrafecha[0];
			
			mes = arrafecha[1];
			if (mes.substr(0,1)=='0') mes = mes.substr(1,1);
			
			mes = arraymeses[mes];				
			dia = arrafecha[2];
			if (dia.substr(0,1)=='0') dia = dia.substr(1,1);
					
			fecha = dia+' de '+mes+' de '+ano;
			return fecha;
			}
  			
  		});
	
	
	/********************************************/
	/* Carga de datos							*/
	/*											*/
	
	arraynoticias = $ZVK.toJason(arraynoticias);
	principal = new Noticia(principal);
  	
  	
  	/********************************************/
	/* On load									*/
	/*											*/
		
	window.addEvent('domready', function() {
		
		
		/* 
		 *  1 - Carga el listado de noticias en memoria 
		 *  2 - Despliega los accesos a las noticias anterios.
		 *  3 - Carga los comportamientos de lacciones Imprimir, ver listado y leer completa
		 * 
		 */

		/* -- 1 -- */
		if (principal.foto==null){
			$('foto_principal').setStyle('display','none');
		}		
		
		/* -- 2 -- */
					 
		
				
		/* -- 3 -- */
		
		$ZVK.leermas();
				
		$('listar').addEvent('click',function(event){
			event.stop();
			$ZVK.subir('anteriores');
			});
			
		$('imprimir').addEvent('click',function(event){
			event.stop();
			window.print();
			});
		
		});
