function listView( form_name )
{
  this.fname = form_name;
  this.sortArr = new Array();
}

function ___listView_OnLoad()
{
  var el, i;
//alert( this.sortArr );
  for( i = 1; ( el = document.getElementById( this.fname + '_' + i ) ); i++ )
    this.setSortArr( el );
//alert( this.sortArr );
  el = document.getElementById( this.fname + '_1' );
  if( el ) el.focused = true;
  el = document.getElementById( '_lv_srch_nv' );
  if( el )
  {
    i = el.innerHTML;
	el.innerHTML = '';
    el = document.getElementById( '_lv_srch_div' );
	el.innerHTML = i;
    var l = document.getElementById( '_lv_srch_div' ).parentNode;
	this._addInput( '_dest', l.style.display == 'none' ? 'tab' : 'left', '__lv_srch_dest' );
	document.getElementById( 'core_leftZoneDiv' ).style.width = this.panel_width;
  }
}
listView.prototype.onLoad = ___listView_OnLoad;

function ___listView_AddInput( sfx, val, id )
{
  if( !this.form ) this.form = document.getElementById( this.fname + '_form' );
  if( !id ) id = this.fname + sfx;
  var ex = document.getElementById( id );
  if( ex ) ex.val = val;
  else
  {
    var input0 = document.createElement( "input" );
    input0.type = 'hidden';
    input0.name = this.fname + sfx;
    input0.value = val;
    input0.id = id;
    this.form.appendChild( input0 );
  }
}
listView.prototype._addInput = ___listView_AddInput;

function ___listView_SelResort( el ){
  if( el.value.search( "```" ) >= 0 || el.value.search( "@@@" ) >= 0 )
    { el.value = ''; return; }
//  this._addInput( '_count', 0 );
//-  this._addInput( '_step', 0 );
  this.setSortArr( el );
//-  this.setSortLine( el );
//-  this.submit();
}
listView.prototype.selResort = ___listView_SelResort;

function ___listView_SetSortArr( el ){
  var k;
  if( el )
  {
	var ord = el.getAttribute( 'order' );
//alert( ord );
    for( k = 0; k < this.sortArr.length; k++ )
      if( this.sortArr[k][0] == ord )
        { this.sortArr[k][1] = el.value; break; }
//alert( k );
//alert( this.sortArr );
    if( k == this.sortArr.length )
      if( el.value + 'a' != 'a' && el.value )
        this.sortArr.push( [ ord, el.value ] );
  }
}
listView.prototype.setSortArr = ___listView_SetSortArr;

function ___listView_SetSortLine( el ){
  var str, k;
//alert( el.innerHTML );
  this.setSortArr( el ); //alert(this.sortArr);
  for( str = '', k = 0; k < this.sortArr.length; k++ )
    {
      if( str ) str += '@@@';
      str += this.sortArr[k][0] + '```';
	  if( this.sortArr[k][1] != undefined ) str += this.sortArr[k][1].replace( /%/, '@`@' );
    }
//  alert( str );
  this._addInput( '_sortline', str );
}
listView.prototype.setSortLine = ___listView_SetSortLine;

function ___listView_SwitchPageCount( el )
  { this._addInput( '_count', el.value ); this.submit(); }
listView.prototype.switchPageCount = ___listView_SwitchPageCount;

function ___listView_SwitchPage( num )
  { this._addInput( '_step', num ); this.submit(); }
listView.prototype.switchPage = ___listView_SwitchPage;

function ___listView_SetOrder( ord, dir )
  { this._addInput( '_ord', ord+'_'+dir ); this.submit(); }
listView.prototype.setOrder = ___listView_SetOrder;

function ___listView_SwitchClass( clfNo, val )
  { this._addInput( '_clf_'+clfNo, val ); this.submit(); }
listView.prototype.switchClass = ___listView_SwitchClass;

function ___listView_SubmitSearch()
{
  this._addInput( '_step', 0 );
  this.setSortLine();
  this.submit();
  return false;
  return window.event.returnValue = false;
}
listView.prototype.submitSearch = ___listView_SubmitSearch;

function ___listView_InvSearch()
{
  var l = document.getElementById( '_lv_srch_div' ).parentNode;
  var r = document.getElementById( '_lv_srch_tr' );
  var d = document.getElementById( '__lv_srch_dest' );
  var p = document.getElementById( 'core_leftZoneDiv' );
  if( l.style.display == 'none' )
  {
    r.style.display =  'none';
    d.value =  'left';
//	p.style.width = this.panel_width;
  }
  else
  {
    r.style.display =  core.isMozilla ? 'table-row' : 'block';
    d.value =  'tab';
//	p.style.width = '12em';
  }
  return true;
}
listView.prototype.invSearch = ___listView_InvSearch;

function ___listView_Submit() { this.form.submit(); }
listView.prototype.submit = ___listView_Submit;

