/*
FAVOR NAO FICAR INSERINDO LINHAS EM BRANCO E NEM TENTAR IDENTAR POR CONTA
*/
var gw_key=0;
var clearS
var total_accept
var txt
var arrAjaxObjs = new Array();
var reqm = null
var mousex;
var mousey;
var ectid;
function oobj (nm){return document.getElementById(nm);}
function regAjaxObj(value){arrAjaxObjs[arrAjaxObjs.length] = value;}
function chr(charcode){return unescape('%' + charcode.toString(16));}
function closeWindow(doc) {alert(this.name);}
function getData(myXML)
{
 try
 {
  if ( myXML.firstChild)
  {
   return myXML.firstChild.nodeValue;
  }
  else
  {
   return "";
  }
 }
 catch(error)
 {}
}
function alertas(){window.status = 'SSWWeb'; return true;}
function hidestatus(){window.status = 'SSWWeb';return true}
function addHTMLcool (html)
{
 if (document.all)
  document.frm.insertAdjacentHTML('beforeEnd', html);
 else
 {
  if (document.createRange)
  {
   var range = document.createRange();
   range.setStartAfter(document.frm.lastChild);
   var docFrag = range.createContextualFragment(html);
   document.frm.appendChild(docFrag);
  }
  else
  {
   if (document.layers)
   {
    var l = new Layer(window.innerWidth);
    l.document.open();
    l.document.write(html);
    l.document.close();
    l.top = document.height;
    document.height += l.document.height;
    l.visibility = 'show';
   }
  }
 }
}
// dah o Submit no form, passando como 'gw_act' o parametro 'val'
// 'action' e para onde o form vai enviar o submit
// 'nv' indica se abre em uma nova janela ou nao
function envia3(val, nv, action) 
{
 var oldact
 var tagname
 var today = new Date();
 tagname = today.getHours() + today.getMinutes() + today.getSeconds() + today.getMilliseconds();
 oldact = document.frm.action;
 document.frm.action = action;
 document.frm.act.value=val;
 if (nv == 1) 
 { 
  document.frm.target = tagname
  var winX = (document.all)?window.screenLeft:window.screenX;
  var winY = (document.all)?window.screenTop:window.screenY;
  var winW = ie? document.body.clientWidth : document.body.clientWidth;
  var winH = ie? document.body.clientHeight : document.body.clientHeight;
  fullscreenX = winW - screen.availWidth;
  if (fullscreenX < 0) fullscreenX *= - 1;
  if (fullscreenX < 50) fullscreenX=1; else fullscreenX=0;
  if (fullscreenX==1)
  {
   janela=window.open("", tagname, "fullscreen=0,menubar=0,location=0,toolbar=0," +
          "status=1,scrollbars=1,resizable=1,width=" + (screen.availWidth-10) +
          ",height=" + (screen.availHeight-10) + ",top=0,left=0");
   janela.resizeTo(screen.availWidth,screen.availHeight);
  }else{
   janela=window.open("", tagname, "fullscreen=0,menubar=0,location=0,toolbar=0," +
          "status=1,scrollbars=1,resizable=1,width=" + winW +
          ",height=" + winH + ",top=" + winY + ",left=" + winX);
   if (document.all) {
    janela.resizeTo(winW, winH);
    janela.moveTo(winX, winY);
   }else{
    janela.outerHeight = window.outerHeight
    janela.outerWidth = window.outerWidth;
   }
   if (document.all) {
    offX1 = (document.all)?window.screenLeft:window.screenX;
    offX2 = (document.all)?janela.screenLeft:janela.screenX;
    offY1 = (document.all)?window.screenTop:window.screenY;
    offY2 = (document.all)?janela.screenTop:janela.screenY;
    janela.moveTo(winX + (offX1 - offX2), winY + (offY1 - offY2));
    offX1 = ie? document.body.clientWidth : document.body.clientWidth;
    offX2 = ie? janela.document.body.clientWidth : janela.document.body.clientWidth;
    offY1 = ie? document.body.clientHeight : document.body.clientHeight;
    offY2 = ie? janela.document.body.clientHeight : janela.document.body.clientHeight;
    janela.resizeTo(winW + (offX1 - offX2), winH + (offY1 - offY2));
   }else if (document.layers||oobj){ }
  }
 } 
 else 
  document.frm.target ='_self';
 if (nv == 0)
 {//desabilita o botao apos o clique
  try {
   oobj(obj.id).href = "#";
   oobj(obj.id).readOnly = true;
   oobj(obj.id).className = "disalnk";
  } catch (error) {}
  newHTML = "<table " +
   "cellpadding=0 cellspacing=0 border=0 width=100% height=100%>" +
   "<tr><td width=8 style=\"border:0px;background:rgb(255,255,0);color:#FFF;\">&nbsp;</td>" +
   "<td width=762 valign=center class=cltt2" +
   " style=\"border:0px;background:rgb(255,255,0);color: #000;" +
   "font-size:10px;text-align: left;font-weight:bold; \">" +
   "Aguarde ..." +
   "</td></tr></table>";
 }
 document.frm.submit();
 document.frm.action = oldact;
}
// Abre um link passando como 'gw_act' o parametro 'val'
// 'nv' indica se abre em uma nova janela ou não.
// action é a pagina que ele vai abrir
function envia5(action) 
{
 var oldact
 var tagname
 var today = new Date();
 opener.location = action;
}
// Abre um link passando como 'gw_act' o parametro 'val'
// 'nv' indica se abre em uma nova janela ou não.
// action é a pagina que ele vai abrir
function envia4(nv, action) 
{
 var oldact
 var tagname
 var today = new Date();
 if (nv == 0) 
  tagname = '_self'; 
 else
  tagname = '_blank'; 
 janela = window.open(action, tagname, "fullscreen=0,menubar=0,location=0,toolbar=0,status=1," +
          "scrollbars=1,resizable=1,width=770" + 
          ",height=500,top=1,left=1");
 if (nv == 1)
 {
  janela.moveTo(0,0);
  if (document.all) {
   janela.resizeTo(screen.availWidth,screen.availHeight);
  }
  else if (document.layers||oobj) 
  {
   janela.outerHeight = screen.availHeight;
   janela.outerWidth = screen.availWidth;
  }
 }
}
function showhelp(nv, action) 
{
 var oldact
 var tagname
 var today = new Date();
 if (nv == 0) 
  tagname = '_self'; 
 else
  tagname = '_blank'; 
 janela=window.open(action, tagname, "fullscreen=0,menubar=0,location=0,toolbar=0,status=1," +
        "scrollbars=1,resizable=1,width=600" + 
        ",height=500,top=1,left=1");
 if (nv == 1)
 {
  if (document.all) {
   janela.moveTo(screen.availWidth - 630, 0);
   janela.resizeTo(630,screen.availHeight);
  }
  else if (document.layers||oobj) 
  {
   janela.moveTo(screen.availWidth - 630, 0);
   janela.outerHeight = screen.availHeight;
   janela.outerWidth = 630;
  }
 }
}
function abrir(arqori, arqdes, download, newwindow, path, action_before) 
{
 var action
 var tagname
 var today = new Date();
 tagname = today.getHours() + today.getMinutes() + today.getSeconds();
 action = "/bin/ssw0424?act=" + arqori + "&filename=" + arqdes +
          "&path=" + path + "&down=" + download + "&nw=" + newwindow;
 oobj("dframe").src = action;
 return true;
}
// Abre um link passando como 'gw_act' o parametro 'val'
// 'nv' indica se abre em uma nova janela ou não.
// action é o
function download(arqori, arqdes, folder) 
{
 var action
 var tagname
 var today = new Date();
 tagname = '_blank';
 action = "/bin/ssw0432?act=DOW&from=" + folder + "&filename=" + arqori + "&username=" + arqdes;
 location.href = action;
}
// dá o Submit no form, passando como 'gw_act' o parametro 'val'
// 'nv' indica se abre em uma nova janela ou não.
function envia(val, nv) 
{
 var tagname
 var bcontinua
 var today = new Date();
 var inputsLength = document.getElementsByTagName("input").length;
 bcontinua = true;
 if (bcontinua) 
 {
  tagname = today.getHours() + today.getMinutes() + today.getSeconds();
  if (document.frm.act)
   document.frm.act.value=val;
  if (nv == 1) 
  {
   document.frm.target = tagname
   janela=window.open("", tagname, "fullscreen=0,menubar=0,location=0,toolbar=0," + 
          "status=1,scrollbars=1,resizable=1,width=770" +
          ",height=500,top=1,left=1");
   janela.moveTo(0,0);
   if (document.all) {
    janela.resizeTo(screen.availWidth,screen.availHeight);
   }
   else if (document.layers||oobj) 
   {
    janela.outerHeight = screen.availHeight;
    janela.outerWidth = screen.availWidth;
   }
  }
  else
   document.frm.target = '_self';
  document.frm.submit();
  if (nv == 0)
  {
   try
   {
    if (oobj(obj.id).className != "sra")
    {
     oobj(obj.id).href = "#";
     oobj(obj.id).readOnly = true;
     oobj(obj.id).className = "disalnk";
     newHTML = "<table " +
       "cellpadding=0 cellspacing=0 border=0 width=100% height=100%>" +
       "<tr><td width=8 style=\"border:0px;background:rgb(255,255,0);color:#FFF;\">&nbsp;</td>" +
       "<td width=762 valign=center class=cltt2" +
       " style=\"border:0px;background:rgb(255,255,0);color: #000;" +
       "font-size:10px;text-align: left;font-weight:bold; \">" +
       "Aguarde ..." +
       "</td></tr></table>";
    }
   }
   catch(error)
   {}
  }
 }
}
function onlynum(e) 
{
 var keyNumber = (navigator.appName != "Netscape") ? event.keyCode : e.which;
 if (((keyNumber<48)||(keyNumber>57)) &&
      (keyNumber!=13) && (keyNumber!="0") && (keyNumber!=43) && (keyNumber!=27) && (keyNumber!=8)) 
 {
  if (navigator.appName != "Netscape") event.keyCode=0;
   return false;
 }
 return true;
}
function pad(number,length) {var str = '' + number; while (str.length < length) str = '0' + str; return str;}
function execOnChange(myobj)
{
 if (myobj.onchange)
 {
  var ttt = myobj.onchange;
  ttt = ttt.toString().replace(/function anonymous/g,"");
  ttt = ttt.toString().replace(/function onchange/g,"");
  ttt = ttt.toString().replace(/function ()/g,"");
  ttt = ttt.toString().replace("(event)","()");
  ttt = ttt.toString().replace("()","");
  ttt = ttt.toString().replace(/{/g,"");
  ttt = ttt.toString().replace(/}/g,"");
  ttt = ttt.toString().replace(/this/g,"oobj(" + myobj.id + ")");
  eval(ttt);
 }
}
function doDateTime(e)
{
 if (e == null) e = window.event;
 var oobs = (e.srcElement) ? e.srcElement : e.originalTarget;
 var ml=oobs.maxLength;

 if (ml>=6)
 {//Data
  var vl = oobs.value;

  if (vl!='')
  {
    DD = pad(vl.substring(0,2), 2);
    MM = pad(vl.substring(2,4), 2);
    var semano=false;
    YY = vl.substring(4,6);
    if (YY.trim()=="") semano=true;
    YY = pad(YY, 2);
    var today = new Date();
    DDh = pad(today.getDate(), 2);
    MMh = pad(today.getMonth() + 1, 2);
    YYh = pad(today.getFullYear(), 4).substring(2,4);
    if ((DD=='00')&&(MM=='00')&&(YY=='00')){oobs.value=DDh+MMh+YYh;execOnChange(oobs);return true;}
    if ((YY=='00') && (semano)) YY = YYh;
    if (MM=='00') MM = MMh;
    if (YY >= 70) YY=1900+parseFloat(YY); else YY=2000+parseFloat(YY);
    nd=new Date(YY, (MM-1), DD, 2, 0, 0);
    DDh = pad(nd.getDate(), 2);
    MMh = pad(nd.getMonth() + 1, 2);
    YYh = pad(nd.getFullYear(), 4).substring(2,4);
    oobs.value=DDh+MMh+YYh;
  }
  else // Se deixou o campo em branco
  {
    if (document.getElementById(parseInt(oobs.id) - 1))
      if (document.getElementById(parseInt(oobs.id) - 1).className = "data")
      {
        if ((document.getElementById(parseInt(oobs.id) - 1).value.trim() != "")
        &&  (document.getElementById(parseInt(oobs.id) - 1).getAttribute('dt')=="1")
        &&  (parseInt(document.getElementById(parseInt(oobs.id) - 1).style.left) < parseInt (oobs.style.left)))
          oobs.value = document.getElementById(parseInt(oobs.id) - 1).value;
      }
  }
 }
 else
 {//hora
  var vl = oobs.value;
  if (vl=='') return true;
  HH = pad(vl.substring(0,2), 2);
  NN = pad(vl.substring(2,4), 2);
  var today = new Date();
  HHh = pad(today.getHours(), 2);
  NNh = pad(today.getMinutes(), 2);
  if (HH>23) HH='23';
  if (NN>59) NN='59';
  if ((HH=='00')&&(NN=='00')){oobs.value=HHh+NNh;execOnChange(oobs);return true;}
  oobs.value=HH+NN;
 }
 execOnChange(oobs);
 return true;
}
function ForceNextField() 
{
 var gk;
 gk = gw_key;
 gw_key = 0;
 i = obj.id;
 found = false;
 oldi = i;
 oldi ++;
 while (true)
 {
  i ++;
  if (oobj(i) != null) 
  {
   if ((oobj(i).accessKey == "") && (oobj(i).readOnly  == false))
   {
    if (oobj(i).getAttribute('origin') != null)
    {
     if (oobj(oobj(i).getAttribute('origin')).style.visibility == 'hidden')
     {
      found = false;
      continue;
     }
    }
    oobj(i).setAttribute('autoComplete', 'OFF');
    oobj(i).focus();
    oobj(i).select();
    oobj(i).setAttribute('autoComplete', 'ON');
    found = true;
    break;
   }
  }
  else
   break;
 }
 if (found == false)
 {
  if (oobj(oldi) != null) 
  {
   oobj(oldi).focus();
   if (oobj(oldi).accessKey == "") 
    oobj(oldi).select();  
  }
 }
}
function NextField() 
{
 var gk;
 gk = gw_key;
 gw_key = 0;
 if (window.getSelection) 
 {
  if (txt != "") 
  { 
   txt=""; 
   return false;
  } 
  txt="";
 }
 if (document.selection) 
 {
  if (document.selection.createRange().text != "")
   return false;
 }
 if (gk == 0)
  return false;
 if (!obj) return;
 if (obj.value.length==obj.maxLength) 
 {
  i = obj.id;
  found = false;
  oldi = i;
  while (true)
  {
    if (oobj(parseInt(oldi)+1)==null) break;
    oldi ++;
    if (!oobj(oldi).readOnly) break;
  }
  while (true)
  {
   i ++;
   if (oobj(i) != null) 
   {
    if (((oobj(i).accessKey == "") && (oobj(i).readOnly  == false)) || (oobj(i).accessKey == "@I" ))
    {
     found = true;
     if (oobj(i).getAttribute('origin') != null)
     {
      if (oobj(oobj(i).getAttribute('origin')).style.visibility == 'hidden')
      {
       found = false;
       continue;
      }
     }
     try {oobj(i).setAttribute('autoComplete', 'OFF');}catch(error){};
     oobj(i).focus();
     try {oobj(i).select();}catch(error){};
     try {oobj(i).setAttribute('autoComplete', 'ON');}catch(error){};
     found = true;
     break;
    }
   }
   else
    break;
  }
  if (found == false)
  {
   if (oobj(oldi).readOnly) oldi=obj.id;
   if (oobj(oldi) != null) 
   {
    try {oobj(oldi).focus(); } catch(error){};
    try {
     if (oobj(oldi).accessKey == "") 
      oobj(oldi).select();
    } catch(error){};
   }
  }
 }
}
//===
function kp(e) 
{
 var key;
 var keyc;
 var i;
 if (navigator.appName == "Netscape")
  key = e.which;
 else
  key = event.keyCode;
 i = objmais;
 if (!obj) return;
 m = false;
 if (oobj("errormsg").style.visibility == 'visible')
 {
  m = true;
  if (key == 27)
  {
   showmsgonclick();
   return false;
  }
  var iL = document.getElementsByTagName("A").length;
  for (asl=0; asl<iL; asl++){
   iff = document.getElementsByTagName("A")[asl];
   if ((iff.getAttribute("ak")!=null) && (iff.getAttribute("ak")==chr(key)))
   {
    iff.focus();
    iff.onclick();
    return false;
   }
  }
 }
 if (key == 13)
 {
  activeObject = obj.id;
  if (!oobj(activeObject)) return true;
  if (oobj(activeObject).href)
   return true;
  if (obj.id == "nokey")
   return;

  if (obj.getAttribute("lkp")=="1")
//   if (((!oobj("poplkp"))||((oobj("poplkp"))&&(oobj("poplkp").style.visibility=="hidden")))&&(obj.value.trim()!=""))
   if ((obj.value.trim()!="") || (oobj("poplkp") && oobj("poplkp").style.visibility=="visible"))
    return true;

  i  = obj.id;
  var l=i;
  found = false;
  while (true)
  {
   i ++;
   if (oobj(i) != null)
   {
    if (oobj(i).accessKey == "")
    {/*Input*/
     if (oobj(i).readOnly == false)
     {
      if (oobj(i).getAttribute('origin') != null)
      {
       if (oobj(oobj(i).getAttribute('origin')).style.visibility == 'hidden')
       {
        found = false;
        continue;
       }
      }
      try
      {
       if (l==i){if (oobj(i).getAttribute('dt')=="1") doDateTime(e);}
       oobj(i).setAttribute('autoComplete', 'OFF');
       oobj(i).focus();
       oobj(i).select();
       oobj(i).setAttribute('autoComplete', 'ON');
       found = true;
      }
      catch (error)
      {
       found = false;
      }
     }
    }
   }
   else
   {
    if (m)
     i = dialogid - 1;//p voltar p o menor id
    else
     i = 0;
   }
   if (found)
   {
    txt ="$";
    break;
   }
  }
  return false;
 }
 if (key == 43)
 {
  while (true)
  {
   if (oobj(i) != null)
   {
    if (oobj(i).accessKey != "")
    {
     clearSelection();
     oobj(i).focus();
     break;
    }
    i++;
   }
   else
    break;
  }
  return false;
 }
 else
 {
  gw_key = key;
 }
}
function ccx()
{
 if (document.getElementsByTagName("closex")[0])
  eval(document.getElementsByTagName("closex")[0].getAttribute("cmd"));
}
function kd(e) {
 var key;
 var keyc;
 var i;
 if (navigator.appName == "Netscape")
  key = e.which;
 else
  key = event.keyCode;
 if (!obj) return;
  if (oobj("nokey") != null)
   if (obj.id == "nokey")
    return;
 i = 1;
 m = false;

 if (oobj("poplkp"))
 {
  if (oobj("poplkp").style.visibility=="visible")
  {
   if ((key==38)||(key==33)) // Para Cima
   {
    var loop=1;
    if (key==33){loop=lkpdropdown-1;}
    for (l=1;l<=loop;l++)
    {
     lkpid--;
     if ((key==33) && (lkpid<0)) lkpid=0;
     if (lkpid<-1)
     {
      lkpid = totlkp-1;
      itlkpf = totlkp;
      if (itlkpf-lkpdropdown>0) itlkpi=itlkpf-lkpdropdown; else itlkpi=0;
     }
     else
      if ((lkpid<itlkpi) && (lkpid>-1))
      {
       itlkpi--;
       itlkpf--;
      }
    }
    printlkp();
    return false;
   }
   if (key==27)
   {
    obj.value=strlkp;
    blurlkp();
    return false;
   }

   if ((key==40)||(key==34)) // Para Baixo
   {
    var loop=1;
    if (key==34){loop=lkpdropdown-1;}
    for (l=1;l<=loop;l++)
    {
     lkpid++;
     if ((key==34) && (lkpid>=totlkp))
       lkpid=totlkp-1;
     if (lkpid>=totlkp)
     {
      lkpid=-1;
      itlkpi = 0;
      if (totlkp>lkpdropdown) itlkpf=lkpdropdown;else itlkpf=totlkp;
     }
     else
      if (lkpid>=itlkpf)
      {
       itlkpi++;
       itlkpf++;
      }
    }
    printlkp();
    return false;
   }
  }
 }

 if (oobj("errormsg").style.visibility == 'visible') {
  m = true;
  if (key == 27) {
   ccx();
   showmsgonclick();
   return false;
  }
 }
 if (key == 93)
 {
  alert(obj.id);
 }
 // F1
 if (key == 112)
 {
  showhelp(1, "/ajuda/" + help_file);
  return false;
 }
 if ((key == 27) && (oobj("menu01") == null))
 {
  btnClose();
  return false;
 }
 // Para Cima
 if (key == 38)
 {
  if (obj)
  i = obj.id;
  found = false;
  while (true)
  {
   i --;
   if (oobj(i) != null)
   {
    if (oobj(i).accessKey == "")
    {/*Input*/
     if (oobj(i).readOnly == false)
     {
      if (oobj(i).getAttribute('origin') != null)
      {
       if (oobj(oobj(i).getAttribute('origin')).style.visibility == 'hidden')
       {
        found = false;
        continue;
       }
      }
      try
      {
       oobj(i).setAttribute('autoComplete', 'OFF');
       oobj(i).focus();
       oobj(i).select();
       oobj(i).setAttribute('autoComplete', 'ON');
       found = true;
      }
      catch (error)
      {
       found = false;
      }
     }
    }
    else
    {/*Link*/
     if ((oobj(i).className != "disalnk") && (oobj(i).className != "nodata2") && (oobj(i).innerHTML != ""))
     {
      try
      {
       found = true;
       /*origin contem o nome do <div> do grupo dos menus  */
       /*Assim, se o <div> estiver invisivel, procura o proximo*/
       /*que esteja visivel para dar o foco.*/
       if (oobj(i).getAttribute('origin') != null)
       {
        if (oobj(oobj(i).getAttribute('origin')).style.visibility == 'hidden')
        {
         found = false;
         continue;
        }
       }
       clearSelection();
       oobj(i).focus();
      }
      catch (error)
      {
       found = false;
      }
     }
    }
   }
   else
   {
    if (m)
    {
     i = 1;//p voltar p o 0
    }
    else
    {
     i = 1;
     while (oobj(i) != null)
     {
      i++;
     }
     total_accept = i;
     i = total_accept;
    }
   }
   if (found)
   {
    txt ="$";
    break;
   }
  }
  return false;
 }
 // Para Baixo
 if (key == 40)
 {
  i = obj.id;
  found = false;
  while (true)
  {
   i ++;
   if ((oobj(i)!=null) && !(m && (i>=1)) )
   {
    if (oobj(i).accessKey == "")
    {/*Input*/
     if (oobj(i).readOnly == false)
     {
      if (oobj(i).getAttribute('origin') != null)
      {
       if (oobj(oobj(i).getAttribute('origin')).style.visibility == 'hidden')
       {
        found = false;
        continue;
       }
      }
      try
      {
       found = true;
       oobj(i).setAttribute('autoComplete', 'OFF');
       oobj(i).focus();
       oobj(i).select();
       oobj(i).setAttribute('autoComplete', 'ON');
      }
      catch (error)
      {
       found = false;
      }
     }
    }
    else
    {/*Link*/
     if ((oobj(i).className != "disalnk") && (oobj(i).className != "nodata2") && (oobj(i).innerHTML != ""))
     {
      try
      {
       found = true;
       if (oobj(i).getAttribute('origin') != null)
       {
        if (oobj(oobj(i).getAttribute('origin')).style.visibility == 'hidden')
        {
         found = false;
         continue;
        }
       }
       clearSelection();
       oobj(i).focus();
      }
      catch (error)
      {
       found = false;
      }
     }
    }
   }
   else
   {
    if (m)
    {
     i = dialogid - 1;//p voltar p o menor id
    }
    else
    {
     i = -2;
     if (oobj(i + 1) == null)
     {
      i = -1;
      if (oobj(i + 1) == null)
      i = 0;
     }
    }
   }
   if (found)
   {
    txt ="$";
    break;
   }
  }
  return false;
 }
}
function showhide(objname)
{
 if (oobj(objname).style.visibility == "visible")
  oobj(objname).style.visibility = "hidden";
 else
  oobj(objname).style.visibility = "visible";
}
function changecss(theClass,element,value) 
{
 var cssRules;
 if (document.all) {
  cssRules = 'rules';
 }
 else if (oobj) {
  cssRules = 'cssRules';
 }
 for (var S = 0; S < document.styleSheets.length; S++){
  for (var R = 0; R < document.styleSheets[S][cssRules].length; R++) {
   if (document.styleSheets[S][cssRules][R].selectorText == theClass) {
    document.styleSheets[S][cssRules][R].style[element] = value;
   }
  }
 }
}
function roll(imgObj, imgName,a)
{
 if (a == 1) {imgState="/images/" + imgName  + "_b.gif";}
 else
 { 
  if (imgName == "envelopea")
   imgState="/images/" + imgName + ".gif";
  else
   imgState="/images/" + imgName + ".png";
 }
 oobj(imgObj).src = imgState;
}
function canFocus(){if (oobj("errormsg").style.visibility == 'visible'){
try {oobj(dialogid).focus();}catch(error){}try {oobj(dialogid).select();}catch(error){}return false}return true}
function setobjA(event){
if (!canFocus()) return false;
if (clearS != 'N')
clearSelection();
clearS = '';
if (oobj("parc"))
 if ((oobj("parc").style.visibility == "visible") || (oobj("desbloq").style.visibility == "visible"))
 {
  if ((parseInt(obj.id) < IDX_FRETE_PESO) || (parseInt(obj.id) > (IDX_FEC_PARC)))
  {
   oobj(IDX_CAT).focus();
   try {oobj(IDX_CAT).select();} catch(error) {}
  }
 }
}
function setobj(event){
if (!canFocus()) return false;
if (event == null) event = window.event;
var edit = (event.srcElement) ? event.srcElement : event.originalTarget;
obj=edit;
if ((edit.className == "") || (edit.className == "data")) edit.style.background = 'rgb(255,255,196)';
}
function sswblur(event){
if (event == null) event = window.event;
var edit = (event.srcElement) ? event.srcElement : event.originalTarget;
if ((edit.className == "") || (edit.className == "data")){edit.style.background = 'white';}
}
function doinputs()
{
 try
 {
  var inputsLength = document.getElementsByTagName("INPUT").length;
  for (asi=0; asi<inputsLength; asi++){
   inputform = document.getElementsByTagName("INPUT")[asi];
   var num = inputform.getAttribute('num');
   var dt = inputform.getAttribute('dt');
   var lk = inputform.getAttribute('lkp');
   if(inputform.addEventListener){
    inputform.addEventListener("focus", setobj, false);
    inputform.addEventListener("blur", sswblur, false);
    inputform.addEventListener("keyup", NextField, false);
    if (num == "1") inputform.onkeypress = onlynum;
    if (lk == "1") 
    { 
     //inputform.onkeydown = cidtrick;
     inputform.addEventListener("blur", blurlkp, false);
     inputform.addEventListener("keydown", doTrick, false);
    }
    if (dt == "1") inputform.addEventListener("blur", doDateTime, false);
   }
   else if (inputform.attachEvent){
    inputform.attachEvent("onfocus", setobj);
    inputform.attachEvent("onblur", sswblur);
    inputform.attachEvent("onkeyup", NextField);
    if (num == "1") inputform.onkeypress = onlynum;

    if (lk== "1")
    {
     //inputform.onkeydown = cidtrick;
     inputform.attachEvent("onblur", blurlkp);
     inputform.attachEvent("onkeydown", doTrick);
    }
    if (dt == "1") inputform.attachEvent("onblur", doDateTime);
   }
  }
  var inputsLength = document.getElementsByTagName("A").length;
  for (asi=0; asi<inputsLength; asi++){
   inputform = document.getElementsByTagName("A")[asi];
   if (inputform.className != "dialog")
   {
    if(inputform.addEventListener){
     inputform.addEventListener("focus", setobjA, false);
    }
    else if (inputform.attachEvent){
     inputform.attachEvent("onfocus", setobjA);
    }
   }
  }
 } catch (error){}
 if (oobj("errormsg"))
  if (oobj("errormsg").style.visibility == 'visible')
   return;
 try
 {
  clearSelection();
  if (oobj(objfocus)){
   clearS = 'N';
   try {
    oobj(objfocus).focus();
    obj = oobj(objfocus);
   }catch (error) { }
   if (oobj(objfocus).type=="text")
   {
    try {
     setTimeout('oobj(objfocus).select()', 50);
    }catch (error) { }
   }
  }
 }
 catch (error){};
}
String.prototype.trim = function() {return this.replace(/^\s*/, "").replace(/\s*$/, "");}
document.onmouseover=hidestatus;
document.onmouseout=hidestatus;
document.onmousedown=alertas;
document.onkeydown=kd; 
document.onkeypress=kp; 

