//*****************************************************
//  Function: FormatCell
// Arguments: string  for cell
//            string  font face
//            integer font size
//            boolean bold
//            boolean italic
//            string  font color
//            string  hyperlink
//            string  hyperling name property
//            string  background color
//            boolean b_nowrap
//            integer rowspan
//            integer colspan
//            integer width
//            integer height
//            string  halign ( "top" "bottom" )
//            string  valign ( "left" "center" "right" )
//   Returns: Formatted Cell
//     Calls: FormatString
//*****************************************************
//      Call: FormatCell( data, font, size, b_bold, b_italic, color, link, linkname,
//                        backcolor, b_nowrap, rowspan, colspan, width, heigth, halign, valign )
//    Output: <TD BGCOLOR="backcolor" NOWRAP ROWSPAN=rowspan COLSPAN=colspan
//                WIDTH=width HEIGHT=height HALING=halign VALIGN=valign>
//            FormatString( data, font, size, b_bold, b_italic, color, link, linkname );
//            </TD>
//*****************************************************
//    Author: Jan Wielemans - 199901
//*****************************************************

function FormatCell( data ) {

  var font      = FormatCell.arguments[1];
  var size      = FormatCell.arguments[2];
  var b_bold    = FormatCell.arguments[3];
  var b_italic  = FormatCell.arguments[4];
  var color     = FormatCell.arguments[5];
  var link      = FormatCell.arguments[6];
  var linkname  = FormatCell.arguments[7];
  var backcolor = FormatCell.arguments[8];
  var b_nowrap  = FormatCell.arguments[9];
  var rowspan   = FormatCell.arguments[10];
  var colspan   = FormatCell.arguments[11];
  var width     = FormatCell.arguments[12];
  var heigth    = FormatCell.arguments[13];
  var halign    = FormatCell.arguments[14];
  var valign    = FormatCell.arguments[15];

  var FormattedCell = "";

  var b_backcolor = false;
  var b_rowspan   = false;
  var b_colspan   = false;
  var b_width     = false;
  var b_heigth    = false;
  var b_halign    = false;
  var b_valign    = false;

  if ( backcolor != "")
    b_backcolor = true;
  if ( rowspan != "")
    b_rowspan = true;
  if ( colspan != "")
    b_colspan = true;
  if ( width != "")
    b_width = true;
  if ( heigth != "")
    b_heigth = true;
  if ( halign != "")
    b_halign = true;
  if ( valign != "")
    b_valign = true;

  FormattedCell  += "<TD";

  if ( b_backcolor )
    FormattedCell  += ' BGCOLOR="' + backcolor + '"';
  if ( b_nowrap )
    FormattedCell  += " NOWRAP";
  if ( b_rowspan )
    FormattedCell  += ' ROWSPAN="' + rowspan + '"';
  if ( b_colspan )
    FormattedCell  += ' COLSPAN="' + colspan + '"';
  if ( b_width )
    FormattedCell  += ' WIDTH="' + width + '"';
  if ( b_heigth )
    FormattedCell  += ' HEIGTH="' + heigth + '"';
  if ( b_halign )
    FormattedCell  += ' HALIGN="' + halign + '"';
  if ( b_valign )
    FormattedCell  += ' VALIGN="' + valign + '"';

  FormattedCell    += ">";

  FormattedCell    += FormatString( data, font, size, b_bold, b_italic, color, link, linkname );

  FormattedCell    += "</TD>";

  return FormattedCell;
}