function DlgSearch(tbls,dlg_para_nuevo)
{
  this.tbl_str_so_md = tbls; // 'tbl1, tbl2, tbl3';
  this.tbl_for_order_field = '';
  try
  {
   this.tbl_for_order_field = tbls.split(',')[0]+'.';
  }
  catch(e)
  {
   this.tbl_for_order_field = tbls +'.';
  }
  this.field_order_so_md = ''; // 'rec_id'
  this.fields_so_md = '';
  this.title = '';  
  this.usl_so_md = null;                            
  this.returnFields_so_md = new Array();
  this.wwd = '';
  this.dlg_obj_so = null;
  this.x_RetVal = 0; 
  this.dlg_para_nuevo = "NADA"
  if (dlg_para_nuevo)
  {
	var a = self.location.toString().split("?")[0];
	//alert(a);
	a = a.split("/");
	var b = "";
	for (var i=0;i<a.length-1;i++)
	{
		b += a[i] + "/";
	}
	b += dlg_para_nuevo;
	this.dlg_para_nuevo = b;
	//alert("DLG--> " + this.dlg_para_nuevo);
  }
  this.mascaras = '';
  this.identificador = null;
  this.agregadosParaMostrar = new Array();
}
DlgSearch.prototype.openSearchDlg = function(w)
{


 if(w) this.wwd = w;
 var ARGS = new Array(this.tbl_str_so_md,this.field_order_so_md,this.fields_so_md,this.usl_so_md,this.returnFields_so_md,this.wwd,this.title,this.tbl_for_order_field,this.dlg_para_nuevo,this.mascaras,this.identificador,this.agregadosParaMostrar);
 this.dlg_obj_so = showModalDialog("../../../common/includes/search_dlg.htm",ARGS,"font-size:10px;dialogWidth:" + (this.wwd+30) + "px;dialogHeight:350px;status: 0;edge: Raised;unadorned: yes;help: 0;scroll: 0");
 if (this.dlg_obj_so == null)
        return;   
  else
  {
     return this.dlg_obj_so;
  }
  return 0;
}
DlgSearch.prototype.toNewDialog = function(args)
{
 var pagina = this.dlg_para_nuevo.split("/")[this.dlg_para_nuevo.split("/").length-1];
 this.dlg_para_nuevo = pagina;
 this.dlg_obj_so = showModalDialog(this.dlg_para_nuevo,args,"font-size:10px;dialogWidth:" + (this.wwd+30) + "px;dialogHeight:350px;status: 0;edge: Raised;unadorned: yes;help: 0;scroll: 1");
 if (this.dlg_obj_so == null)
        return;   
  else
  {
     return this.dlg_obj_so;
  }
  return 0;
}
DlgSearch.prototype.AddField = function(name,_rv,_search,_show,_mask)
{
  var cm = ',';
  if(name.split('=')[1])
  { 
		this.field_order_so_md = name;
		name = name.split('=')[0];
  }
  if(!this.fields_so_md)
  {
   this.fields_so_md = '';
   cm = '';
  }
   this.fields_so_md += cm + name;
   //this.fields_so_md += (_search == 0 || (!_search))?'=0#':('=' + _search);
   if (_search == 0 || (!_search))
   {
      this.fields_so_md += '=0#';
   }
   else
   {
      this.fields_so_md += '=' + _search;
      if (_mask == 0 || (!_mask))
      {
      	this.mascaras += 'null=';
      }
      else
      {
      	this.mascaras += _mask+'=';
      }
   }
   
   this.fields_so_md += (_show == 0 || (!_show))?'=H':('=S=' + _show);
   if((_rv) && (_rv != 0))
   {
    (this.returnFields_so_md)[this.x_RetVal] = name;
    this.x_RetVal++; 
   }
}
DlgSearch.prototype.AddTableForOrderField = function(t)
{
  this.tbl_for_order_field = t +'.';
}

