/* Copyright (C) 2005-2007 Erwin Ried

This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 
MA 02110-1301, USA. */

//-----------------------------------------------------------------
//
function totalActualUrl() 
{
	return (location.href);
}
//
//-----------------------------------------------------------------
//
function seleccionarComentarios(estado) 
{
	//var i=0;
	estado=(-estado)+1;
	for(i=estado;i<(document.formulario.elements.length)-1;i+=3)
	{
		document.formulario.elements[i].status = true;
	}
}
//
//-----------------------------------------------------------------
//
function realizarComentario(documento) 
{
	var ventana = window.open('comments.php?id=' + documento,'comentario','width=470,height=300,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbar=no,resizable=no,copyhistory=yes');
	ventana.focus();
}
//
//-----------------------------------------------------------------
//
function cambiarIconoComentario() 
{
	cambiaImagen(0,document.comentario.comm_icon.value);
}
//
//-----------------------------------------------------------------
//
var previa = 0;
function cambiaCalificacion(calificacion) 
{
    // Imagenes
	var encendida = "img/template/stars/on.gif";
	var apagada = "img/template/stars/off.gif";
	var i;
	
	// Cambiar solo las necesarias
	for(i=0;i<Math.max(previa,calificacion);i++)
	{
		if(i<calificacion)
		{
			cambiaImagen(i,encendida);
		}
		else
		{
			cambiaImagen(i,apagada);
		}
	}
	
	// Salir, recordando la calificacion que actualizamos
	previa = calificacion;
}

// Recibe el numero de imagen, pero partiendo de 0, y la cambia
function cambiaImagen(n,imagen)
{
	var _imagen = "califica_" + (n+1);
	document.images[_imagen].src = imagen;
}
//
//-----------------------------------------------------------------
//