  function TPesqu(name, type, width, typeR, cadastro) {
    this.name = name;
    this.pesquisou = false;
    this.msg = '';
    this.type = type;
	this.typeR = typeR;
    this.mudou = false;
	this.cadastro = cadastro;

    this.value = '';
	
	this.sqlFiltro = ''
	this.verifySqlFiltro = false;

    if (!width)
      width= 400;

    this.width = width;

    this.testKey = function (e) {
      if (event.keyCode == 117) {
        findObj("bt_" + this.name).click()
      }
    }

    this.setPesquisou = function (value) {
      this.pesquisou = value;

      if (value) {
        obj = findObj(this.name);
        this.value = obj.value;
      }
    }

    this.change = function (frame) {
      this.mudou = true;

      obj = findObj(this.name);

      this.pesquisou = this.value == obj.value;
      this.value = obj.value;

      this.showPesq(frame);
    }

    this.showPesq = function (frame) {
      if ((!this.mudou) && frame)
        return;
      this.mudou = false; 
	  if (this.verifySqlFiltro && !this.sqlFiltro) {
		  alert('Falta argumentos para realizar a busca!');
		  return;
	  }
	  
      obj = findObj(this.name);

      if (location.host.indexOf('localhost') != -1 || location.host.indexOf('cristian') != -1)
		  host = location.protocol + '//' + location.host + '/lista/2005.v2/pesqu/';
	  else
		  host = location.protocol + '//' + location.host + '/pesqu/';

      if (obj.value) {
        if (frame && (!this.pesquisou)) {
          findObj('fr_' + this.name).src =  host + 'pesquisa.php?type=' + this.type + '&typeR=' + this.typeR + '&argumento=' + obj.value + '&frame=sim' + '&objName=' + this.name + '&msg=' + this.msg + '&cadastro=' + this.cadastro + '&sqlFiltro=' + this.sqlFiltro;
        }
        else
        if (!frame) {
          iHeight = 400;
          w = wOpen(host + 'pesquisa.php?type=' + this.type + '&typeR=' + this.typeR + '&argumento=' + obj.value + '&objName=' + this.name + '&msg=' + this.msg + '&sqlFiltro=' + this.sqlFiltro, 
		  'pesquisa', this.width, iHeight);
          w.focus();
        }
        this.pesquisou = false;
        return;
      }
      else
      if (!obj.value) {
        if (!frame)
          alert('Digite algo para fazer a busca!');
        this.pesquisou = false;
      }
    }
  }