﻿// JScript File

function InfoPanel_Mensaje(codigo,mensaje)
{
  this.codigo=codigo;
  this.mensaje=mensaje
}

function InfoPanel_PanelInfo()
{
  this.E=[];
  this.D=[];
  this.MP = false;
  this.IC = false;
}

InfoPanel_PanelInfo.prototype.Inicialice=function(valores)
{
    //Inicializa  los arrays. Formato: Codigo||Descripcion@@Codigo||Descripcion;
    arr=valores.split('@@');
    var omes=null;
    for(i=0;i<arr.length;i++)
    {
      arrmes=arr[i].split('||');
      omes=new InfoPanel_Mensaje(arrmes[0],arrmes[1]);
      this.Add(omes);
    }
    this.Draw();
}

InfoPanel_PanelInfo.prototype.Add=function(mensaje)
{
  var arr;
  if (mensaje.codigo.charAt(0)=='M')
    this.MP = true;
  else if (mensaje.codigo.charAt(0)=='I')
    this.IC = true;
  else
  {
      this.MP = false;
      this.IC = false;
      arr=mensaje.codigo.charAt(0)=='E'?this.E:this.D;
      if(InfoPanel_Exists(arr,mensaje)==-1)
        arr[arr.length]=mensaje
  }
}

function InfoPanel_Exists(lista,men)
{
  for(i=0;i<lista.length;i++)
    if(lista[i].codigo.toUpperCase()==men.codigo.toUpperCase())
      return i;
  return -1;
}

InfoPanel_PanelInfo.prototype.Del=function(codigo)
{
  var arr;
  arr=codigo.charAt(0)=='E'?this.E:this.D;
  for(i=0;i<arr.length;i++)
  {
    if(arr[i].codigo.toUpperCase()==codigo.toUpperCase())
    {
      arr.splice(i,1);
    }
  }
}

InfoPanel_PanelInfo.prototype.DrawE=function()
{
  td=$get('TDInfoPanelE');
  text='<UL class="MenEstatic">';
  for(i=0;i<this.E.length;i++)
  {
    text+='<LI>'+this.E[i].mensaje+'</LI>'
  }
  text+='</UL>';
  td.innerHTML=text;
}

InfoPanel_PanelInfo.prototype.DrawD=function()
{
  td=$get('TDInfoPanelD');
  td.innerHTML='';
  text='<UL class="MenDinamic">';
  for(i=0;i<this.D.length;i++)
  {
    text+='<LI>'+this.D[i].mensaje+'</LI>'
  }
  text+='</UL>';
  td.innerHTML=text;
}

InfoPanel_PanelInfo.prototype.DrawMP=function()
{
  td=$get('TDInfoPanelE');
  td.innerHTML='';
  text = '<img src="../Images/Default/icon12/Informacion.png" />&nbsp;Relev. Deloitte:<br>'
  text+='&nbsp;&nbsp;&nbsp;<img src="../Images/Default/LeyendaRelevA.png" TITLE=Alta>&nbsp; <SPAN TITLE=Alta>A</SPAN><br>';
  text+='&nbsp;&nbsp;&nbsp;<img src="../Images/Default/LeyendaRelevM.png" TITLE=Media>&nbsp; <SPAN TITLE=Media>M</SPAN><br>';
  text+='&nbsp;&nbsp;&nbsp;<img src="../Images/Default/LeyendaRelevN.png" TITLE=Neutra>&nbsp; <SPAN TITLE=Neutra >N</SPAN><br>';

  text+= '<br><img src="../Images/Default/icon12/Informacion.png" />&nbsp;Niveles de relación:<br>'
  text+='&nbsp;&nbsp;&nbsp;<img src="../Images/Default/LeyendaNivelE.png" TITLE=Excelente>&nbsp; <SPAN TITLE=Excelente>E</SPAN><br>';
  text+='&nbsp;&nbsp;&nbsp;<img src="../Images/Default/LeyendaNivelB.png" TITLE=Buena>&nbsp; <SPAN TITLE=Buena>B</SPAN><br>';
  text+='&nbsp;&nbsp;&nbsp;<img src="../Images/Default/LeyendaNivelD.png" TITLE="Por desarrollar"/>&nbsp; <SPAN TITLE="Por desarrollar">P</SPAN><br><br>';

  td.innerHTML=text;
}

InfoPanel_PanelInfo.prototype.DrawIC=function()
{
  td=$get('TDInfoPanelE');
  td.innerHTML='';
  text = '<img src="../Images/Default/icon12/Informacion.png" />&nbsp;Calidad de los datos:<br>'
  text+='&nbsp;&nbsp;&nbsp;<img src="../Images/Default/icon12/Aceptado.png" />&nbsp; El contacto no tiene errores<br>';
  text+='&nbsp;&nbsp;&nbsp;<img src="../Images/Default/icon12/Aviso.png" />&nbsp; Algún dato es demasiado largo<br>';
  text+='&nbsp;&nbsp;&nbsp;<img src="../Images/Default/icon12/Error.png" />&nbsp; Hay datos erroneos<br>';
  td.innerHTML=text;
}

InfoPanel_PanelInfo.prototype.Draw=function()
{
    // para el caso del mapa relacional
    if (this.MP)
    {
        this.DrawMP();
    }
    else if (this.IC)
    {
        this.DrawIC();
    }
    else
    {
        this.DrawE();
        this.DrawD();
    }    
}




