var imNS = '';
/*OBJETO RESPUESTA*******************/
function obj_respuesta(texto) {
   this.texto = texto;
}

/*OBJETO PREGUNTA******************************************/
function obj_pregunta(texto)
{
/*propiedades*/
    this.texto = texto;
    this.respuestas = new Array();
    this.total = 0;
/* métodos*/    
    this.crearespta = crearespta;
    this.leer = leerespta; 
}

function crearespta(texto)
{
var ult = this.respuestas.length;
this.respuestas[ult] = new obj_respuesta(texto);
this.total = this.respuestas.length;
return this.total;
}

function leerespta(num)
{
 return this.respuestas[num];
}
/*********************FIN OBJETO PREGUNTA ********************/

/* OBJETO: LISTA DE PREGUNTAS ************************/
function obj_listapregs() {
	this.preguntas = new Array();
	this.total =0;
	this.leer = leepregta;
	this.creapregta = creapregta;
	this.crearespta = nuevarespta;
}

function leepregta(ind) {

if ( ind < this.total ) 
	return this.preguntas[ind];
else
   return null;	
}

function creapregta(texto) {
var i = this.total;             //this.preguntas.length;
this.preguntas[i] = new obj_pregunta(texto);	
this.total++                    // = this.preguntas.length;
}

function nuevarespta(npr, texto) {
if ( npr < this.total ) 
  this.preguntas[npr].crearespta(texto);   
else
  alert('La pregunta '+npr+' no existe.')
}
/****************CUADRO PARA PRESENTAR TEXTO de una lista ***********/
function obj_cuadro(elemento, ident, clase, monitor, clasmon) {
	this.elAct = 0;
	this.clase = clase;			//clase CSS del cuadro
	this.contenido = elemento;          //Lista de preguntas o una pregunta
	this.capa = new obj_capa(ident, clase);
	this.monitor = new obj_capa(monitor, clasmon);
	this.sigte = sigte;
	this.anter = anter;
	this.prim = irprim;
    this.ultimo = irult;
	this.mail = mostrarMail;
	this.mostrar = actualizar;
    this.leer = leecont;
	this.filtro = new Array();
	this.indFiltro = 0;
}
function leecont()
{
  return this.contenido.leer(this.elAct);
}
function irprim() {
if (this.filtro.length >0)
	{
	this.elAct = this.filtro[0]
	this.indFiltro = 0;
	}
else	 
	this.elAct = 0
this.mostrar();
}	

function irult() {
if (this.filtro.length >0)
	{
	this.indFiltro = this.filtro.length-1;
	this.elAct = this.filtro[this.indFiltro];
	}
else	 
	this.elAct = this.contenido.total-1
this.mostrar();
}	

function sigte() {
switch (this.filtro.length >0){
case true:
	if (this.indFiltro < this.filtro.length-1)
		{
		this.indFiltro++;
		this.elAct = this.filtro[this.indFiltro];
		this.mostrar();
		}
	break;	
case false:
	if ( this.elAct < (this.contenido.total-1) ) 
		{
	 	this.elAct++;
		this.mostrar();
		}
	}
}	
function anter() {
switch (this.filtro.length >0){
case true:
	if (this.indFiltro >0)
		{
		this.indFiltro--;
		this.elAct = this.filtro[this.indFiltro];
		this.mostrar();
		}
	break;	
case false:
	if ( this.elAct > 0) {
		this.elAct--;
		this.mostrar();
		}
	}	
}
function actualizar() {
var valor, act, valor1;
with (this){
    act = elAct +1;
	valor = contenido.leer(elAct).texto;
	capa.refrescar(valor)
	if (capa.ident=='cpreg') 
	     valor = "Pregunta ";
    else 
	     valor = "Respuesta ";
	valor = valor + act+ " de "+contenido.total;
	monitor.refrescar(valor);
   }
}

/*OBJETO CAPA ********/
function obj_capa(capa, clase)
{
 this.ident = capa;
 this.clase = clase;             //necesario por Netscape
 this.refrescar = refrescar;
}

function refrescar(valor)
{
var identif = this.ident;
if (miNavegador.standard || miNavegador.IE)
    {
    document.all[identif].innerHTML = ""; 
	document.all[identif].innerHTML = valor;
    }
else{
	 valor = '<div id="rpt" class="'+this.clase+'">'+valor+'<p>&nbsp;</p></div>';
	 document.layers[identif].document.open();
	 document.layers[identif].document.write(valor);
     document.layers[identif].document.close();
	 document.layers['fondoResp'].document.open();
	 document.layers['fondoResp'].document.write('<img src="../simbolos/transparent.gif" height="2800px" width="1px">')
	 document.layers['fondoResp'].document.close();
 	}

return; 
}

function mostrarMail()
{
var formul = this.capa.ident+'mail';
var formmail = this.capa.ident+'Form';
if (navigator.appName=="Netscape")
    {
    document.layers[formul].document.forms[formmail].Borrar.click();
    document.layers[formul].visibility = 'visible'
    }
else{
    document[formmail].Borrar.click();    
    document.all[formul].style.visibility = 'visible';
    }
}