window.defaultStatus = 'Fácil Agência de Comunicação';
// window.onresize = xMoveTo('box_menu', xPageX('box_header')+195, 180);

function setmsg_status(msg)
{
   window.status = window.defaultStatus + " - " + msg;
}

function update_parent()
{
   if (window.opener && !window.opener.closed)
   {
      window.opener.location.href = window.opener.document.URL;
   }
   self.close();
}

function getCookie(NameOfCookie)
{
   if (document.cookie.length > 0)
   {
      begin = document.cookie.indexOf(NameOfCookie+"=");
      if (begin != -1)
      {
         begin += NameOfCookie.length+1;
         end = document.cookie.indexOf(";", begin);
         if (end == -1)
         {
            end = document.cookie.length;
         }
         return unescape(document.cookie.substring(begin, end));
      }
   }
   return null;
}

function setCookie(NameOfCookie, value, expiredays)
{
   var ExpireDate = new Date ();
   ExpireDate.setTime(ExpireDate.getTime() + (expiredays * 24 * 3600 * 1000));
   document.cookie = NameOfCookie + "=" + escape(value) + ((expiredays == null) ? "" : "; path=/; expires=" + ExpireDate.toGMTString());
}

function delCookie (NameOfCookie)
{
   if (getCookie(NameOfCookie))
   {
      document.cookie = NameOfCookie + "=" + "; path=/; expires=Thu, 01-Jan-70 00:00:01 GMT";
   }
}

function href_popup(s_url, n_largura, n_altura, s_scroll, s_nome)
{
   var win  = null;
   var winl = (screen.width - n_largura)/2;
   var wint = (screen.height - n_altura)/2;
   // var s_janela = href_popup.arguments[5];
   settings = 'height='+n_altura+',width='+n_largura+',top='+wint+',left='+winl+',scrollbars='+s_scroll+',toolbar=no,location=no,status=no,menubar=no,resizable=no,dependent=yes'

   if (s_nome == '')
   {
      var s_nome = 'jan';
   }

   win = window.open (''+s_url+'', ''+s_nome+'', settings);
   if (parseInt(navigator.appVersion) >= 4)
   {
      win.window.focus();
   }
}

function change_fa (Fa, form)
{
   form.Fa.value=Fa;
   form.submit();
}

function textCounter(s_cmp, countfield, maxlimit)
{
   if (s_cmp.value.length > maxlimit) // if too long...trim it!
   {
      s_cmp.value = s_cmp.value.substring(0, maxlimit);
      // otherwise, update 'characters left' counter
   } else
   {
      countfield.value = maxlimit - s_cmp.value.length;
   }
}

function Go (popurl)
{
   if (window.opener.closed == false)
   {
      window.opener.location.href = popurl;
   } else
   {
      document.write(window.opener.closed);
      var linkPop = window.open(popurl,'linkPopAe');
   }
}

function mCont(objMenu)
{
   if (objMenu.style.display == "none")
   {
       objMenu.style.display = "";
   } else
   {
       objMenu.style.display = "none";
   }
}

function frm_busca (frm)
{
   lenCon = frm.CONTEUDO.value.length;
   if (lenCon < 3)
   {
      alert('Voce precisa informar no mínimo \n3 caracteres para a busca.');
      return false;
   } else
   {
      frm.submit();
      return true;
   }
}

function frm_cancelar()
{
   if (window.history.length)
   {
      history.back();

   } else if (window.opener && !window.opener.closed)
   {
      self.close();
   }
}

function mostrar_item(s_prefixo, n_item)
{
   var o_subitens = document.all.item(s_prefixo + n_item);

   if (o_subitens.style.display == 'none')
   {
      o_subitens.style.display = '';
   } else
   {
      o_subitens.style.display = 'none';
   }
}

function OpenFile( fileUrl )
{
	window.top.opener.SetUrl( fileUrl ) ;
	window.top.close() ;
	window.top.opener.focus() ;
}

function move_top(s_div)
{
   xGetElementById(s_div).scrollTop = 0;
}

n_left = (navigator.appVersion.indexOf("MSIE") != -1) ? 124 : 119;