// NAVEGADORES
ns = (document.layers)? true:false;
ie = (document.all)? true:false;
dom = (document.getElementById)? true:false;
zindex=200;
var imgFondo=".,/images/pestanyas/pix_trans.gif";
/***************** CONSTRUCTOR oAviso **********************/
function oAviso() {
this.nomVariable = 'aviso';
this.idCapa = 'capaAviso';
this.tipo = 'error';
this.codError = 'codError';
this.descBreve = 'descBreve';
this.texto = 'texto';
this.rutaImg = "./igep/images/avisos/";
this.mostrarAviso = f_mostrarAviso;
this.set =f_set;
this.cerrarCapa = f_cerrarCapa;
}
/******************* SET ***********************************************/
function f_set(nombre,idCapa,tipo,codError,descBreve,texto)
{
this.nomVariable = nombre;
this.idCapa = idCapa;
this.tipo = tipo.toUpperCase();
this.codError = codError;
this.descBreve = descBreve;
this.texto = texto;
}
/******************* CERRAR CAPA *************************************/
function f_cerrarCapa() {
capaAviso=eval('divDocument["'+this.idCapa+'"]');
eval('divDocument["'+this.idCapa+'"].setDisplay("none")');
capaAviso.changeLayerContent('');
carga();
eval('divDocument["capaBloqueo"].setDisplay("none")');
}
/******************** CREAR CAPA BLOQUEO *********************************/
var zindex = 200;
var imgFondo = "./images/trans.gif";
var AnchoPagina = 0;
var AltoPagina = 0;
function capaBloqueo()
{
//Si la capa de bloqueo no existe la crea.
if(document.getElementById("capaBloqueo")==null) {
//Tamaño en pixels del espacio donde se visualiza la página.
if(ie) {
AnchoPagina=document.body.clientWidth;
AltoPagina=document.body.clientHeight;
}
else {
AnchoPagina = innerWidth;
AltoPagina = innerHeight;
}
// crear la capa de bloqueo para explorer y para mozilla
if(ie){
document.body.insertAdjacentHTML('beforeEnd','
');
}
else {
var nuevo=document.createElement("div");
nuevo.id="capaBloqueo";
nuevo.style.position="absolute";
nuevo.style.zIndex=zindex;
nuevo.style.left=0;
nuevo.style.top=0;
nuevo.style.backgroundImage="url('"+imgFondo+"')";
//nuevo.style.background = 'white';
nuevo.style.width=AnchoPagina;
nuevo.style.height=AltoPagina;
document.body.appendChild(nuevo);
}
}
}
/******************** CREAR CAPA ERROR *********************************/
function capaError(capa,ancho,alto) {
var docAncho,docAlto;
var msgTop,msgLeft;
capaBloqueo();
// calcular posicion de la capa de ventana de error
msgLeft=Math.ceil((AnchoPagina-ancho)/2);
msgTop=Math.ceil((AltoPagina-alto)/2);
Z = parseInt(zindex+2,10);
eval('divDocument["'+capa+'"].setZindex('+Z+')');
eval('divDocument["'+capa+'"].setTamanyo('+ancho+','+alto+')');
eval('divDocument["'+capa+'"].setPosicion("mover",msgLeft,msgTop)');
eval('divDocument["'+capa+'"].setDisplay("block")');
}
/************************* CONTENIDO CAPA ERROR **************************/
function f_mostrarAviso(objetoGenerador)
{
var imgBk = '';
var cerrar = '';
capaError(this.idCapa,200,200);
switch(this.tipo) {
case 'ERROR':
imgBk = this.rutaImg+'aviso-rojo.gif';
cerrar = this.rutaImg+'cerrar-rojo.gif';
break;
case 'AVISO':
imgBk = this.rutaImg+'aviso-azul.gif';
cerrar = this.rutaImg+'cerrar-azul.gif';
break;
case 'SUGERENCIA':
imgBk = this.rutaImg+'aviso-verde.gif';
cerrar = this.rutaImg+'cerrar-verde.gif';
break;
case 'ALERTA':
imgBk = this.rutaImg+'aviso-amarillo.gif';
cerrar = this.rutaImg+'cerrar-amarillo.gif';
break;
};
// Dibuja la ventana y activa la capa
contenido = '';
contenido += '';
contenido += '';
contenido += '';
contenido += '';
contenido += '';
contenido += '';
contenido += '';
contenido += ' | ';
contenido += ' '+this.codError+' | ';
contenido += ' | ';
contenido += ' ';
contenido += '';
contenido += ' | ';
contenido += ''+this.descBreve+' | ';
contenido += ' ';
contenido += ' ';
contenido += ' | ';
contenido += ' ';
contenido += ' | ';
contenido += '';
contenido += '';
contenido += '';
contenido += '';
contenido += ' | ';
contenido += ''+this.texto+' | ';
contenido += ' ';
contenido += ' ';
contenido += ' | ';
contenido += ' ';
contenido += '';
contenido += '';
contenido += '';
contenido += '';
contenido += '';
contenido += '';
contenido += ' | ';
contenido += ' ';
contenido += ' ';
contenido += ' | ';
contenido += ' ';
contenido += ' ';
contenido += ' | ';
contenido += '
';
contenido += '
';
capaAviso=eval('divDocument["'+this.idCapa+'"]');
capaAviso.changeLayerContent(contenido);
eval('divDocument["'+this.idCapa+'"].setDisplay("block")');
document.getElementById('btnAceptar').focus();
}