//new Grid(null);
function Grid(parent)   //构造函数
{
  var pdiv;if(parent){pdiv=parent;}else pdiv=document.body;//获取父块
  var obj=new Div(pdiv);
  obj.style.overflow = 'auto';
  obj.style.border=1;
  obj.style.borderStyle='solid';
  obj.style.borderColor=clGray;
  obj.style.width = 300;
  obj.style.height = 100;
  obj.RowHeight = 21;
  obj.CurrentRow=-1;
  obj.OldCurrentRow=-1;
  obj.Rows = null;//调用表的所有行
  obj.RowsCount = 0;  //当前表中的记录总数
  obj.StateCells = null;//表格状态条
  obj.Cells = null;     //所有的单元格
  obj.Headerdiv = null;//包含表头的块
  obj.Header = null;//表示表头的表
  obj.ColsCount=0;//表的列数
  obj.Parent = null; //对象的容器
  obj.EditMode = null; //编辑状态
  obj.Enabled = false; //是否可用 
  obj.Visible = true;  //是否可见
  obj.Bodydiv = null; //表体的块
  obj.Body = null;    //表体本身,最重要的部分
  obj.Table = null;  //用户直接操作的部分
  obj.Isinit = true;//标记是否为初始化
  obj.CurrentCell = null
  obj.EditErrCell = null;  //保存当前编辑错误的项
//公有方法
  obj.DeleteRow = GRID_deleterow;      //删除一个指定的行
  obj.AppendRow = GRID_appendrow;      //添加一个空行
  obj.Clear = GRID_clear;  //清除表格中的所有内容   
  obj.ClearRows = GRID_clearrows; //清除表格中的所有的行
  obj.SetCurrentRow=GRID_SetCurrentRow;
//私有方法
  obj._CreateBody = GRID_createbody;    //创建表及其容器块
  obj._BodyShow = GRID_bodyshow;        //显示表体的具体内容
  obj._appendCell = GRID_appendcell;    //添加一个空的单元格
  obj._ArrayRemove = _arrayremove;  //用于数组处理，从数组中删掉指定的元素
  obj.onpropertychange = GRID_onpropertychange;
  obj._CreateRow = GRID_N_Row;
  obj.StateCells = new Array();
  obj.Cells = new Array();
  obj.Rows = new Array();
  obj.Columns = new Columns(pdiv);
  obj.Columns.Parent = obj;         //取得父亲节点
  obj.OnCellClick;
  obj.OnCellKeyDown;
  obj.OnCellFocus;
  obj.OnCellBlur;
  obj.OnCellDblClick;
  obj.OnCustomCell;
  //构造基本的块，开始调用私有方法
  obj._CreateBody();
  return obj;
}
function GRID_createbody()//创建表体DIV
{
   if(!this.Bodydiv){
    this.Bodydiv=document.createElement('div');
    this.appendChild(this.Bodydiv);
    this.Bodydiv.style.position='relative';   
    this.Bodydiv.style.top = 1;
    this.Bodydiv.style.left = 1;
    this.Bodydiv.style.paddingRight = 2;
   }
   if(!this.Table){
     this.Table = document.createElement('table');
     this.Table.style.position='relative';  
     this.Bodydiv.appendChild(this.Table);
   }
   this.Table.border='1';
   this.Table.cellSpacing="0";
   this.Table.cellPanding='0';
   this.Table.borderColor=clSilver;
   this.Table.style.tableLayout='fixed';
   this.Table.style.borderCollapse='collapse';//表线的格式
   this.Header = document.createElement('thead');
   this.Header.style.backgroundColor = "#DEDFDE";
   this.Header.style.height = this.RowHeight-1;
   this.Table.appendChild(this.Header);
   this.Header.onmousemove=GRID_HEAD_ondrag;
   this.Header.onmouseup=GRID_HEAD_onmouseup;
   this.Bodydiv.onmousemove=GRID_HEAD_ondrag;
   this.Bodydiv.onmouseup=GRID_HEAD_onmouseup;
   this.Header.owner=this;
   this.Bodydiv.owner=this;

   this.HeaderRow = document.createElement('tr');
   this.Header.appendChild(this.HeaderRow);
   //这里是状态列标题
   var cell = document.createElement('td');
   this.HeaderRow.appendChild(cell);
   cell.style.width=10;
   cell.innerText=' ';
   this._BodyShow();//创建表体 
}
// mouse在表头draging的事件
function GRID_HEAD_ondrag(){
	if(event.button==1){//left button
		if(this.owner.currCol){
     	  this.style.cursor='E-resize';
	      this.owner.currCol.style.cursor='E-resize';
		  var x=event.x;
		  if(!this.owner.oldDragX)
		  	  this.owner.oldDragX=x;
		  var width=this.owner.currCol.style.pixelWidth+x-this.owner.oldDragX;;
		  if(width>0)
	    	  this.owner.currCol.style.width=width;
	  	  this.owner.oldDragX=x;
		}
	}
}
// mouseup in header
function GRID_HEAD_onmouseup(){
  this.style.cursor='default';
  if(this.owner.currCol){
      this.owner.currCol.style.cursor='default';
	  var index=this.owner.currCol.Index;
	  var rowcount=this.owner.RowsCount;
	  for(var i=0;i<rowcount;i++){
		this.owner.Cells[i][index].style.width=this.owner.currCol.style.pixelWidth-3;
	  }
	  this.owner.currCol=null;
  }
  this.owner.oldDragX=null;
}

