﻿var capamsg=null;
function msgBox(mes,title,gravedad,e)
{
//Propiedades
    this.message=mes;
    this.title=title;
    this.gravedad=gravedad;
    this.width=300;
    this.divbox=null;
    this.folderImages= Webroot+'images/Default/';
    this.IE_X=0;
    this.IE_Y=0;
    this.AntX=0;
    this.AntY=0;
    this.msgBoxRaton = false;
    this.divTitle=null;
    msgboxthis=this;
    this.win=new jsWindow();
    this.win.width=300;
    this.win.height=0;
    this.Event=e;
    
}

msgBox.prototype.show=function(e)
{
    this.win.title=this.title;
//Panel que continee la tabla con el mensaje y la imagen
    divPanel=document.createElement("div");
    divPanel.className='msgBoxResults';
    tbl=document.createElement("Table");
    tbl.border=0;
    tbl.style.width='100%';
    tbody=document.createElement("Tbody");
    tr=document.createElement("Tr");
    td=document.createElement("td");
    td.className='msgBoxTdImg';
    img=document.createElement('img');
    
    switch(this.gravedad)
    {
      case 1://Informacion
        img.src=this.folderImages+'icon48/Información.png';
        break;
       case 2://Aviso
        img.src=this.folderImages+'icon48/Aviso.png';
        break;
       case 3://Error
        img.src=this.folderImages+'icon48/Error.png';
        break;
       case 4://Buscando
        img.src=this.folderImages+'icon48/wait.gif';
        break;
       default:
        img.src=this.folderImages+'icon48/Información.png';
        break;
    }
    
    
    td.appendChild(img);
    tr.appendChild(td);
    td=document.createElement("td");
    td.className='msgBoxTdText';
//    td.appendChild(document.createTextNode(this.message));
    td.innerHTML=this.message;
    tr.appendChild(td);
    tbody.appendChild(tr);
    tbl.appendChild(tbody);
    divPanel.appendChild(tbl);
    
    this.win.folderImages=this.folderImages+'icon16/';
    if (this.gravedad == 4)
        this.win.show(true,false);
    else
        this.win.show(true);
    this.win.createContent();
    this.win.addContent(divPanel);
    this.position(this.Event,this);
    
}

msgBox.prototype.position = function (e,obj) {
    var doc=document.body;
    var y = (doc.clientHeight/2) - (this.win.height/2);
    var x = (doc.clientWidth-this.win.width )/2;
    this.win.divBox.style.left = x + "px";
    this.win.divBox.style.top = y + "px";
    //this.win.divBox.style.zIndex='100';

};
msgBox.prototype.close = function () {
    
    
    
    return false;
};

msgBox.prototype.closeManual = function () {
    this.win.close();
};



  