function votarticulonoticia(puntos) {
		
		var direccion;
		
		if (window.document.location.href.indexOf('?') > 0) {
			var campos = window.document.location.href.split('?');
			direccion = campos[0];
		}
		else {
			direccion = window.document.location.href;
		}	
		var http = createRequestObject();
		http.open("get", "/votaciones/votar.php?puntos=" + puntos + "&url=" + direccion + "&r=" + Math.random());
		http.onreadystatechange = function () {
				if(http.readyState == 4){
				if (http.responseText) {
					gracias = "<div class=label>Gracias por votar</div>";
					document.getElementById('contenidoestrellas').innerHTML = gracias;
					getEstrellasnoticia();
					getVotosnoticia();
						
				}
			}	
		};
		http.send(null);		
	}
function getEstrellasnoticia() {
		
		var direccion;
		
		if (window.document.location.href.indexOf('?') > 0) {
			var campos = window.document.location.href.split('?');
			direccion = campos[0];
		}
		else {
			direccion = window.document.location.href;
		}
		
		var http = createRequestObject();
		http.open("get", "/votaciones/estrellas.php?url=" + direccion);
		http.onreadystatechange = function () {
			if(http.readyState == 4){
				if (http.responseText) {
					var estrellas = http.responseText;
					
					if (estrellas.indexOf(".")) {
			
						campos = estrellas.split(".");
						estrellas = campos[0];	
						var media = (campos[1] > 0) ? 1 : 0;
					}
					
					var contenido = '';
					
					for (i = 0; i < estrellas; i++) {
						contenido += '<img src="/img/star_on.gif" alt="' + i +' votos" />';
					}
					
					if (media == 1) {
						contenido += '<img src="/img/star_on_md.gif" alt="' + estrellas +' votos" />';
						estrellas++;
					}
					
					for (i = estrellas; i < 5; i++) {
						contenido += '<img src="/img/star_off.gif" alt="' + i +' votos" />';	
					}
					
					window.document.getElementById('resultados-votos').innerHTML = contenido;
						
				}
			}	
		};
		http.send(null);
			
	}
	
	function getVotosnoticia() {
		
		var direccion;
		
		if (window.document.location.href.indexOf('?') > 0) {
			var campos = window.document.location.href.split('?');
			direccion = campos[0];
		}
		else {
			direccion = window.document.location.href;
		}
		
		var http = createRequestObject();
		//http.open("get", "/backend/votaciones/votos.php?url=" + direccion +"&r=" + Math.random());
		http.open("get", "/votaciones/votos.php?url=" + direccion);
		http.onreadystatechange = function () {
			if(http.readyState == 4){
				if (http.responseText) {
					var votos = http.responseText;
					if (votos == 1) {
						window.document.getElementById('numvotos-votos').innerHTML = votos + ' voto';
					}
					else {
						window.document.getElementById('numvotos-votos').innerHTML = votos + ' votos';
					}
				}
			}	
		};
		http.send(null);
			
	}	