function GRID_clear(){
   this.Isinit=true;   //初始化标志
   if(!this.Cells.length==0)this.Cells.length=0; //清空单元格数组
   if(!this.StateCells.length==0)this.StateCells.length=0;//清空状态单元格
   if(!this.Rows.length==0)this.Rows.length=0;//清空所有的行
   if(this.RowsCount!=0)this.RowsCount=0;
   if(this.Auto||this.Columns.Auto){
     while(this.HeaderRow.childNodes.length>1){
		 var cn = this.HeaderRow.childNodes[1];
		 this.HeaderRow.removeChild(cn);
	 }
     this.Columns.Clear();//清空所有的列
   }
  while(this.TableBody.childNodes.length>0){
   var cn = this.TableBody.childNodes[0];
   this.TableBody.removeChild(cn);
   cn.removeNode(true);
  }

}
function GRID_clearrows() {
  while(this.Rows.length){
     this.DeleteRow(0);
  }
}
function GRID_onpropertychange() {
 switch(event.propertyName){
   case 'readOnly':
     event.cancelBubble = true;
     for(var i=0;i<this.Columns.Count;i++){
		this.Columns.Column[i].readOnly=this.readOnly;
	 }
	 break;
 }
 event.cancelBubble = false;
}
function GRID_bodyshow()//显示表
{
  this.TableBody = document.createElement('TBody');
  this.Table.appendChild(this.TableBody);
  this.Table.setAttribute('Child',this.TableBody);
}

