function list_cargo()
{
  this.mass_cargo=new Array();
  this.listcargo=new TableDriver('listcargo')
  this.cargo_name=document.getElementById('cargo_name')
  this.cargo_width=document.getElementById('cargo_width')
  this.cargo_height=document.getElementById('cargo_height')
  this.cargo_count=document.getElementById('cargo_count')
  this.textarea = document.getElementById('cargo_area')
  this.add_button = document.getElementById('add_button')
  this.count=1

  this.add=function()	
  {
    if(this.cargo_name.value=='')
    {
      alert('Поля наименование обязательно к заполнению')
      return false
    }
    this.strtoadd='';

    this.strtoadd+='<tr><td>'+this.cargo_name.value+'</td>'+
                   '<td>'+this.cargo_width.value+' см</td>'+
                   '<td>'+this.cargo_height.value+' см</td>'+
                   '<td>'+this.cargo_count.value+' шт.</td></tr>';
	
    this.mass_cargo['row_'+this.count]=[]
    this.mass_cargo['row_'+this.count]['str']=this.strtoadd

    this.listcargo.AddRow('row_'+this.count)

		td3=this.listcargo.Cell('<span class="delete" onclick="listCargo.del(\'row_'+this.count+'\',\'row_edit_'+this.count+'\');return false;">[x] <a href="#">Удалить</a></span>','edit_'+(this.count++))
    td3.id="row_tur_edit"

    this.listcargo.Cell(''+this.cargo_name.value)
    this.listcargo.Cell(this.cargo_width.value+'')				
    this.listcargo.Cell(this.cargo_height.value+'')						
    this.listcargo.Cell(this.cargo_count.value+'')										
		
    this.listcargo.ConfirmRowAfter('table_head',1)				

    this.mass_cargo['row_edit_'+this.count]=this.strtoadd;

    this.to_text()
  }

  this.del=function(id,id2)
  {
    this.listcargo.RemoveRow(id)
    delete this.mass_cargo[id]
    this.listcargo.RemoveRow(id2)
    delete this.mass_cargo[id2]
    this.to_text()		
  }
  this.to_text=function()
  {
    var str='<table border="1">'
		str+='<tr><th><strong>Наименование</strong></th><th style="width:55px"><strong>Ш</strong>, см</th><th style="width:55px"><strong>В</strong>, см</th><th style="width:55px"><strong>Кол-во</strong></th></tr>'
    for(k in this.mass_cargo)
       str+=this.mass_cargo[k]+""
		str+='</table>'
    this.textarea.value=str
//		alert(this.textarea.value)
  }
}
