var ventana
var cont=0

function URLDecode(psEncodeString) {
  var lsRegExp = /\+/g;
  return unescape(String(psEncodeString).replace(lsRegExp, " ")); 
}
function afoto(cual, comentario, titulo) {
	if (cont==1) { ventana.close(); ventana=null }
	ventana=window.open('','ventana','resizable=yes,scrollbars=no')
	comentario = URLDecode(comentario)
	ventana.document.write('<title>' + titulo + '</title><link href="/style.css" rel="stylesheet" type="text/css" /><body scroll="no" onunload="opener.cont=0"><img  src="/' + cual + '" onload="opener.redimensionar(this.width, this.height)" /><br />' + comentario + '</body>')
	ventana.document.close()
	cont++
}
function redimensionar(ancho,alto) {
	ventana.resizeTo(ancho,alto+130)
	if (ancho > screen.width) {
		ventana.moveTo(0,0)
	} else {
		ventana.moveTo((screen.width-ancho)/2,(screen.height-alto)/2) 
	}
}
function VerResultados(id) {
	window.open('encuestaresultado.php?id='+id, 'Encuestas', 'width=650,resizable=yes');
}