function GRID_computVisview(objcell) { //判断所给出的单元格是否在视区之内
   var isInView = 0;
   var vCellRight =objcell.parentNode.offsetLeft + objcell.parentNode.offsetWidth;
   var vCellLeft = objcell.parentNode.offsetLeft;
   var vViewRight = this.scrollLeft + this.offsetWidth;
   var vViewLeft = this.scrollLeft;
   if(objcell.y == 0){
     this.scrollLeft = 0;
   }
   else{
     if(vCellRight > vViewRight-2){
       this.scrollLeft = vCellLeft;
     }
   }   
}
function GRID_oncellkeydown()
{
	switch(event.keyCode)
	{
		case 38://当按动向上箭头
			if(this.x>0)
		    {
              this.parent.Cells[this.x-1][this.y].focus();
			}
		    break;
		case 40://当按动向下箭头
			if(this.x<this.parent.Cells.length-1)
		    {
			  this.parent.Cells[this.x+1][this.y].focus();
		    } 
		    break;
		case 33://当按动向上翻动页面
			this.parent.doScroll('scrollbarPageUp');
		    break;
		case 34://当按动向上翻动页面
			this.parent.doScroll('scrollbarPageDown');
		    break;
	}
	if(this.parent.OnCellKeyDown){
	  this.parent.OnCellKeyDown(this,this.x,this.y,event.keyCode);
	}
}
function GRID_appendcell(cellflag,x,y,colobj)
//添加一个单元格，CELLFLAG标志可以表示它是不是表示状态的单元格
//ctlstring为元素的类型，typestring为子元素的类型针对input类型
{
 //*********************************************//
   var onecell = document.createElement('TD'); //构造一个单元格
   if(colobj){
     var ctlstring = null;var typestring = null;
	 var coltype=colobj.CtlType.toUpperCase();
     if(coltype=='TEXT'||coltype=='PASSWORD'||coltype=='CHECKBOX'){
       ctlstring = 'input';
       typestring = colobj.CtlType;
     }
     else{
       ctlstring = colobj.CtlType;
     }
   }
  //****************检测列的类型****************//
	
	var hidecell,cellbak;
	if(cellflag)
	{
		//////此处添加编辑单元格
		
		//*********************************************//
      if(ctlstring.toUpperCase() == 'SELECT' || ctlstring.toUpperCase() == 'LOOKUP'){//如果师复选框则要添加两种类型     
		  
		  ctlstring = 'input';//再将类型变成text;
		  typestring = 'TEXT';
		}
	
		//************首先处理为combobox的情况**********//
		
		//*****************所有类型相同的处理***********//
	   cellbak = document.createElement(ctlstring);//添加一个指定元素
	   if(typestring){            //如果有子类型设置子类型，主要针对input
        cellbak.type = typestring;
        if(typestring.toUpperCase() == 'CHECKBOX'){
           cellbak.DefaultValue = colobj.DefaultValue;
        }
      }

	   cellbak.style.cssText = colobj.style.cssText;
//	   cellbak.style.borderStyle ='solid';
	   cellbak.style.borderWidth =0;
   	   setFont(cellbak);
	   //控制单元格的格式
       cellbak.parent = this;
	   cellbak.x = x;  //单元格行坐标属性
	   cellbak.y = y;  //单元格列坐标属性
	   cellbak.readOnly=this.Columns.Column[y].readOnly;
       //为单元格添加新的属性
	   cellbak.onclick=GRID_Cell_onclick;
       cellbak.onfocus = GRID_oncellfocus;
	   cellbak.onblur = GRID_oncellblur;
	   cellbak.ondblclick=function(){if(this.parent.OnCellDblClick)this.parent.OnCellDblClick(this,this.x,this.y);}
      if(ctlstring != 'A'){
        cellbak.onkeydown = GRID_oncellkeydown;
	   }
	   //添加事件的处理
	   cellbak.style.height=this.RowHeight;
	   onecell.style.height=this.RowHeight;
	   onecell.appendChild(cellbak);	   
	   //*****************所有类型相同的处理***********//	   
	}
	else
	  {
		  onecell.innerText=' ';
		  onecell.setAttribute('x',0);
		  onecell.setAttribute('parent',this);
		  onecell.setAttribute('isEidt',false);
		  //此处为状态列的单元格
	  }
	 if(this.OnCustomCell)this.OnCustomCell(onecell,x,y);
	 return onecell;
}

function GRID_Cell_onclick() {     //click事件处理
   var type = this.parent.Columns.Column[this.y].CtlType;
   switch(type.toUpperCase()){
    case 'CHECKBOX' :
       if(this.checked){
         this.value = this.parent.Columns.Column[this.y].CheckedValue;
       }
       else{
         this.value = this.parent.Columns.Column[this.y].NoCheckValue;
       }
     break;  
    case 'SELECT':         //显示SELECT
	 if(!this.readOnly){
        var col = this.parent.Columns.Column[this.y];//取列
        this.style.width = 0;  //隐藏text
		if(!col.ComboBox){//lookup||combobox
          col.ComboBox = new Select('com',this.parentNode);  //添加行
		  col.ComboBox.options.Clear();
          for(var i=0;i<col.PickList.Count;i++){
			  col.ComboBox.options.Add(col.PickList.Strings[i]); //添加选项
		  }
          col.ComboBox.onblur = GRID_Combo_blur;    //设置失去焦点事件处理
        }
        else{
            this.parentNode.appendChild(col.ComboBox);
        }
        this.Brother = col.ComboBox;
        col.ComboBox.Brother = this;
        var comstyle = col.ComboBox.style;
        comstyle.visibility = 'visible';
        comstyle.width = col.CaptionCell.style.pixelWidth-4;
        comstyle.top = this.parentNode.offsetTop;
        comstyle.left = this.parentNode.offsetLeft;
        col.ComboBox.focus();
		col.ComboBox.Locate();
	 }
     break;  
    }
    if(this.parent.OnCellClick){  //如果用户自定义事件处理存在那么执行
       this.parent.OnCellClick(this,this.x,this.y);
    }
}

