/************************************************************
*           web-sn_maketbl.js - part of EditAce             *
*           copyright Simon Norris 2002                     *
*           email: si@web-sn.com                            *
*           EditAce home page: http://www.web-sn.com        *
*                                                           *
*           Removal or modification of this notice is       *
*		    a violation of copyright and the terms of use   *
*           Last Modified: June 24 2002                     *
************************************************************/



//included from tbl.html

  var tblArr = new Array();
// create the array of table info to pass back to the main window

function websn_createTable() {
  // get form info
  var rows = document.all['rows'].value;
  var cols = document.all['cols'].value;
  var width = document.all['width'].value;
  var border = document.all['border'].value;
  var cellp = document.all['cellpadding'].value;
  var cellsp = document.all['cellspacing'].value;
  var id = document.all['tblid'].value;
  var tblclass = document.all['tblclass'].value;
  var valign = document.all['valign'].options(document.all['valign'].selectedIndex).value;
  var align = document.all['align'].options(document.all['align'].selectedIndex).value;
  var height = document.all['height'].value;
  var tdclass = document.all['tdclass'].value;
  var bgcolor = document.all['chbgcolor'].value;
  var caption = document.all['caption'].value;
  
  tblArr['NumRows'] = rows;
  tblArr['NumCols'] = cols;
  tblArr['TableAttrs'] = "class='" + tblclass + "' id='" + id + "' border='" + border + "' width='" + width + "' cellspacing='" + cellp + "' cellpadding='" + cellsp + "'";
  tblArr['CellAttrs'] = "class='" + tdclass + "' valign='" + valign + "' align='" + align + "' height='" + height + "' bgcolor='" + bgcolor + "'";
  tblArr['Caption'] = caption;
  window.returnValue = tblArr; // return table info to main window 
  window.close();
}


// update the colour indicator if the textbox is manually changed
function update(el) {
  document.all['shbgcolor'].style.background = el.value;
}

// update the colour indicator and associated textbox with the returned value from the popup
function showCol() {
  col = websn_getTblCol();
  if (col != "" && col != null) {
    document.all['chbgcolor'].value = col;
    document.all['shbgcolor'].style.background = col;
  }
}

function websn_getTblCol() {
 if (document.createAttribute) {
   var retCol = top.dlgColHelperTbl.ChooseColorDlg();
   retCol = retCol.toString(16);
   if (retCol.length < 6) {
     var tmp = "000000".substring(0,6-retCol.length);
     retCol = tmp.concat(retCol);
	 var c = 66;
   }
 }
 else {
  bascol = showModalDialog("colpick.html", "", "dialogWidth:350px; dialogHeight:370px; status:no; help:no");
  if (bascol != null) {
    retCol = bascol['col'];
  }
 }
 return retCol;
}