if (window.addEventListener){
 window.addEventListener("load", CEC_autoInit, false);
 window.addEventListener("load", doinputs, false);
 window.addEventListener("resize", CEC_onWindowResize, false);
 window.addEventListener("unload", SSWUnload, false);
 window.addEventListener("scroll", scrollme, false);
 window.addEventListener("resize", resizeme, false);
}
else if (window.attachEvent){
 window.attachEvent("onload", doinputs);
 window.attachEvent("onload", CEC_autoInit);
 window.attachEvent("onresize", CEC_onWindowResize);
 window.attachEvent("onunload", SSWUnload);
 window.attachEvent("onscroll", scrollme);
 window.attachEvent("onresize", resizeme);
}

var ajaxGeral = null
var strparam = ""
var newDoc = null
var valSep = null
var newPage = null
var parameters = null
var clicktime = null
var saveobjmais=null
var saveobjfocus=null
var active = false;
var msgaguarde = "";
var dragapproved=false;
var zcor,xcor,ycor;
var ie=document.all&&navigator.userAgent.indexOf("Opera")==-1;

try {var ajaxGeral = new XMLHttpRequest();} catch (error) {
try {var ajaxGeral = new ActiveXObject("MSXML2.XMLHTTP");} catch (error) {
try {var ajaxGeral = new ActiveXObject("Microsoft.XMLHTTP");} catch (error) { } } }
try{var reqm = new XMLHttpRequest();}catch (error){try{var reqm = new ActiveXObject("Microsoft.XMLHTTP");}catch (error){}}
regAjaxObj(reqm);