function GRID_Combo_blur() {
	if(!this.Brother)return;
    this.style.width = 0;
    this.Brother.style.visibility = 'visible'; //显示edit
    this.style.visibility = 'hidden'; //隐藏combobox
    this.Brother.style.width = this.Brother.parent.Columns.Column[this.Brother.y].width-4; //设置edit宽度
    this.Brother.parentNode.removeChild(this);
    this.Brother = null;
}
//添加一个空行，initflag标志是否是在表初始化的时候添加行，进行不同的处理
function GRID_appendrow(initflag)
{
  var cellarray = new Array();
  //一个临时的保存一行单元格的数组
  var deep=this.StateCells.length;
  //返回但前的行长度
  this.Rows[deep]= null;
  this.Rows[deep] = this._CreateRow();
  var rowcolor;
  if(isOddNumber(deep))
    rowcolor=clWhite;
  else
    rowcolor=clHightGray;
  var v,f;
  for(var i=0;i<this.Columns.Count+1;i++)
  {//处理单元格
    if(i>0 )
    {  
	    var cellflag = true;v=null;
        var  childcell = null;    	   
	     var col =this.Columns.Column[i-1];
	     childcell = this._appendCell(cellflag,deep,i-1,col);
	     //列控制
	     cellarray[i-1] = childcell.firstChild;
	     col.Cells[deep] = cellarray[i-1];
	     if(v != null){
	        if(col.CtlType == 'A'){
	           cellarray[i-1].innerText = v;
	           cellarray[i-1].href = v;
	        }
	        else{ 	               
	           if(col.CtlType.toUpperCase() == 'CHECKBOX'){	 
	               cellarray[i-1].defaultValue = v; 
	                cellarray[i-1].value = v;	                           
	               if(v == col.CheckedValue){	 
	                  cellarray[i-1].defaultChecked = true;                 
	                  cellarray[i-1].checked = true;
	               }
	              
	           }	
	             cellarray[i-1].value = v;
	        }	         
	     }
	    else{
	       var tp = col.CtlType;
	       if(tp == 'A'){
	           cellarray[i-1].innerText = null;
	       }
	       if(tp.toUpperCase() == 'CHECKBOX'){
	           cellarray[i-1].defaultValue = col.NoCheckValue;
	       }
	       if(tp.toUpperCase() == 'SELECT' || tp.toUpperCase() == 'PASSWORD'|| tp.toUpperCase() == 'TEXT' || tp.toUpperCase() == 'LOOKUP'){
	           cellarray[i-1].value = '';
	       }
       }
	   if(col.CaptionCell.style.pixelWidth)
	       cellarray[i-1].style.width = col.CaptionCell.style.pixelWidth-3;
	   cellarray[i-1].style.backgroundColor=rowcolor;
	   cellarray[i-1].title=v;
	 }
	 else
	 {
	   var cellflag = false;
	   var childcell = this._appendCell(cellflag,deep);
	   childcell.width = 10;
	   childcell.style.backgroundColor=rowcolor;
	   childcell.align='center';
	   setFont(childcell);
	   this.StateCells[deep] = childcell;
      //添加状态列单元格
	 }
    this.Rows[deep].appendChild(childcell); 
  }
  this.Cells[deep]=cellarray;//表的单元格
  this.Rows[deep].Cells=cellarray;//行的单元格控制
  this.TableBody.appendChild(this.Rows[deep]);//将此行添加到对象中
  this.Rows[deep].style.backgroundColor=rowcolor;
  this.RowsCount = this.RowsCount+1; 
  this.SetCurrentRow(deep);
  return this.Rows[deep];
}

