
  
  	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 $ZVK.sinTags(this.cuerpo); 
				}
			else {
				return  $ZVK.sinTags(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[0]=='0') dia = dia[1];
					
			fecha = dia+' de '+mes+' de '+ano;
			return fecha;
			}
  			
  		});
	
	
	
	
	arraynoticias = $ZVK.toJason(arraynoticias);
	principal = new Noticia(principal);
  	
 
		
	window.addEvent('domready', function() {
		
		$$('#anteriores li a').addEvent('click',function(event){
				event.stop();
				var id = this.getProperty('id');
				id = id.substr(4);
				var litem = this.getParent();
				principal = new Noticia(arraynoticias[id]);
					$('fecha').innerHTML = principal.verFecha();
					$('categoria').innerHTML =principal.categoria;
					
					if (principal.foto==undefined){
						if($('foto_principal')!= null){$('foto_principal').setStyle('display','none')}
					} else {
						var estado = $('foto_principal').getStyle('display');
						if(estado=='none'){
							$('foto_principal').setStyle('display','block');
							}
						$('foto_principal').setProperty('src','img/news/'+principal.foto);
						}
					
					if (principal.copy==undefined){
						if($('copyright')!= null){$('copyright').setStyle('display','none')};
					} else {
						var estado = $('copyright').getStyle('display');
						if(estado=='none'){
							$('copyright').setStyle('display','block');
							}
						$('copyright').innerHTML = principal.copy;
						}
						
					
					if (principal.web==null||principal.web==""){
						$('webmas').setStyle('display','none');
						} else {
						$('webref').set('href',principal.web);
						$('webmas').setStyle('display','inline');
						}
					$('n1_titulo').innerHTML = principal.titulo;
					$('texto_des').innerHTML = principal.extracto();
					if (principal.fuente==null||principal.fuente==""){
						$('texto_autor').setStyle('display','none');
						} else {
						$('texto_autor').innerHTML = principal.fuente;
						$('texto_autor').setStyle('display','block');
						}
					
					$ZVK.subir('noticia');
					$('leermas').innerHTML = 'Leer más';
					estado_leermas = true;
				});	
				
		/* -- 3 -- */
		
		$ZVK.leermas();
				
		$('listar').addEvent('click',function(event){
			event.stop();
			$ZVK.subir('anteriores');
			});
			
		$('imprimir').addEvent('click',function(event){
			event.stop();
			window.print();
			});
		
		});