function clearSelection () 
{
 if (document.selection)
  document.selection.empty();
 else 
  if (window.getSelection)
 window.getSelection().removeAllRanges();
}
function createNewDoc()
{
 var today = new Date();
 if (newPage == 1)
 {
  str = "";
  tagname = today.getHours() + today.getMinutes() + today.getSeconds();
  var winX = ie?window.screenLeft:window.screenX;
  var winY = ie?window.screenTop:window.screenY;
  var winW = ie?document.body.clientWidth:document.body.clientWidth;
  var winH = ie?document.body.clientHeight:document.body.clientHeight;
  fullscreenX = winW - screen.availWidth;
  if (fullscreenX < 0) fullscreenX *= - 1;
  if (fullscreenX < 50) fullscreenX=1; else fullscreenX=0;
  if (fullscreenX==1)
  {
   janela=window.open("", tagname, "fullscreen=0,menubar=0,location=0,toolbar=0," +
          "status=1,scrollbars=1,resizable=1,width=" + (screen.availWidth-10) +
          ",height=" + (screen.availHeight-10) + ",top=0,left=0");
   janela.resizeTo(screen.availWidth,screen.availHeight);
  }
  else
  {
   janela=window.open("", tagname, "fullscreen=0,menubar=0,location=0,toolbar=0," +
          "status=1,scrollbars=1,resizable=1,width=" + winW +
          ",height=" + winH + ",top=" + winY + ",left=" + winX);
   if (ie) {
    janela.resizeTo(winW, winH);
    janela.moveTo(winX, winY);
   }
   else
   {
    janela.outerHeight = window.outerHeight
    janela.outerWidth = window.outerWidth;
   }
   if (ie) {
    // ajusta o X,Y,W,H de acordo com o offset das 2 janelas
    offX1 = ie?window.screenLeft:window.screenX;
    offX2 = ie?janela.screenLeft:janela.screenX;
    offY1 = ie?window.screenTop:window.screenY;
    offY2 = ie?janela.screenTop:janela.screenY;
    janela.moveTo(winX + (offX1 - offX2), winY + (offY1 - offY2));
    offX1 = ie?document.body.clientWidth : document.body.clientWidth;
    offX2 = ie?janela.document.body.clientWidth : janela.document.body.clientWidth;
    offY1 = ie?document.body.clientHeight : document.body.clientHeight;
    offY2 = ie?janela.document.body.clientHeight : janela.document.body.clientHeight;
    janela.resizeTo(winW + (offX1 - offX2), winH + (offY1 - offY2));
   }
   else if (document.layers||oobj) 
   { }
  }
  if (!window.ActiveXObject)
  {
   janela.document.open("text/html", "replace");
   janela.document.write (valSep.toString());
   janela.document.close();
  }
  else
  {
   janela.document.open("text/html", "replace");
   janela.document.write (valSep.toString());
   janela.document.close();
  }
 }
 else
 {
  var newDoc = document.open("text/html", "replace");
  newDoc.write (valSep.toString());
  newDoc.close();
 }
}
function executa(cmd){cmd = cmd.replace(/opener./g, "");setTimeout(cmd, 250);}
function stateGeral() 
{
 if (ajaxGeral.readyState == 4) 
 {
  try {
   clearInterval(timeoutinterval);}
   catch(e) {};
  ajaxst = ajaxGeral.status;
  if (ajaxst == 200)
  {
   active = false;
   if (oobj("debug"))
    alert(ajaxGeral.responseText);
   hideWaitIcon();
   var str = ajaxGeral.responseText;
   if ((str.charAt(4) == "h") && (str.charAt(5) == "t") && (str.charAt(6) == "m") && (str.charAt(7) == "l"))
   {
    if (str.toString().split("name=newPage").length > 1) newPage = 1;
    valSep = str.toString();
    ajaxGeral.abort();
    setTimeout('createNewDoc()', 50);
    return false;
   }
   else
   {
    var valBack  = str.toString().split("<!--GoBack-->");
    var valClose = str.toString().split("<!--CloseMe-->");
    ajaxGeral.abort();
    if (valBack.length > 1)
    {
     if (!window.ActiveXObject){
      var inputsLength = document.getElementsByTagName("INPUT").length;
      for (i=0; i<inputsLength; i++){
       if (document.getElementsByTagName("INPUT")[i].type.toUpperCase() == "FILE")
        document.getElementsByTagName("INPUT")[i].type = "text";}
     }
     try
     {
      var valExec = valBack[0].toString().split("web_body");
      if (valExec.length > 1)
      {
       // cria as novas hiddens para poder pegar a hidden=web_body 
       // (e nao pode ter igual no meio dele)
       showmsg(valBack[0]);
       var tudoact = valBack[0];
       //executa o onload
       strexec = unescape(oobj("web_body").value);
       if (oobj("newFormAction"))
        setTimeout('ajaxEnvia("",0, "", oobj("newFormAction").value)', 50); //xuxu 1000
       else
        setTimeout('ajaxEnvia("",0)', 50);
       return false;
      }
     }
     catch (error)
     {}
     showmsg(valBack[0]);
     ajaxEnvia("",0);
     return false;
    }
    if ((valClose.length > 1) && (newPage != 1))
    {
     try
     {
      try
      {
       var valExec = valClose[0].toString().split("web_body");
       if (valExec.length > 1)
       {
        // cria as novas hiddens
        oobj("errorpanel").innerHTML = valClose[0];
        //executa o onload
        opener.executa(unescape(oobj("web_body").value));
        var newHTML = unescape(valClose[1]);
        opener.showmsg(newHTML);
        setTimeout('window.close();', 50);
        return false;
       }
      }
      catch (error)
      {}
      var newHTML = unescape(valClose[1]);
      opener.showmsg(newHTML);
      window.close();
      return false;
     }
     catch (error) 
     {
      // nao existe mais a janela pai. entao temo mesmo efeito de e_mensagem('', 4)
      showmsg(valClose[0]);
      if (oobj("menu01") != null)
       ajaxEnvia("",0,"ssw0422")
      else
       ajaxEnvia("",0);
      return false;
     }
    }
    if (valClose.length > 1)
    {
     //eh close mas nao deveria, executa como um normal
     try
     {
      var valExec = valClose[0].toString().split("web_body");
      if (valExec.length > 1)
      {
       // cria as novas hiddens
       alert('TO DO:"');
       oobj("errorpanel").innerHTML = valClose[0];
       strexec = unescape(oobj("web_body").value);
       eval(strexec);
       setTimeout('try{oobj("web_body").value = ""}catch(error){}', 50);
      }
     }
     catch (error)
     {}
     var newHTML = unescape(valClose[1]);
     showmsg(newHTML);
    }
    else
    {
     // e_mensagem normal
     try
     {
      var valExec = str.toString().split("web_body");
      if (valExec.length > 1)
      {
       strexec = "";
       if (oobj("menu01") != null)
       {
        try {oobj(3).focus();}catch(error){}
        try {oobj(3).select();}catch(error){}
       }
       // cria as novas hiddens para poder pegar a hidden=web_body 
       // (e nao pode ter igual no meio dele)
       showmsg(str);
       if (oobj("debug"))
        alert(unescape(oobj("web_body").value));
       //executa o onload
       strexec = unescape(oobj("web_body").value);
       clearS = 'N';
       eval(strexec);
       setTimeout('try{oobj("web_body").value = ""}catch(error){}', 50);
       return false;
      }
     }
     catch (error) {}
     showmsg(unescape(str));
    }
   }
  }
  else 
  {
   active = false;
   if (ajaxst != 0)
   {
    hideWaitIcon();
    showmsg(" ERRO AO PROCESSAR REQUISICAO. #" + ajaxst);
    ajaxGeral.abort();
   }
   return false;
  }
  ajaxGeral.abort();
 }
 return true;
}
// apos o upload do arquivo, faz o envio normal
function enviapai()
{
 clearSelection();
 ajaxGeral.abort();
 ajaxGeral.onreadystatechange = stateGeral;
 /*Para poder usar o metodo POST eh necessario o RequestHeader*/
 mypost = parameters.toString().split("?");
 ajaxGeral.open("POST", mypost[0], true);
 ajaxGeral.setRequestHeader('Content-type', 'application/x-www-form-urlencoded');
 ajaxGeral.send(mypost[1]);
 return true;
}
function addPoint(parame)
{
 if (parame == true)
  active = true;
 if (active)
 {
  if (ajaxGeral.readyState == 1) str = "Processando";
  else {
   if (ajaxGeral.readyState == 2) str = "Recebendo";
   else {
    if (ajaxGeral.readyState == 3) str = "Recebendo";
    else str = "Aguarde";
   }
  }
  if (msgaguarde == str + ' ...') msgaguarde = str; else
  {
   if (msgaguarde == str + ' ..') msgaguarde = str + ' ...'; else
   {
    if (msgaguarde == str + ' .') msgaguarde = str + ' ..'; else
    {
     if (msgaguarde == str) msgaguarde = str + ' .'; else 
     {
      msgaguarde = str;
     }
    }
   }
  }
  if (oobj("procimg").style.visibility != 'visible')
  {
   oobj("errorpanel").style.visibility='visible';
   oobj("errorpanel").style.width  = '100%';
   oobj("errorpanel").style.height = '48px';
   oobj("procimg").style.visibility='visible';
  }
  setTimeout('addPoint()', 250);
 }
}
function readCookie(name) {
 var nameEQ = name + "=";
 var ca = document.cookie.split(';');
 for(var i=0;i < ca.length;i++) {
  var c = ca[i];
  while (c.charAt(0)==' ') c = c.substring(1,c.length);
  if (c.indexOf(nameEQ) == 0){
   value = c.substring(nameEQ.length,c.length);
   value = value.replace(/%2E/g, ".");
   value = value.replace("+++", "");
   return value;
  }
 }
 return null;
}
function abreCTRC(p_seq_ctrc){ajaxEnvia ('',1,'ssw0053?act=' + p_seq_ctrc);}
function documento(nro_documento){ajaxEnvia ('',0,'ssw0673?act=' + nro_documento);}
function ajaxEnvia(valor, newp, newparameters, newFormAction)
{
 newPage = newp;
 bupload = false;
 str = "";
 if (ajaxGeral != null && ajaxGeral.readyState != 0 && ajaxGeral.readyState != 4) 
 {
  newtime = new Date();
  var sec = Math.ceil((newtime.getTime() - clicktime.getTime()) / (1000))
  if (sec >= 30)
  {
   active = false;
   ajaxGeral.abort();
  }
  else
  {
   alert("Ja existe uma requisicao em andamento.");
   return false;
  }
 }
 clicktime = new Date();
 ajaxGeral.onreadystatechange = stateGeral;
 if (newFormAction != null)
  parameters =  "/bin/" + newFormAction
 else
  parameters =  document.frm.action;
 if ((newparameters != null) && (newparameters != ""))
 {
  if (newparameters.length <= 9)
   parameters = "/bin/" + newparameters + "?dummy=" + new Date().getTime()
  else
   parameters = '/bin/' + newparameters + "&dummy=" + new Date().getTime();
  parameters = parameters.replace("%3D","=");
  parameters = parameters.replace(/%3D/g,"=");
 }
 else
 {
  parameters = parameters + "?act=" + valor;
  var inputsLength = document.getElementsByTagName("TEXTAREA").length;
  for (i=0; i<inputsLength; i++){
   if (document.getElementsByTagName("TEXTAREA")[i].value != "")
   {
    var til = document.getElementsByTagName("TEXTAREA")[i].value;
     parameters = parameters + "&" + document.getElementsByTagName("TEXTAREA")[i].name
                + "=" + escape(til);
   }
  }
  var inputsLength = document.getElementsByTagName("INPUT").length;
  for (i=0; i<inputsLength; i++){
   if (document.getElementsByTagName("INPUT")[i].type.toUpperCase() == "TEXT")
   {
    if (document.getElementsByTagName("INPUT")[i].value != "")
    {
     if (document.getElementsByTagName("INPUT")[i].name.toUpperCase() != "SR_ACC")
     {
      var ovalue = document.getElementsByTagName("INPUT")[i].value;
      parameters = parameters + "&" + document.getElementsByTagName("INPUT")[i].name
                + "=" + escape(ovalue);
     }
    }
   }
   if (document.getElementsByTagName("INPUT")[i].type.toUpperCase() == "PASSWORD")
   {
    if (document.getElementsByTagName("INPUT")[i].value != "")
    {
     parameters = parameters + "&" + document.getElementsByTagName("INPUT")[i].name
               + "=" + document.getElementsByTagName("INPUT")[i].value;
    }
   }
   if (document.getElementsByTagName("INPUT")[i].type.toUpperCase() == "HIDDEN")
   {// so insere o act que estava como hidden se o atual for vazio
    if ((document.getElementsByTagName("INPUT")[i].name != "act") ||
       ((document.getElementsByTagName("INPUT")[i].name == "act") &&
        (document.getElementsByTagName("INPUT")[i].value != "") && 
        (valor == "")))
    {
     var ovalue = document.getElementsByTagName("INPUT")[i].value;
     parameters = parameters + "&" + document.getElementsByTagName("INPUT")[i].name
                + "=" + ovalue;
    }
   }
   if (document.getElementsByTagName("INPUT")[i].type.toUpperCase() == "FILE")
   {
    bupload = true;
    var fileid = i;
    var ovalue = document.getElementsByTagName("INPUT")[i].value;
    parameters = parameters + "&" + document.getElementsByTagName("INPUT")[i].name
               + "=" + escape(ovalue);
   }
  }
  parameters = parameters + "&dummy=" + new Date().getTime();
 }
 if (str == "")
 {
  showWaitIcon();
 }
 if (oobj("debug"))
  alert(parameters);
 if (bupload == true)
 {
  var oldactrion = oobj('frm').getAttribute('action');
  oobj('frm').setAttribute('action', '/bin/ssw0475');
  oobj('frm').submit();
  oobj('frm').setAttribute('action', oldactrion);
  return false;
 }
 else
 {
  //clearSelection();
  /*Para poder usar o metodo POST eh necessario o RequestHeader*/
  mypost = parameters.toString().split("?");
  timeoutinterval=setInterval("checktimeout()", 3000);
  ajaxGeral.open("POST", mypost[0], true);
  ajaxGeral.setRequestHeader('Content-type', 'application/x-www-form-urlencoded');
  ajaxGeral.send(mypost[1]);
 }
 return true;
}
function repeat (string, i)
{
 if (i == 0) return "";
 else
 {
  while (true)
  {
   i--;
   if (i == 0) return string;
   string += string;
}}}
// Volta para o inicio da opcao
function BackToBegin ()
{
 who = 0;
 daddy = this.opener;
 while (daddy)
 {
  try {daddy = daddy.opener;} catch (error) {ajaxEnvia ('', 0); return true;}
  who ++;
 }
 // OK... Agora temos o nivel genealogico da janela atual na variavel 'who',
 // portanto enquanto subtraimos a variavel 1 a 1, vamos fechando os pais...
 if (who == 4)
 {
  opener.opener.opener.ajaxEnvia ('', 0); // Reseta a 1a janela
  opener.opener.window.close(); // Fecha o avo
  opener.window.close(); // Fecha o pai
  window.close(); // Fecha a janela atual
 }
 if (who == 3)
 {
  opener.opener.ajaxEnvia ('', 0); // Reseta a 1a janela
  opener.window.close(); // Fecha o pai
  window.close(); // Fecha a janela atual
 }
 if (who == 2)
 {
  opener.ajaxEnvia ('', 0); // Reseta a 1a janela
  window.close(); // Fecha a janela atual
 }
 if (who == 1)
  ajaxEnvia ('', 0); // Reseta a 1a janela
}
// Volta para o Menu Principal
function BackToMenu ()
{
 who = 0;
 daddy = this.opener;
 while (daddy)
 {
  try {daddy = daddy.opener;} catch (error) {ajaxEnvia ('', 0); return true;}
  who ++;
 }
 // OK... Agora temos o nivel genealogico da janela atual na variavel 'who',
 // portanto enquanto subtraimos a variavel 1 a 1, vamos fechando os pais...
 if (who == 4)
 {
  opener.opener.opener.window.close(); // Reseta a 1a janela
  opener.opener.window.close(); // Fecha o avo
  opener.window.close(); // Fecha o pai
  window.close(); // Fecha a janela atual
 }
 if (who == 3)
 {
  opener.opener.window.close(); // Reseta a 1a janela
  opener.window.close(); // Fecha o pai
  window.close(); // Fecha a janela atual
 }
 if (who == 2)
 {
  opener.window.close(); // Reseta a 1a janela
  window.close(); // Fecha a janela atual
 }
 if (who == 1)
  window.close(); // Reseta a 1a janela
}
// Envia somente o que estiver como hidden
function ajaxEnviah(valor, newp, newparameters, newFormAction)
{
 newPage = newp;
 if (ajaxGeral != null && ajaxGeral.readyState != 0 && ajaxGeral.readyState != 4) 
 {
  alert("Ja existe uma requisicao em andamento.");
  return false;
 }
 ajaxGeral.onreadystatechange = stateGeral;
 if (oobj('answerto'))
  newFormAction = oobj('answerto').value;
 if (newFormAction != null)
  parameters =  "./" + newFormAction
 else
  parameters =  document.frm.action;
 if ((newparameters != null) && (newparameters != ""))
 {
  if (newparameters.length <= 9)
   parameters = "./" + newparameters + "?dummy=" + new Date().getTime()
  else
   parameters = './' + newparameters + "&dummy=" + new Date().getTime();
 }
 else
 {
  parameters = parameters + "?act=" + valor;
  var inputsLength = document.getElementsByTagName("INPUT").length;
  for (i=0; i<inputsLength; i++){
   if (document.getElementsByTagName("INPUT")[i].type.toUpperCase() == "HIDDEN")
   {
    if (document.getElementsByTagName("INPUT")[i].name != "act")
    {
     parameters = parameters + "&" + document.getElementsByTagName("INPUT")[i].name
                + "=" + document.getElementsByTagName("INPUT")[i].value;
    }
   }
  }
  parameters = parameters + "&dummy=" + new Date().getTime();
 }
 showWaitIcon();
 if (oobj("debug"))
  alert(parameters);
 /*Para poder usar o metodo POST eh necessario o RequestHeader*/
 mypost = parameters.toString().split("?");
 ajaxGeral.open("POST", mypost[0], true);
 ajaxGeral.setRequestHeader('Content-type', 'application/x-www-form-urlencoded');
 ajaxGeral.send(mypost[1]);
 return true;
}
function showmsgclear(){if (saveobjmais != null) objmais = saveobjmais;}
function showmsgonclick()
{
 oobj("errormsg").innerHTML = "";
 oobj('errorpanel').style.visibility='hidden';
 oobj('errormsg').style.visibility='hidden';
 oobj('errorpanel').style.width='10px';
 oobj('errorpanel').style.height='10px';
 showmsgclear();
 setTimeout('try{oobj('+saveobjfocus+').focus();oobj('+saveobjfocus+').select();}catch(error){}', 50);
 saveobjfocus = null;
}
function mailsup(body)
{
 if (reqm != null && reqm.readyState != 0 && reqm.readyState != 4){reqm.abort();}
 var tudo="";
 var inputsLength = document.getElementsByTagName("TEXTAREA").length;
 for (i=0; i<inputsLength; i++){
  if (document.getElementsByTagName("TEXTAREA")[i].value != "")
  {
   var til = document.getElementsByTagName("TEXTAREA")[i].value;
   tudo = tudo + "<br>" + document.getElementsByTagName("TEXTAREA")[i].name + "=" + til;
  }
 }
 var inputsLength = document.getElementsByTagName("INPUT").length;
 for (i=0; i<inputsLength; i++){
  if (document.getElementsByTagName("INPUT")[i].type.toUpperCase() == "TEXT")
  {
   if (document.getElementsByTagName("INPUT")[i].value != "")
   {
    if (document.getElementsByTagName("INPUT")[i].name.toUpperCase() != "SR_ACC")
    {
     var ovalue = document.getElementsByTagName("INPUT")[i].value;
     tudo = tudo + "<br>" + document.getElementsByTagName("INPUT")[i].name + "=" + ovalue;
    }
   }
  }
  if (document.getElementsByTagName("INPUT")[i].type.toUpperCase() == "PASSWORD")
  {
   if (document.getElementsByTagName("INPUT")[i].value != "")
   {
    tudo = tudo + "<br>" + document.getElementsByTagName("INPUT")[i].name + "=" + document.getElementsByTagName("INPUT")[i].value;
   }
  }
  if (document.getElementsByTagName("INPUT")[i].type.toUpperCase() == "HIDDEN")
  {
   var ovalue = document.getElementsByTagName("INPUT")[i].value;
   tudo = tudo + "<br>" + document.getElementsByTagName("INPUT")[i].name + "=" + ovalue;
  }
  if (document.getElementsByTagName("INPUT")[i].type.toUpperCase() == "FILE")
  {
   bupload = true;
   var fileid = i;
   var ovalue = document.getElementsByTagName("INPUT")[i].value;
   tudo = tudo + "<br>" + document.getElementsByTagName("INPUT")[i].name + "=" + ovalue;
  }
 }
 reqm.open("POST", "/bin/ssw0674", false);
 reqm.setRequestHeader('Content-type', 'application/x-www-form-urlencoded');
 reqm.send("body="+body+"&tudo="+escape(tudo)+"&tit="+escape(oobj("tituloprog").innerHTML)+"&loc="+oobj("telaprog").innerHTML+"&dummy=" + new Date().getTime());
 alert('email enviado com sucesso.');
 return true;
}
function showmsg(msg, focuson)
{
 var berro=false;
 var dsoctop=ie? document.body.scrollTop : pageYOffset
 oobj("errorpanel").style.width  = '100%';
 oobj("errorpanel").style.height = '100%';
 oobj("errormsg").style.height = '152px';
 oobj("errormsg").style.width  = '400px';
 oobj("errormsg").style.left   = '185px';
 templeft=185;
 temptop=208;
 oobj("errormsg").style.top = (208 + dsoctop) + 'px';
 oobj("errormsg").innerHTML =
   '<div id="scontentbar" style="text-align:right;">' +
   '<label style="left:16px;top:6px;color:white;" class=texto>' +
   'SSW Web</label>' +
   '<a href=# onclick="ccx();showmsgonclick();return false;"' +
   ' style="position:relative;font-size:18px;color:white;text-decoration:none;" class=texto>&nbsp;<b>&#215;</b>&nbsp;</a>' +
   '</div>' +
   '<div class=texto id=errormsglabel style="color:red;left:16px;top:32px;text-align:left;overflow:visible"><b>' +
   msg + '</b></div>';
 var elmh = ElmHeight('errormsglabel');
 var elmw = ElmWidth('errormsglabel');
 if (document.all)
 {
  if ((oobj("errormsglabel").innerText.trim().toUpperCase().substring(0,8) == "ERRO INC") ||
     (oobj("errormsglabel").innerText.trim().toUpperCase().substring(0,8) == "ERRO ALT") ||
     (oobj("errormsglabel").innerText.trim().toUpperCase().substring(0,8) == "ERRO DEL") ||
     (oobj("errormsglabel").innerText.trim().toUpperCase().substring(0,8) == "ERRO EXC"))
    berro=true;
  if ((oobj("errormsglabel").innerText.trim() == ".") || (oobj("errormsglabel").innerText.trim() == ""))
  {
   showmsgclear();
   oobj('errorpanel').style.visibility='hidden';
   oobj('errormsg').style.visibility='hidden';
   oobj('errorpanel').style.width='10px';
   oobj('errorpanel').style.height='10px';
   return true;
  }
 }
 else
 {
  if ((oobj("errormsglabel").textContent.trim().toUpperCase().substring(0,8) == "ERRO INC") ||
     (oobj("errormsglabel").textContent.trim().toUpperCase().substring(0,8) == "ERRO ALT") ||
     (oobj("errormsglabel").textContent.trim().toUpperCase().substring(0,8) == "ERRO DEL") ||
     (oobj("errormsglabel").textContent.trim().toUpperCase().substring(0,8) == "ERRO EXC"))
    berro=true;
  if ((oobj("errormsglabel").textContent.trim() == ".") || (oobj("errormsglabel").textContent.trim() == ""))
  {
   showmsgclear();
   oobj('errorpanel').style.visibility='hidden';
   oobj('errormsg').style.visibility='hidden';
   oobj('errorpanel').style.width='10px';
   oobj('errorpanel').style.height='10px';
   return true;
  }
 }
 if (berro) { 
  oobj("errormsglabel").innerHTML += "<br><br><i>(Esta mensagem foi enviada ao suporte@ssw.inf.br)</i>";
  elmh = ElmHeight('errormsglabel');elmw = ElmWidth('errormsglabel');
 }
 //tem coisa pra mostra? mostra a msg agora
 oobj("errormsg").style.visibility = 'visible';
 oobj("errorpanel").style.visibility = 'visible';
 auxscripts = document.getElementsByTagName("btn");
 var myleft=16;
 var mytop= 64 + (elmh - 12);
 if (auxscripts.length == 0)
 { //sotem um botao
  saveobjmais = objmais;
  if (document.getElementsByTagName("foc").length > 0)
   saveobjfocus = document.getElementsByTagName("foc")[0].getAttribute("vl");
  else
  {
   // talvez seja uma boa. quando nao tiver foco definido na msg, vai voltar o foco no campo que estava
   // saveobjfocus = objfocus;
   if (focuson)
    saveobjfocus = focuson
   else
   {
    try {
     if (obj.id < 1)
      saveobjfocus = objfocus;
     else
      saveobjfocus = obj.id;
     } catch(error) { saveobjfocus = objfocus}
    }
   }
   var q = 0;
   if (!document.getElementsByTagName("foc")[0])
   {
    dialogid = 0;
    oobj("errormsg").innerHTML +=
     '<a id="0" onfocus="obj=this;" accesskey=& ak=7 class=dialog onclick="showmsgonclick();return false;' +
     '" style="top:'+mytop+'px;left:16px;" href=#>7. Continuar</a>';
    setTimeout('try{oobj(0).focus()}catch(error){}', 50);
   }
   else
   {
    if ((!document.getElementsByTagName("foc")[0]) || (document.getElementsByTagName("foc")[0].getAttribute("7") != "0")) q++;
    if ((!document.getElementsByTagName("foc")[0]) || (document.getElementsByTagName("foc")[0].getAttribute("8") == "1")) q++;
    if ((!document.getElementsByTagName("foc")[0]) || (document.getElementsByTagName("foc")[0].getAttribute("9") == "1")) q++;
    mytop -=16;
    objmais  = q;
    dialogid = -objmais+1;
    if ((!document.getElementsByTagName("foc")[0]) || (document.getElementsByTagName("foc")[0].getAttribute("7") != "0"))
    {
     q--;
     mytop+=16;
     oobj("errormsg").innerHTML +=
      '<a id="' + (-q) + '" onfocus="obj=this;" accesskey=& ak=7 class=dialog onclick="showmsgonclick();return false;' +
      '" style="top:' + mytop + 'px;left:16px;" href=#>7. Continuar</a>';
    }
    if ((!document.getElementsByTagName("foc")[0]) || (document.getElementsByTagName("foc")[0].getAttribute("8") == "1"))
    {
     q--;
     mytop+=16;
     oobj("errormsg").innerHTML +=
      '<a id="' + (-q) + '" onfocus="obj=this;" ak=8 accesskey=& class=dialog ' +
      'onclick="BackToBegin();return false;"' +
      ' style="top:'+mytop+'px;left:16px;" href=#>' +
      '8. ' + 'Reiniciar Op&ccedil;&atilde;o' + '</a>';
    }
    if ((!document.getElementsByTagName("foc")[0]) || (document.getElementsByTagName("foc")[0].getAttribute("9") == "1"))
    {
     q--;
     mytop+=16;
     oobj("errormsg").innerHTML +=
      '<a id="' + (-q) + '" onfocus="obj=this;" ak=9 accesskey=& class=dialog ' +
      'onclick="BackToMenu();return false;"' +
      ' style="top:'+mytop+'px;left:16px;" href=#>' +
      '9. ' + 'Menu Principal' + '</a>';
    }
    setTimeout('try{oobj('+(-objmais+1)+').focus()}catch(error){}', 50);
   }
  }
  else
  {
   saveobjmais = objmais;
   // pode ser 0 pq aki so entra qdo eh pergunta.
   if (focuson)
    saveobjfocus = focuson;
   else
   {
    try {
     if (obj.id < 1)
      saveobjfocus = objfocus;
     else
      saveobjfocus = obj.id;
     } catch(error) { saveobjfocus = objfocus}
   }
   var q = 0;
   if ((!document.getElementsByTagName("foc")[0]) || (document.getElementsByTagName("foc")[0].getAttribute("7") != "0")) q++;
   if ((!document.getElementsByTagName("foc")[0]) || (document.getElementsByTagName("foc")[0].getAttribute("8") == "1")) q++;
   if ((!document.getElementsByTagName("foc")[0]) || (document.getElementsByTagName("foc")[0].getAttribute("9") == "1")) q++;
   if (document.getElementsByTagName("foc")[0])
   {
    var hoffset=document.getElementsByTagName("foc")[0].getAttribute("ho");//horiz offset
    if (hoffset==undefined) hoffset=185;
    oobj("errormsg").style.left = hoffset + 'px';
    templeft=hoffset;
   }
   var cols=0;
   if (document.getElementsByTagName("foc")[0])
    cols=document.getElementsByTagName("foc")[0].getAttribute("col");
   // na pergunta o foco vai ser o mais tbem
   objmais = document.getElementsByTagName("foc")[0].getAttribute("vl");
   p=auxscripts.length;
   dialogid = (0-p-q+1);//para o kd:para baixo
   for (i=0;i<auxscripts.length;i++){
    if (auxscripts[i].getAttribute("vl")=="input")
    { // btn para enviar accepts 
     dialogid = -2;
     var si = false;
     oobj("errormsg").innerHTML +=
      '<a id="' + (0 - p - q + 1) + '" onfocus="obj=this;" accesskey="&" class=dialog ' +
      'onclick="showmsgclear();oobj(\''+document.getElementsByTagName("ret")[0].getAttribute("nm") +
      '\').value=oobj(\'-2\').value;ajaxEnviah(\''+
     document.getElementsByTagName("ret")[0].getAttribute("vl")+'\', 0);return false;"' +
      ' style="top:'+mytop+'px;left:16px;" href=#>' +
      '' + auxscripts[i].getAttribute("lb") + '</a>';
     p--;
     mytop+=16;
     if ((!document.getElementsByTagName("foc")[0]) || (document.getElementsByTagName("foc")[0].getAttribute("fec") != "0"))
      oobj("errormsg").innerHTML +=
       '<a id="' + (0 - p - q + 1) + '" onfocus="obj=this;" accesskey="&" class=dialog ' +
       'onclick="showmsgonclick();return false;"' +
       ' style="top:'+mytop+'px;left:16px;" href=#>' +
       '' + 'Continuar' + '</a>';
     mytop-=16;
    }
    else
    {
     var si = true;
     if (auxscripts[i].getAttribute("act") == null)
     {
      oobj("errormsg").innerHTML +=
       '<a id="' + (0 - p - q + 1) + '" onfocus="obj=this;" ak='+(i+1)+' accesskey="&" class=dialog ' +
       'onclick="showmsgclear();oobj(\''+document.getElementsByTagName("ret")[0].getAttribute("nm") +
       '\').value=\'' + auxscripts[i].getAttribute("vl") + '\';ajaxEnviah(\''+
       document.getElementsByTagName("ret")[0].getAttribute("vl")+'\', 0);showmsgonclick();return false;"' +
       ' style="top:'+mytop+'px;left:'+myleft+'px;" href=#>' +
       ''+(i+1)+'. '+ auxscripts[i].getAttribute("lb") + '</a>';
     }
     else
     {
      var cmd = unescape(auxscripts[i].getAttribute("act"));
      if (cmd==null) cmd='';
      cmd=cmd.replace(/\"/g, "'");
      //comando vazio vai fechar a janela, senao concatena o cmd que limpa mas nao fecha o dialog
      var cmd = (cmd == '') ? 'showmsgonclick();' : cmd;
      if (auxscripts[i].getAttribute("sn")=='1') // sem numero
      {
       oobj("errormsg").innerHTML +=
        '<a id="' + (0 - p - q + 1) + '" onfocus="obj=this;" accesskey="&" class=dialog ' +
        'onclick="'+cmd+';return false;"' +
        ' style="top:'+mytop+'px;left:'+myleft+'px;" href=#>' +
        auxscripts[i].getAttribute("lb") + '</a>';
      }
      else
      {
       oobj("errormsg").innerHTML +=
        '<a id="' + (0 - p - q + 1) + '" onfocus="obj=this;" ak='+(i+1)+' accesskey="&" class=dialog ' +
        'onclick="'+cmd+';return false;"' +
        ' style="top:'+mytop+'px;left:'+myleft+'px;" href=#>' +
        ''+(i+1)+'. '+auxscripts[i].getAttribute("lb") + '</a>';
      }
     }
    }
    if (cols>0) if (i==(cols-1)){mytop=48+(elmh-12);myleft+=250;}
    p--;
    mytop+=16;
   }
   if (si)
   {
    if ((!document.getElementsByTagName("foc")[0]) || (document.getElementsByTagName("foc")[0].getAttribute("7") != "0"))
    {
     oobj("errormsg").innerHTML +=
      '<a id="' + (-q + 1) + '" onfocus="obj=this;" ak=7 accesskey="&" class=dialog ' +
      'onclick="showmsgonclick();return false;"' +
      ' style="top:'+mytop+'px;left:16px;" href=#>' +
      '7. ' + 'Continuar' + '</a>';
     q--;
    }
    else
    {
     mytop-=16;
// TODO: Verificar se isto faz  diferenca   objmais--;
    }
    if ((!document.getElementsByTagName("foc")[0]) || (document.getElementsByTagName("foc")[0].getAttribute("8") == "1"))
    {
     mytop+=16;
     oobj("errormsg").innerHTML +=
      '<a id="' + (-q + 1) + '" onfocus="obj=this;" ak=8 accesskey="&" class=dialog ' +
      'onclick="BackToBegin();return false;"' +
      ' style="top:'+mytop+'px;left:16px;" href=#>' +
      '8. ' + 'Reiniciar Op&ccedil;&atilde;o' + '</a>';
     q--;
    }
    if ((!document.getElementsByTagName("foc")[0]) || (document.getElementsByTagName("foc")[0].getAttribute("9") == "1"))
    {
     mytop+=16;
     oobj("errormsg").innerHTML +=
      '<a id="' + (-q + 1) + '" onfocus="obj=this;" ak=9 accesskey="&" class=dialog ' +
      'onclick="BackToMenu();return false;"' +
      ' style="top:'+mytop+'px;left:16px;" href=#>' +
      '9. ' + 'Menu Principal' + '</a>';
     q--;
    }
   }
   setTimeout('try{oobj('+objmais+').focus()}catch(error){};' +
              'try{oobj('+objmais+').select()}catch(error){}', 50);
  }
  if (cols>0){mytop=48+(cols*16)+(elmh-12);}
  oobj("errormsg").style.height = (mytop + 32) + 'px';
  if (elmw > 368)
  {
   oobj("errormsg").style.left = parseInt((770 - (elmw + 32)) / 2) + 'px';
   templeft=parseInt((770 - (elmw + 32)) / 2);
   oobj("errormsg").style.width = parseInt(elmw + 32) + 'px';
   oobj("scontentbar").style.width = parseInt(elmw + 32) + 'px';
  }
}
//===
CurrencyEditControl.decimalSeparator    = ",";
CurrencyEditControl.decimalQuantity     = 0;
CurrencyEditControl.thousandsSeparator  = ".";
CurrencyEditControl.currencySymbol      = "&euro;"; 
CurrencyEditControl.currencySymbolPos   = "l"; 
CurrencyEditControl.currSymbolOffsetX   = 0;
CurrencyEditControl.currSymbolOffsetY   = 0;
CurrencyEditControl.autoZeroes          = true;
if (navigator.userAgent.indexOf("MSIE") > 1){
 CurrencyEditControl.currSymbolOffsetX = -1;
 CurrencyEditControl.currSymbolOffsetY = 0;
 if (document.getElementsByTagName("html")[0].getAttribute("xmlns") != null){
  CurrencyEditControl.currSymbolOffsetX = 9;
  CurrencyEditControl.currSymbolOffsetY = 14;
 }
}
CurrencyEditControl.currSymWidth    = 20;
CurrencyEditControl.paddingTB       = 2;
CurrencyEditControl.paddingLR       = 4;
CurrencyEditControl.editIdPrefix    = "B";
CurrencyEditControl.onSubmitAsigned = false;
CurrencyEditControl.currSymIdPrefix = "CEC_symbol_";
CurrencyEditControl.originalSubmit  = null;
CurrencyEditControl.lastkeypress  = null;
//===
function CurrencyEditControl(){}
CurrencyEditControl.init = function()
{
 var objDecimalSep = oobj("CEC_DECIMAL_SEPARATOR");
 if (objDecimalSep) this.decimalSeparator = objDecimalSep.value;
 var objDecimalQnty = oobj("CEC_DECIMAL_QUANTITY");
 if (objDecimalQnty) this.decimalQuantity = objDecimalQnty.value;
 var objThousandsSep = oobj("CEC_THOUSANDS_SEPARATOR");
 if (objThousandsSep) this.thousandsSeparator = objThousandsSep.value;
 var objCurrencySymbol = oobj("CEC_CURRENCY_SYMBOL");
 if (objCurrencySymbol) this.currencySymbol = objCurrencySymbol.value;
 var objCurrencySymbolPos = oobj("CEC_CURRENCY_SYMBOL_POS");
 if (objCurrencySymbolPos) this.currencySymbolPos = objCurrencySymbolPos.value;
 var objAutoZeroes = oobj("CEC_AUTO_ZEROES");
 if (objAutoZeroes) this.autoZeroes = (objAutoZeroes.value.toString().toLowerCase() == "true");
 var inputsLength = document.getElementsByTagName("input").length;
 for (i=0; i<inputsLength; i++){
  if (document.getElementsByTagName("input")[i].type.toLowerCase() == "text"){
   var editctrl  = document.getElementsByTagName("input")[i];
   var cecattr   = editctrl.getAttribute("currencyedit");
   var setEvents = false;
   if (cecattr != null && cecattr == "true"){
    if (editctrl.id){
     if (!this.createCurrencySymbol(editctrl)) continue;
     setEvents = true;
    }
    else{
     alert("Attribute 'id' is mandatory for CurrencyEditControl.");
    }
   }
   else if (editctrl.id && editctrl.id.indexOf(this.editIdPrefix) == 0){
    if (!this.createCurrencySymbol(editctrl)) continue;
    setEvents = true;
   }
   if (setEvents){
    if (!editctrl.setCurrencyValue)
    {
     editctrl.setCurrencyValue = CEC_setCurrencyValue;
     editctrl.getCurrencyValue = CEC_getCurrencyValue;
     editctrl.style.textAlign = "right";
     if (editctrl.value != ""){
      var val = this.reverseFormat(editctrl.value);
      if (val != "" && !isNaN(parseFloat(this.toPointValue(val)))){
       editctrl.value = this.format(val, editctrl.getAttribute("cep"));
       editctrl.setAttribute("currencyvalue", val);
      }
     }
     else{
      editctrl.setAttribute("currencyvalue", "0");
     }
     if(editctrl.addEventListener){
      editctrl.addEventListener("blur", CEC_onEditControlBlur, false);
      editctrl.addEventListener("focus", CEC_onEditControlFocus, false);
      editctrl.addEventListener("change", CEC_onEditControlChange, false);
      editctrl.addEventListener("keydown", CEC_onEditControlKeyDown, false);
      editctrl.addEventListener("keypress", CEC_onEditControlKeyPress, false);
      editctrl.addEventListener("keyup", CEC_onEditControlKeyUp, false);
     }
     else if (editctrl.attachEvent){
      editctrl.attachEvent("onblur", CEC_onEditControlBlur);
      editctrl.attachEvent("onfocus", CEC_onEditControlFocus);
      editctrl.attachEvent("onchange", CEC_onEditControlChange);
      editctrl.attachEvent("onkeydown", CEC_onEditControlKeyDown);
      editctrl.attachEvent("onkeypress", CEC_onEditControlKeyPress);
      editctrl.attachEvent("onkeyup", CEC_onEditControlKeyUp);
     }
     var theForm = editctrl.form;
     if (!this.onSubmitAsigned && theForm){
      this.onSubmitAsigned = true;
      theForm.submitOrig = theForm.submit;
      theForm.submit = CEC_formSubmit;
      if (theForm.addEventListener){
       theForm.addEventListener('submit', CEC_onFormSubmit, false);
      }
      else if (theForm.attachEvent){
       theForm.attachEvent('onsubmit', CEC_onFormSubmit);
      }
     }
    }
   }
  }
 }
}
function CEC_autoInit(){CurrencyEditControl.init();}

CurrencyEditControl.createCurrencySymbol = function(input){return true;}
function CEC_onEditControlKeyDown(event){CurrencyEditControl.onEditControlKeyDown(event);}
CurrencyEditControl.onEditControlKeyDown = function(event)
{
 if (event == null) event = window.event;
 var edit = (event.srcElement) ? event.srcElement : event.originalTarget;
 CurrencyEditControl.lastkeypress = event.keyCode;
 if (CurrencyEditControl.lastkeypress >= 96 && CurrencyEditControl.lastkeypress <= 105) 
  CurrencyEditControl.lastkeypress = 0;
 var kc = event.keyCode;
 if ( kc >= 65 && kc <= 90 ){
  if (event.stopPropagation) event.stopPropagation();
   if (event.preventDefault) event.preventDefault();
  event.returnValue = false;
  this.cancelKey = true;
  return false;
 }
 else if (!((kc > 48 && kc < 57) || (kc >= 96 && kc <= 105))){
  this.cancelKey = true;
 }
}
function CEC_onEditControlKeyPress(event){CurrencyEditControl.onEditControlKeyPress(event);}
CurrencyEditControl.onEditControlKeyPress = function(event)
{
 if (event == null) event = window.event;
 var edit = (event.srcElement) ? event.srcElement : event.originalTarget;
 var cv = "";
 var parteinteira = "";
 var partedecimal = "";
 var replace = false;
 var val = edit.value.toString();
 var decimalyet = false;
 for(i=0; i<edit.value.length; i++)
 {
  if (!decimalyet && this.decimalSeparator != "." && val.charAt(i) == ".")
  {
   //cv += this.decimalSeparator;
  }
  if (!isNaN(parseInt(val.charAt(i))) || val.charAt(i) == this.decimalSeparator && !decimalyet)
  {
   if (!decimalyet)
    parteinteira = cv;
   cv += val.charAt(i);
   if ((decimalyet) && (val.charAt(i) != this.decimalSeparator))
    partedecimal += val.charAt(i);
   if (val.charAt(i) == this.decimalSeparator)
   {
    decimalyet = true;
    if (i==0)
    {
     cv = "0" + val.charAt(i);
     replace = true;
    }
   }
  }
  else
  {
   replace = true;
  }
 }
 if (!decimalyet)
  parteinteira = cv;
 var pi = "";
 var pd = "";
 replace = false;
 if (parteinteira.length > edit.getAttribute('ces'))
 {
  replace = true;
  for(i=0; i<edit.getAttribute('ces'); i++)
   pi += parteinteira.charAt(i);
 }
 if (partedecimal.length > edit.getAttribute('cep'))
 {
  replace = true;
  for(i=0; i<edit.getAttribute('cep'); i++)
   pd += partedecimal.charAt(i);
 }
 if (pi == ""){ pi = parteinteira};
 if (pd == ""){ pd = partedecimal};
 if (replace)
 {
  if ((parseInt(pd) == 0) || (isNaN(parseInt(pd))))
   cv = pi;
  else
   cv = pi + this.decimalSeparator + pd;
  edit.value = cv;
   edit.setAttribute("currencyvalue", cv);
 }
}
function CEC_onEditControlKeyUp(event){CurrencyEditControl.onEditControlKeyUp(event);}
CurrencyEditControl.onEditControlKeyUp = function(event)
{
 if (event == null) event = window.event;
 var edit = (event.srcElement) ? event.srcElement : event.originalTarget;
 var cv = "";
 var parteinteira = "";
 var partedecimal = "";
 var replace = false;
 var val = edit.value.toString();
 var decimalyet = false;
 var d1 = false;
 var d2 = false;
 for(i=0; i<edit.value.length; i++)
 {
  if (!isNaN(parseInt(val.charAt(i))) || val.charAt(i) == this.decimalSeparator && !decimalyet)
  {
   if (!decimalyet)
    parteinteira = cv;
   cv += val.charAt(i);
   if ((decimalyet) && (val.charAt(i) != this.decimalSeparator))
    partedecimal += val.charAt(i);
   if (val.charAt(i) == this.decimalSeparator)
   {
    decimalyet = true;
    if (i==0)
    {
     cv = "0" + val.charAt(i);
     replace = true;
    }
   }
  }
  else
  {
   replace = true;
  }
 }
 if (!decimalyet)
  parteinteira = cv;
 var pi = "";
 var pd = "";
 replace = false;
 if (parteinteira.length >= edit.getAttribute('ces'))
  d1 = true;
 if (partedecimal.length >= edit.getAttribute('cep'))
  d2 = true;
 if (parteinteira.length > edit.getAttribute('ces'))
 {
  replace = true;
  for(i=0; i<edit.getAttribute('ces'); i++)
   pi += parteinteira.charAt(i);
 }
 if (partedecimal.length > edit.getAttribute('cep'))
 {
  replace = true;
  for(i=0; i<edit.getAttribute('cep'); i++)
   pd += partedecimal.charAt(i);
 }
 if (pi == ""){ pi = parteinteira};
 if (pd == ""){ pd = partedecimal};
 if (replace)
 {
  if ((parseInt(pd) == 0) || (isNaN(parseInt(pd))))
   cv = pi;
  else
   cv = pi + this.decimalSeparator + pd;
   edit.value = cv;
   edit.setAttribute("currencyvalue", cv);
 }
 if (this.cancelKey){
  this.cancelKey = false;
  var cv = "";
  var replace = false;
  var val = edit.value.toString();
  var decimalyet = false;
  for(i=0; i<edit.value.length; i++){
   if (!decimalyet && this.decimalSeparator != "." && val.charAt(i) == "."){
    cv += this.decimalSeparator;
   }
   if (!isNaN(parseInt(val.charAt(i))) || val.charAt(i) == this.decimalSeparator && !decimalyet){
    cv += val.charAt(i);
    if (val.charAt(i) == this.decimalSeparator){
     decimalyet = true;
     if (i==0){
      cv = "0" + val.charAt(i);
      replace = true;
     }
    }
   }
   else{
    replace = true;
   }
  }
  if (replace) edit.value = cv;
 }
}
function CEC_onEditControlBlur(event){CurrencyEditControl.onEditControlBlur(event);}
CurrencyEditControl.onEditControlBlur = function(event)
{
 if (event == null) event = window.event;
 var edit = (event.srcElement) ? event.srcElement : event.originalTarget;
 var val = edit.value;
 var nan = isNaN(parseFloat(this.toPointValue(val)));
 if (val != "" && !nan){ // value is ok
  edit.value = this.format(val, edit.getAttribute("cep"));
  floatVal   = parseFloat(CurrencyEditControl.toPointValue(val));
  val2 = floatVal.toString();
  val  = val2.replace(".", ",");
  /* aqui pode ser 6,0 ou 6,450,0   tanto faz para o split*/
  edit.setAttribute("currencyvalue", val);
  // invoke the onchange event explicity...
  var onchangestr = edit.getAttribute("currencyedit_onchange");
  if (onchangestr){
   onchangestr = onchangestr.replace("this", "oobj('" + edit.id + "')");
   eval(onchangestr);
  }
 }
 else if (val != "" && nan){
  edit.value = "0" + this.decimalSeparator + this.getZeroesString2(edit.precision);
  edit.setAttribute("currencyvalue", edit.value);
 }
 else if (val == "" && this.autoZeroes){
  val = 0;
  edit.value = "0" + this.decimalSeparator + this.getZeroesString2(edit.getAttribute("cep"));
  edit.setAttribute("currencyvalue", val);
 }
 else if (val == ""){
  edit.setAttribute("currencyvalue", "");
 }
}
function CEC_onEditControlChange(event){CurrencyEditControl.onEditControlChange(event);}
CurrencyEditControl.onEditControlChange = function(event)
{
 if (event == null) event = window.event;
 var edit = (event.srcElement) ? event.srcElement : event.originalTarget;
 var onchangestr = edit.getAttribute("currencyedit_onchange");
 if (onchangestr){
  onchangestr = onchangestr.replace("this", "oobj('"+edit.id+"')");
  eval(onchangestr);
 }
}
function CEC_onEditControlFocus(event){CurrencyEditControl.onEditControlFocus(event);}
CurrencyEditControl.onEditControlFocus = function(event)
{
 if (event == null) event = window.event;
 var edit = (event.srcElement) ? event.srcElement : event.originalTarget;
 edit.value = edit.getAttribute("currencyvalue");
 edit.select();
 CurrencyEditControl.lastkeypress  = null;
}
function CEC_onFormSubmit(event){CurrencyEditControl.onFormSubmit(event);}
CurrencyEditControl.onFormSubmit = function(event){this.reverseAllInputs();}
CurrencyEditControl.reverseAllInputs = function(){}
function CEC_formSubmit()
{
 CurrencyEditControl.reverseAllInputs();
 this.submitOrig();
}
function CEC_onWindowResize(event){CurrencyEditControl.onWindowResize(event);}
CurrencyEditControl.onWindowResize = function(event){this.relocateSymbols();}
CurrencyEditControl.format = function(val, precis)
{
 var edit = this;
 if (val == "") return "";
 var floatVal = parseFloat(this.toPointValue(val));
 if (isNaN(floatVal)) return "0" + this.decimalSeparator + this.getZeroesString2(edit.precision);
 var valMoney = floatVal.toFixed(precis);
 try
 {
  var valSep   = valMoney.toString().split(".");
  var theNum   = valSep[0].toString();
  var theCents = valSep[1].toString();
 }
 catch(error)
 {
  var theNum   = 0;
  var theCents = 0;
 }
 var fmt      = new Array();
 var l        = theNum.length;
 var i        = 1;
 for(i=1; i<l+1; i++){
  fmt[i] = theNum.charAt(i-1);
 }
 fmt = fmt.reverse();
 for(i=1; i<l; i++){
  if (i%3 == 0){
   fmt[i] += this.thousandsSeparator;
  }
 }
 var rval = fmt.reverse().join("") + this.decimalSeparator + (theCents == null ? this.getZeroesString2(edit.precision) : theCents);
 return rval;
}
CurrencyEditControl.reverseFormat = function(fmt)
{
 if (fmt == "") return "";
 var noFormat = "";
 var format   = fmt.toString();
 var l        = fmt.length;
 var i        = 0;
 for (i=0; i<l; i++){
  if (format.charAt(i) != this.thousandsSeparator) noFormat += format.charAt(i);
 }
 return noFormat;
}
CurrencyEditControl.toPointValue = function(val)
{
 if (this.decimalSeparator != "."){
  return val.replace(this.decimalSeparator, ".");
 }
 return val;
}
CurrencyEditControl.relocateSymbols = function()
{
 var divElements = document.getElementsByTagName("div");
 for (key=0;key<divElements.length;key++){
  if (divElements[key].id && divElements[key].id.indexOf(this.currSymIdPrefix) == 0){
   var currSymbol = divElements[key];
   var input = oobj(currSymbol.getAttribute("inputid"));
   if (!input) return;
   var nTop  = getObject.getSize("offsetTop", input);
   var nLeft = getObject.getSize("offsetLeft", input);
   currSymbol.style.top = nTop - 1 + "px";
   if (this.currencySymbolPos == "l"){
    currSymbol.style.left = (nLeft + this.currSymbolOffsetX) + "px";
   }
   else{
    currSymbol.style.left = (nLeft + input.offsetWidth - this.currSymWidth + this.currSymbolOffsetX) + "px";
   }
  }
 }
}
CurrencyEditControl.getZeroesString = function()
{
 var zeroes = "";
 for (i=0; i<this.precision; i++){
  zeroes += "0";
 }
 return zeroes;
}
CurrencyEditControl.getZeroesString2 = function(precis)
{
 var zeroes = "";
 for (i=0; i < precis; i++){
  zeroes += "0";
 }
 return zeroes;
}
function CEC_setCurrencyValue(newvalue)
{
 var edit = this;
 var val = newvalue.toString();
 if (val != "" && !isNaN(parseFloat(CurrencyEditControl.toPointValue(val)))){
  edit.value = CurrencyEditControl.format(val, edit.getAttribute("cep"));
  if (val.indexOf(CurrencyEditControl.decimalSeparator) < 0) val = val + CurrencyEditControl.decimalSeparator + CurrencyEditControl.getZeroesString2(edit.precision);
  edit.setAttribute("currencyvalue", val);
 }
 else{
  edit.setAttribute("currencyvalue", "0" + CurrencyEditControl.decimalSeparator + CurrencyEditControl.getZeroesString2(edit.precision));
 }
}
function CEC_getCurrencyValue()
{
 var edit = this;
 var floatVal = parseFloat(CurrencyEditControl.toPointValue(edit.getAttribute("currencyvalue")));
 if (isNaN(floatVal)) return "0" + CurrencyEditControl.decimalSeparator + CurrencyEditControl.getZeroesString2(edit.precision);
 return floatVal;
}
function getObject(sId)
{
 if (bw.dom){
  this.hElement = oobj(sId);
  this.hStyle = this.hElement.style;
 }
 else if (bw.ns4){
  this.hElement = document.layers[sId];
  this.hStyle = this.hElement;
 }
 else if (bw.ie){
  this.hElement = document.all[sId];
  this.hStyle = this.hElement.style;
 }
}
getObject.getSize = function(sParam, hLayer)
{
 nPos = 0;
 while ((hLayer.tagName) && !( /(body|html)/i.test(hLayer.tagName))){
  nPos += eval('hLayer.' + sParam);
  if (sParam == 'offsetTop'){
   if (hLayer.clientTop){
    nPos += hLayer.clientTop;
   }
  }
  if (sParam == 'offsetLeft'){
   if (hLayer.clientLeft){
    nPos += hLayer.clientLeft;
   }
  }
  hLayer = hLayer.offsetParent;
 }
 return nPos;
}
function writeLayer(ID, parentID, sText)
{
 if (document.layers){
  var oLayer;
  if(parentID){
   oLayer = eval('document.' + parentID + '.document.' + ID + '.document');
  }
  else{
   oLayer = document.layers[ID].document;
  }
  oLayer.open();
  oLayer.write(sText);
  oLayer.close();
 }
 else if(document.all){
  document.all[ID].innerHTML = sText;
 }
 else{
  oobj(ID).innerHTML = sText;
 }
}
function sethowbg(obj)
{
 if (obj.checked)
  document.cookie="howbg=S";
 else
  document.cookie="howbg=N";
}
function closeall(){alert(window.count);}
function showmapa(param)
{
 var tagname
 tagname = '_blank';
 action = "http://www.ssw.inf.br/mapa/mapa.php?" + param;
 janela=window.open(action, tagname, "fullscreen=0,menubar=0,location=0,toolbar=0,status=0," +
        "scrollbars=0,resizable=0,width=655" +
        ",height=720,top=1,left=1");
 return true;
}
function SSWUnload()
{
 srxml = null;
 ohmygod = null;
 arridx = null;
 delete srxml; 
 if (ajaxGeral != null && ajaxGeral.readyState != 0 && ajaxGeral.readyState != 4)
 {
  ajaxGeral.abort();
 }
 for (arridx=0;arridx<arrAjaxObjs.length;arridx++)
 {
  ohmygod = arrAjaxObjs[arridx];
  if (ohmygod != null && ohmygod.readyState != 0 && ohmygod.readyState != 4)
  {
   ohmygod.abort();
  }
 }
 for (asi=0; asi<inputsLength; asi++)
 {
  inputform = document.getElementsByTagName("INPUT")[asi];
  if(inputform.addEventListener){
   inputform.removeEventListener("focus", setobj, false);
   inputform.removeEventListener("blur", setobj, false);
   inputform.removeEventListener("blur", doDateTime, false);
   inputform.removeEventListener("keyup", setobj, false);
  }
  else if (inputform.attachEvent){
   inputform.detachEvent("onfocus", setobj);
   inputform.detachEvent("onblur", sswblur);
   inputform.detachEvent("onblur", doDateTime);
   inputform.detachEvent("onkeyup", NextField);
  }
 }
 var inputsLength = document.getElementsByTagName("A").length;
 for (asi=0; asi<inputsLength; asi++){
  inputform = document.getElementsByTagName("A")[asi];
  if(inputform.addEventListener){
   inputform.removeEventListener("focus", setobjA, false);
  }
  else if (inputform.attachEvent){
   inputform.detachEvent("onfocus", setobjA);
  }
 }
 document.onmouseover = null;
 document.onmouseout  = null;
 document.onmousedown = null;
 document.onkeydown   = null;
 document.onkeypress  = null;
 if (window.addEventListener){
  window.removeEventListener("load", doinputs, false);
  window.removeEventListener("unload", SSWUnload, false);
  window.removeEventListener("scroll", scrollme, false);
  window.removeEventListener("resize", resizeme, false);
 }
 else if (window.attachEvent){
  window.detachEvent("onload", doinputs);
  window.detachEvent("onunload", SSWUnload);
  window.detachEvent("onscroll", scrollme);
  window.detachEvent("onresize", resizeme);
 }
}
function collapse(){
 var tot = document.getElementsByTagName("DIV").length;
 for (dm=0; dm<tot; dm++){
  dmnu = document.getElementsByTagName("DIV")[dm];
  if (dmnu.id.substring(0,4)=="mod_")
   rolli(dmnu.id, 1);
 } 
}
function showWaitIcon()
{
 positionit();
 if (oobj("procimg").style.visibility != 'visible')
 {
  oobj("procimg").style.visibility='visible';
 }
}
function hideWaitIcon()
{
 active = false;
 oobj("procimg").style.visibility='hidden';
}
function btnClose(){window.close();}
templeft=185;
temptop=100;
function resizeme(e){
 try {
  var window_width=ie? document.body.clientWidth : document.body.clientWidth;
  var window_height=ie? document.body.clientHeight : document.body.clientHeight;
  var dsocleft=ie? document.body.scrollLeft : pageXOffset
  var dsoctop=ie? document.body.scrollTop : pageYOffset
  oobj("procimg").style.top=(208 + parseInt(dsoctop)) + 'px';
  oobj("errorpanel").style.height = window_height;
  oobj("errorpanel").style.width = window_width;
 } catch (e){}
}
function scrollme(e){
 var dsocleft=ie? document.body.scrollLeft : pageXOffset
 var dsoctop=ie? document.body.scrollTop : pageYOffset
 var window_width=ie? document.body.clientWidth : document.body.clientWidth;
 var window_height=ie? document.body.clientHeight : document.body.clientHeight;
 oobj("errorpanel").style.top    = dsoctop;
 oobj("errorpanel").style.left   = dsocleft;
 oobj("errorpanel").style.height = window_height;
 oobj("errorpanel").style.width  = window_width;
 zcor=oobj("errormsg");
 zcor.style.left = templeft + dsocleft;
 zcor.style.top  = temptop  + dsoctop;
 oobj("procimg").style.top=(208 + parseInt(dsoctop)) + 'px';
}
function positionit(){
 var dsocleft=ie? document.body.scrollLeft : pageXOffset
 var dsoctop=ie? document.body.scrollTop : pageYOffset
 var window_width=ie? document.body.clientWidth : document.body.clientWidth;
 var window_height=ie? document.body.clientHeight : document.body.clientHeight;
 watermark_obj = oobj('procimg');
 watermark_obj.style.top=(208 + parseInt(dsoctop)) + 'px';
 oobj("errorpanel").style.top=dsoctop;
 oobj("errorpanel").style.left=dsocleft;
 oobj("errorpanel").style.height=window_height;
 oobj("errorpanel").style.width=window_width;
}
function ietruebody(){
 return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
}
function movescontentmain(e)
{
 var dsocleft=ie? document.body.scrollLeft : pageXOffset
 var dsoctop=ie? document.body.scrollTop : pageYOffset
 mousex=(document.all)?event.clientX:e.pageX;
 mousey=(document.all)?event.clientY:e.pageY;
 if (ie) 
 {
  if (event.button==1&&dragapproved)
  {
   zcor.style.pixelLeft=event.clientX-tempvar1+dsocleft;
   zcor.style.pixelTop=event.clientY-tempvar2+dsoctop;
   templeft = zcor.style.pixelLeft - dsocleft;
   temptop  = zcor.style.pixelTop  - dsoctop
   return false;
  }
 }
 else
 {
  if (dragapproved)
  {
   zcor.style.left=e.pageX-tempvar1;//+dsocleft;
   zcor.style.top=e.pageY-tempvar2;//+dsoctop;
   templeft = parseInt(zcor.style.left) - dsocleft;
   temptop  = parseInt(zcor.style.top)  - dsoctop;
   return false;
  }
  return false;
 }
}
function dragscontentmain(e){
 if (ie) 
 {
  if (event.srcElement.id=="scontentbar")
  {
   dragapproved=true
   zcor=oobj("errormsg");
   // grab the x-y pos.s if browser is IE
   tempX = event.clientX + document.body.scrollLeft
   tempY = event.clientY + document.body.scrollTop
   // catch possible negative values in NS4
   if (tempX < 0){tempX = 0}
   if (tempY < 0){tempY = 0}
   tempvar1=tempX-zcor.style.pixelLeft;
   tempvar2=tempY-zcor.style.pixelTop;
  }
 }
 else
 {
  if (e.target.id=="scontentbar")
  {
   dragapproved=true
   zcor=oobj("errormsg");
   // grab the x-y pos.s if browser is NS
   tempX = e.pageX
   tempY = e.pageY
   // catch possible negative values in NS4
   if (tempX < 0){tempX = 0}
   if (tempY < 0){tempY = 0}
   tempvar1=tempX-parseInt(zcor.style.left);
   tempvar2=tempY-parseInt(zcor.style.top);
  }
 }
}
document.onmousemove=movescontentmain;
document.onmousedown=dragscontentmain;
document.onmouseup=new Function("dragapproved=false;if (oobj('menu01')!=null){collapse();oobj(4).value='';}");
function ElmHeight(elmID) {
if(oobj(elmID).clientHeight) {
return (oobj(elmID).clientHeight);
}else {
if(oobj(elmID).offsetHeight) {
return (oobj(elmID).offsetHeight);
}}}
function ElmWidth(elmID) {
if(oobj(elmID).clientWidth) {
return (oobj(elmID).clientWidth);
}else {
if(oobj(elmID).offsetWidth) {
return (oobj(elmID).offsetWidth);
}}}
function checktimeout()
{
 if (oobj("menu01") != null){
  if ((ajaxGeral.readyState == 1) || (ajaxGeral.readyState == 2)) {
   clearInterval(timeoutinterval);
   ajaxGeral.abort();
   active = false;
   ajaxGeral.onreadystatechange = stateGeral;
   ajaxGeral.open("POST", mypost[0], true);
   ajaxGeral.setRequestHeader('Content-type', 'application/x-www-form-urlencoded');
   ajaxGeral.send(mypost[1]);
 }}
}
function sswlite(prg)
{
 if (document.all) {
  window.resizeTo(800, 572);
 }
 else if (document.layers||oobj) 
 {
  window.outerWidth = 800;
  window.outerHeight = 572;
 }
 window.open("http://" + location.host + "/bin/" + prg, "_self");
}
function whoisH()
{
 if (reqm.readyState == 4)
 {
  if (reqm.status == 200)
  {
   if (reqm.responseText.trim() != "")
   {
    oobj("ppp").innerHTML = reqm.responseText;
    oobj("ppp").style.visibility = "visible";
   }
  }
  reqm.abort();
 }
}
function whois(w)
{
 g =(document.all)?w.innerText.trim():w.textContent.trim();
 if (reqm.readyState == 0)
 {
  var vai=false;
  if (!oobj("ppp"))
   vai=true;
  else
  {
   if (oobj("ppp").style.visibility=="hidden")
    vai=true;
  }
  if (vai)
  {
   if (!oobj("ppp"))
    addHTMLcool('<div class=cltt5 id=ppp style="z-index: 1147483648;border:0px solid rgb(204,203,207);' +
                'text-align:left;overflow:visible;visibility:hidden"></div>');
   reqm.onreadystatechange = whoisH;
   reqm.open("POST", "/bin/ssw0714");
   reqm.setRequestHeader('Content-type', 'application/x-www-form-urlencoded');
   reqm.send("user="+g+"&dummy=" + new Date().getTime());
   oobj("ppp").style.width = 300;
   oobj("ppp").style.height = 70;
  }
 }
 oobj("ppp").style.left = mousex+15;
 oobj("ppp").style.top = mousey+15;
}
function whoisc(){
 if (oobj("ppp"))
 {
  oobj("ppp").style.width = 5;
  oobj("ppp").style.height = 5;
  oobj("ppp").innerHTML = "";
  oobj("ppp").style.visibility = "hidden";
  reqm.abort();
 }
}
function handlerECT(){if (reqm.readyState == 4){if (reqm.status == 200){
var data = reqm.responseXML.getElementsByTagName("cep")[0].childNodes;
oobj('ecttipo').value = "(" + getData(data[3])+ ") " + getData(data[4]);
oobj('ectlogra').value = getData(data[0]) + " - " + getData(data[1]);
oobj('ectlogra').setAttribute("l", getData(data[0]));
oobj('ectlogra').setAttribute("b", getData(data[1]));
oobj('ectciduf').value = getData(data[2]);
}reqm.abort();}return true;}
function buscaCEP(cep){reqm.onreadystatechange = handlerECT;
oobj("ecttipo").value="Aguarde ...";
reqm.open("POST", "/bin/ssw0753");reqm.setRequestHeader('Content-type', 'application/x-www-form-urlencoded');
reqm.send("cep="+cep+"&dummy=" + new Date().getTime());
return true;}
function ectGo()
{oobj(parseInt(ectid)+1).value = oobj("ectlogra").getAttribute("l");
oobj(parseInt(ectid)+4).value = oobj("ectlogra").getAttribute("b");
if (oobj(parseInt(ectid)+5).type.toUpperCase() == "TEXT")var cepid = parseInt(ectid)+5;else var cepid = parseInt(ectid)+6;
if ((help_file=='ssw0024.htm')){if (oobj(parseInt(ectid)+6).type.toUpperCase() == "TEXT")var cepid = parseInt(ectid)+6;else var cepid = parseInt(ectid)+7;}
oobj(cepid).value = oobj(-2).value;
execOnChange(oobj(cepid));
}
function buscaect(ectobj){
ectid=ectobj.id;
newHTML = "<input name='-2' type='text' onfocus='obj=this;' class=data id='-2' onKeyPress='return onlynum(event)'" +
" onBlur='buscaCEP(this.value);' onKeyUp='NextField();' class=data value='' maxlength=8 style='position:relative;width:64px;'>" +
"&nbsp;<input READONLY name='ecttipo' type='text' class=nodata id='ecttipo' value='' style='background:transparent;position:relative;width:240px;'>" +
"<table cellpadding=0 border=0 cellspacing=0 style='width:450px;'><tr height=16><td width=80 align=right valign=bottom>Logra-bairro:&nbsp;" +
"</td><td width=370 valign=bottom>"+
"<input READONLY name='ectlogra' type='text' class=nodata id='ectlogra' value='' style='background:transparent;height:11px;position:relative;width:100%'>" +
"</td></tr><tr height=16><td align=right valign=bottom>Cidade/UF:&nbsp;</td><td valign=bottom>" +
"<input READONLY name='ectciduf' type='text' class=nodata id='ectciduf' value='' style='background:transparent;height:11px;position:relative;width:100%;'>" +
"</td></tr></table><br>" +
"<INPUT type=hidden id=kpmais>" +
"<A id='-1' onfocus='obj=this;' style='position:relative;' class=imglnk href='#' onclick='ectGo();showmsgonclick();return false;' accesskey='&'>&nbsp;&#187;&nbsp;</A>" +
"<A id='0' onfocus='obj=this;' style='position:relative;' class=imglnk href='#' onclick='showmsgonclick();return false;' accesskey='&'>&nbsp;&#215;&nbsp;</A>" +
"<foc vl='-2' 7='0' 8='0' 9='0'>";
showmsg("CEP:&nbsp;" + newHTML, 1);
dialogid=-2;objmais=-1;saveobjfocus=parseInt(obj.id) + 1;
setTimeout('try{oobj(-2).focus()}catch(error){};try{oobj(-2).select()}catch(error){}', 50);
oobj("errormsg").style.height = 147 - 16;}
function sswpack()
{
abrir('ssw.sswpack','ssw.sswpack',1,1,'/home/httpd/htdocs',5);
}