function GRID_deleterow(index)
{
	if(index<0)return;
	if(!this.Rows[index])return;
	this.TableBody.removeChild(this.Rows[index]);
	//前台处理，去掉这一行的显示
	//以下为后台处理，主要是单元格的管理
	this.Rows[index].removeNode(true);
	this.Rows=this._ArrayRemove(this.Rows,index);
	//删除当前行数组
	this.Cells=this._ArrayRemove(this.Cells,index);
	//删除指定行的所有的单元格
	this.StateCells=this._ArrayRemove(this.StateCells,index);
	var count=this.Columns.Count;
	for(var i=0;i<count;i++)
	{
	   this.Columns.Column[i].Cells = this.Columns.ArrayRemove(this.Columns.Column[i].Cells,index);
	}
	//删除状态列单元格
	//数组管理

//	this.doScroll('scrollbarUp');
	
	if(index!=(this.RowsCount-1))
		//对每个单元格的x，即其行标属性进行更改
	{
      var counterx=this.Cells.length;//取得行数
 	   var countery=this.Columns.Count;;   //取得列数
	 
	   for(var i=index;i<counterx;i++)
	   {
		   for(var j=0;j<countery;j++)
		   {
			   this.Cells[i][j].x=i;//改变所有编辑单元格的行数标示
			   if(this.Cells[i][j].Brother){
			      this.Cells[i][j].Brother.x = i;
			   }
		   }
		   this.StateCells[i].x=i;//改变状态列单元格
	   }
	}
   this.RowsCount=this.RowsCount-1;	
   this.OldCurrentRow=-1;
   this.CurrentCell=null;
   if(index<this.RowsCount)
	   this.SetCurrentRow(index);
   else
	   if(this.RowsCount>0)this.SetCurrentRow(index-1);
}
function GRID_oncellfocus()//当编辑单元格获的焦点
{
   var p=this.parent;
   var ispost=false;  
   p.CurrentCell=this;
   this.select();
   p.SetCurrentRow(this.x);
   if(this.parent.OnCellFocus){  //如果用户自定义事件处理存在那么执行
       this.parent.OnCellFocus(this,this.x,this.y);
   }
}
//指定当前行
function GRID_SetCurrentRow(row){
   this.CurrentRow=row;
   var cell;
   if(this.OldCurrentRow>=0){
     cell=this.StateCells[this.OldCurrentRow];
	 cell.innerText=' ';
   }
   cell=this.StateCells[this.CurrentRow];
   if(cell)cell.innerText='>';
   this.OldCurrentRow=row;
}

