  function carrega_comp_busca(formulario,campo,carrega_campo,gets){
    if (document.forms[formulario].elements[campo].value){
      gets = gets+'&valor='+document.forms[formulario].elements[campo].value;
      ajaxHTML(carrega_campo,gets);
    }
  }

  function carrega_pagina_codigo(formulario,campo,tabela,tip_show,clw_codigo,pagInfo,caminho){
     var codigo = document.forms[formulario].elements[campo].value;
     carrega_pagina_codigo
     window.location=caminho+'01/'+clw_codigo+'/'+pagInfo+'/'+tabela+'/'+codigo;
  }


  function KeyTab(){
    if (event.keyCode == 13){
      event.keyCode=9
    }
  }

  function AbrirJanela(caminho,titulo,width,height){
    alert('test');
    window.open(caminho,titulo, "height = "+height+", width = "+width+"");
  }

  function GetSubStr(str, sep, pos){
    var i = 0;
    var ant = 0;
    var cont = 0;
    var z = 0;
    var aux = "";

    if (str!=''){
      i = 1;
      cont = 0;
      ant = 0;
      while ((i<=str.length)&&(cont<pos+1)){
        if (str.charAt(i)==sep){
          cont = cont+1;
          if (cont<pos+1)
            ant = i+1;
        }
        if (cont<pos+1)
          i=i+1;
      }
      i=i-1;
      txt = 'ant: '+ant+', i: '+i;
      if ((cont==(pos+1)) || (pos==cont)){
        aux = '';
  	    for(z=ant;z<=i;z++){
          aux = aux+str.charAt(z);
        }
      }
    } else
      aux = "";

    return aux;
  }

  function Trim(str){
    while (str.charAt(0) == " ")
      str = str.substr(1,str.length -1);

    while (str.charAt(str.length-1) == " ")
      str = str.substr(0,str.length-1);

    return str;
  }

  function fncReplace(str,find,repla){
    while (str.indexOf(find)!=-1){
      str = str.replace(find, repla);
    }
    return str;
  }

  function SoNumero(str){
    var i = 0;
    var aux = '';
    while (i != str.length){
        switch (str.charAt(i)){
          case '0':
          case '1':
          case '2':
          case '3':
          case '4':
          case '5':
          case '6':
          case '7':
          case '8':
          case '9':
            aux = aux+str.charAt(i);
            break;
          default:
            verifica = aux;
        }
      i++;
    }
    return (aux);
  }

  function MudaPasso(nPassos,passo,pos,campos,avancar){
    var resultado;

    if (avancar==true){
      resultado = verificaCampoPassos(document.forms['anunciar_tabela'],campos);
    }else{
      resultado = true;
    }
    if (resultado){
    for(z=0;z<nPassos;z++){
      document.getElementById(passo+z).style.zIndex=0;
      document.getElementById(passo+z).style.visibility = 'hidden' ;
      document.getElementById('passo_titulo_'+z).style.background='#f0f0f0';
      document.getElementById('passo_titulo_'+z).style.color='#000000';
    }
    document.getElementById(passo+pos).style.zIndex=25;
    document.getElementById(passo+pos).style.visibility='visible';
    document.getElementById('passo_titulo_'+pos).style.background='#B00000';
    document.getElementById('passo_titulo_'+pos).style.color='#FFFFFF';
    }
    
    return resultado;

  }
  
  function mudaFoto(foto,caminho) {
    document.images.img_show.src = foto;
    document.getElementById("link_img_mostra").href=caminho;
  }

function GerarSWF(arquivo,altura,largura,id, nome){
    document.writeln('<object id="globalnav-object" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="' + largura + '" height="' + altura + '" id="' + id + '" name="' + id + '"_flw>');
    document.writeln('        <param name="movie" value="' + arquivo + '" />');
    document.writeln('        <param name="FlashVars" value="loc=en_US&htmlApp=false&gatewayURL=gwurl" />');
    document.writeln('        <param name="bgcolor" value="#ffffff" />');
    document.writeln('        <param name="menu" value="true" />');
    document.writeln('        <param name="quality" value="high" />');
    document.writeln('        <param name="salign" value="" />');
    document.writeln('        <param name="scale" value="showall" />');
    document.writeln('        <param name="wmode" value="transparent" />'); //window
    document.writeln('        <param name="codebase" value="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" />');
    document.writeln('        <param name="pluginspage" value="http://www.macromedia.com/go/getflashplayer" />');
    document.writeln('        <param name="align" value="middle" />');
    document.writeln('        <param name="play" value="true" />');
    document.writeln('        <param name="loop" value="true" />');
    document.writeln('        <param name="devicefont" value="false" />');
    document.writeln('        <param name="name" value="'+nome+'" />');
    document.writeln('        <param name="allowScriptAccess" value="sameDomain" />');
    document.writeln('        <embed id="globalnav-embed" src="' + arquivo + '" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" wmode="transparent" flashvars="loc=en_US&htmlApp=false&gatewayURL=gwurl" bgcolor="#ffffff" menu="false" quality="high" salign="tl" scale="noscale" id="' + id + '" width="' + largura + '" height="' + altura + '"></embed>');
    document.writeln('</object>');
}

function GerarVideoSWF(arquivo,altura,largura,id, nome,play){
    document.writeln('    <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" width="' + largura + '" height="' + altura + '" id="' + id + '" name="' + id + '">');
    document.writeln('    <param name="movie" value="FLVPlayer_Progressive.swf" />');
    document.writeln('    <param name="bgcolor" value="#000000" />');
    document.writeln('    <param name="salign" value="lt" />');
    document.writeln('    <param name="quality" value="high" />');
    document.writeln('    <param name="scale" value="noscale" />');
    document.writeln('    <param name="FlashVars" value="&skinName=clearSkin_3&streamName=' + arquivo + '&autoPlay=true&autoRewind=false" />');
    document.writeln('    <embed src="FLVPlayer_Progressive.swf" flashvars="&skinName=clearSkin_3&streamName=' + arquivo + '&autoPlay=true&autoRewind=false" quality="high" scale="noscale" width="' + largura + '" height="' + altura + '" salign="LT" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />');
    document.writeln('    </object>');
}

