// xGetElementById, Copyright 2001-2005 Michael Foster (Cross-Browser.com)
// Part of X, a Cross-Browser Javascript Library, Distributed under the terms of the GNU LGPL
function xGetElementById(e) {
  if(typeof(e)!='string') return e;
  if(document.getElementById) e=document.getElementById(e);
  else if(document.all) e=document.all[e];
  else e=null;
  return e;
}

// xTableColDisplay, Copyright 2004-2005 Michael Foster (Cross-Browser.com)
// Part of X, a Cross-Browser Javascript Library, Distributed under the terms of the GNU LGPL
function xTableColDisplay(bShow, tableId, nCol, firstDataColumn) {
  var r;
  tableId = xGetElementById(tableId);
  if (tableId && nCol < tableId.rows[0].cells.length) {
    for (r = 0; r < tableId.rows.length; ++r) {
      tableId.rows[r].cells[nCol].style.display = bShow ? '' : 'none';
    }
    if(bShow) {
      for(c=0;c<firstDataColumn;c++) {
      	if(tableId.rows[0].cells[c].style.display=="none") {
		    for (r = 0; r < tableId.rows.length; ++r) {
    		  tableId.rows[r].cells[c].style.display = "";
    		}
      	}      
      }
    }
  }
}


function showHideAll(isShow,tableId,showHideFormId) {
  table=xGetElementById(tableId);
  if(table) {
    for (c = 0; c < table.rows[0].cells.length; c++) {
      for (r = 0; r < table.rows.length; ++r) {
        table.rows[r].cells[c].style.display = isShow ? '' : 'none';
      }
    }
  }
  chk = isShow ? 'checked' : '';
  for(i=0;i<xGetElementById(showHideFormId).length;i++) {
  	xGetElementById(showHideFormId)[i].checked=chk;	
  }
}