function GRID_oncellblur()//当编辑单元格失去焦点
{
   if(this.parent.OnCellBlur){  //如果用户自定义事件处理存在那么执行
       this.parent.OnCellBlur(this,this.x,this.y);
   }
}
function GRID_N_Row()//一个建立row的函数，N代表不是GRID的成员函数
{
	var row = document.createElement('TR');
	var arr=new Array();
	row.setAttribute('State',0);//行状态
	row.setAttribute('Cells',arr);//行所包含的单元格
	row.setAttribute('IsFocus',R_isFocus);//检验当前行是否具有焦点
	return row;
}
function R_isFocus()//检测当前行是否失去焦点
{
	var cells=this.Cells;var r_focusflag=false;
	if(cells)
	{
		for(var i=0;i<cells.length;i++)
		{if(cells[i].FocusFlag){r_focusflag=true;break;}}//检验每一个单元是否都失去了焦点
	}
	return r_focusflag;
}
function Column(fieldname,displayname)//建立一个列的函数,N代表不是DG的成员函数
{
   var objcol = document.createElement('Column');
   objcol.CaptionCell = null;//表头单元格
   objcol.Visibled = true;  //是否可见
   objcol.Caption = '';     //标题
   objcol.BlackCell = null;  //空的表头单元格
   objcol.DataField = fieldname;//字段名称
   objcol.Cells = new Array();  //列的所有单元格
   objcol.CtlType = 'TEXT';     //控件的类型
   objcol.ComboBox = null;
   objcol.PickList = new Strings();  //如果类型是ComboBox时的填充字符串集
   objcol.SynchProperty = GRID_C_propertysynch;//同步普通属性
   objcol.NoCheckValue = null;
   objcol.CheckedValue = null;
   objcol.DefaultValue = null;
   objcol.Index = 0;         //索引
//   objcol.width = 150;
   objcol.onpropertychange = GRID_C_colchange;//同步列属性的改变
   
   if(displayname){
      objcol.Caption  = displayname;  
   }
   else{
      objcol.Caption  = fieldname;
   }
   return objcol;
}
// GRID_N_Columns object constructor
function Columns(pobj) {
   var objcols = new Object();
   objcols.Column = new Array(); //所有的列
   objcols.DisColCount = 0;      //显示的列的总数
   objcols.DisColIndex = new Array();  //显示的列的索引
   objcols.GetDisIndex = GRID_Cs_getdiscol; //获取显示的列的索引
   objcols.Add = GRID_Cs_addCol;      //添加一个列
   objcols.Del = GRID_Cs_delCol;      //删除一个列
   objcols.pdiv = pobj;         //取得父亲节点
   objcols.ArrayRemove = _arrayremove;  //从数组中移除一个元素
   objcols.Count=0;              //列的总行数
   objcols.Clear = GRID_CS_clearCols;
   return objcols;
}
function GRID_CS_clearCols() {
   for(var i = 0;i<this.Count;i++){
	this.Del(i);
   }
}
function GRID_Cs_getdiscol() {   //取得要显示的列的索引
   for(var i=0;i<this.Count;i++){
      if(this.Column[i].Visibled){
         this.DisColIndex[this.DisColIndex.length] = i;
      }
   }

}
function GRID_Cs_addCol(colobj) {
  this.pdiv.appendChild(colobj);//添加列元素，必须要做这个工作
  colobj.Parent=this;
  var deep = this.Column.length; //取得当前列数
  if(colobj.CtlType.toUpperCase()== 'CHECKBOX'){
     if(colobj.NoCheckValue == null) colobj.NoCheckValue = false;
     if(colobj.CheckedValue == null) colobj.CheckedValue = true;
     if(colobj.DefaultValue == null) colobj.DefaultValue = colobj.NoCheckValue;
  }
  this.Column[deep] = colobj;  //添加一列   
  this.Column[deep].Index = this.Column.length -1;  
  this.Count = this.Column.length;//重新列的总数   

	//添加列的标题	
  var cell = document.createElement('td');
  this.Parent.HeaderRow.appendChild(cell);
  cell.align='center';
  cell.innerText = colobj.Caption; //改变表头
  colobj.CaptionCell=cell;
  cell.Index=colobj.Index;
  if(!colobj.width)
	  cell.style.width=100;
  setFont(cell);
  cell.onmousemove=GRID_HEADCELL_onmousemove;
}
// mouse在表头moving的事件
function GRID_HEADCELL_onmousemove(){
	var x=event.offsetX;
	if(x>this.style.pixelWidth-5){
	  this.style.cursor='E-resize';
	  this.parentNode.parentNode.style.cursor='E-resize';
	  this.parentNode.parentNode.owner.currCol=this;
	}
	else{
	  if(event.button!=1){
		  if(this.parentNode.parentNode.owner.currCol!=null){
	   	      this.parentNode.parentNode.owner.currCol.style.cursor='default';
			  this.parentNode.parentNode.owner.currCol=null;
			  this.parentNode.parentNode.style.cursor='default';
		  }
		  else this.style.cursor='default';
	  }
	  else{
		  if(this.parentNode.parentNode.owner.currCol!=null)
			  this.style.cursor='E-resize';
	  }
	}
}

function GRID_Cs_delCol(index) {
  var cn = this.Column[index];
  this.pdiv.removeChild(cn); 
  cn.removeNode(true);
  this.ArrayRemove(this.Column,index); //删除该列
  this.Count = this.Column.length; //重新取得总的列数
}
function GRID_C_colchange() {
  if(event.srcElement==this)
  { 
    event.cancelBubble = true; //取消事件捕捉
    switch(event.propertyName)//判断改变的属性的名称
    {
     case 'Caption':
          this.CaptionCell.innerText = this.Caption; //改变表头
     break;
     case 'width':
          this.CaptionCell.style.width = this.width; //改变表头
     break;
     case 'ComboItems':
         this.ComboBox.ComboItems = this.ComboItems;
     break;
     case 'DefaultValue':
         if(this.DefaultValue != this.NoCheckValue ||this.DefaultValue != this.CheckedValue){
            this.DefaultValue = this.NoCheckValue;
         }
     break;
	 case 'readOnly':
		 this.SynchProperty(event.propertyName);
	 break;
	}
  }
  event.cancelBubble = false; //恢复事件捕捉
}
function GRID_C_propertysynch(propertyname){
	if(propertyname){
	   for(var i=0;i<this.Cells.length;i++){
		   this.Cells[i].setAttribute(propertyname,this.getAttribute(propertyname,1));
	   }
	}
}
