<?php
/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
// +----------------------------------------------------------------------+
// | PHP version 4/5                                                      |
// +----------------------------------------------------------------------+
// | Copyright (c) 2005-2006 ARMIA INC                                    |
// +----------------------------------------------------------------------+
// | This source file is a part of iScripts EasyCreate 1.1                 |
// +----------------------------------------------------------------------+
// | Authors: jimmy<jimmy.jos@armia.com>        		              	  |
// |          									                          |
// +----------------------------------------------------------------------+
//Used to create a table using javascript functions
include "../includes/session.php";
include "../includes/config.php";
$currentloc="../";	  
include "../includes/applicationheader.php";
?>
<script>
var theArg = window.dialogArguments;
 
//Changes the background color of the element bgtd
//This color will be used while constructing the table using javascript.
function changefontcolor1(colorType){

  var Callcolordialog1 = colordialog1.ChooseColorDlg();
  Callcolordialog1 = Callcolordialog1.toString(16);
  if(Callcolordialog1 !="0"){
	  if (Callcolordialog1.length < 6) {
	   var Temp = "000000".substring(0,6-Callcolordialog1.length);
	   Callcolordialog1 = Temp.concat(Callcolordialog1);
	  }
	  document.getElementById("bgtd").style.backgroundColor="#"+Callcolordialog1;
  }
return ;
}
//This function is called by user clicking on the CreateTable button.
//It takes various values for the parameters and assign it to the object s and set s as the 
//return value of the window, then close the window.
function savetblpro(){
	s = new Object();
	s.rows = document.getElementById("trows").value;
	s.columns = document.getElementById("tcolumns").value;
	s.cellPadding=document.getElementById("tcellpading").value;
	s.cellSpacing=document.getElementById("tcellspacing").value;
	s.border=document.getElementById("tborder").value;
	s.width=document.getElementById("twidth").value;
	
	s.bgColor=document.getElementById("bgtd").style.backgroundColor;
	window.returnValue =s;
	window.close();
}
//The user clicks the 'Cancel' button to invoke this function.
//returnValue for the window is set to "" before closing the window. 
function canceltblpro() {
	window.returnValue="";
	window.close();
}
</script>

<body>
<OBJECT id=colordialog1 height=0px width=0px  classid=clsid:3050f819-98b5-11cf-bb82-00aa00bdce0b></OBJECT>
<table>
	<tr>
		<td>
		<fieldset>
		<legend  class="maintext"><b>Create Table</b></legend>
  <table>
      <form name=tableproper method=post>
      <tr>
	     <td width="97" class="maintext">Background</td>
		 <td width="2">&nbsp;</td>
		 <td colspan="3"><input id=bgtd size=5 readonly>
		 </td>
	     <td width="72"><input type=button value=".." onclick="changefontcolor1(2);"  class="editorbutton"></td>
         <td width="19">&nbsp;</td>
      </tr>
	  <tr>
	     <td class="maintext">Columns</td>
		 <td>&nbsp;</td>
		 <td colspan="3"><input type=text id=tcolumns name=tcolumns size=3></td>
		  <td width="72" class="maintext">Rows</td>
		 <td width="19"><input type=text id=trows name=trows size=3></td>
	  </tr>
	  <tr>
	     <td class="maintext">Cell Padding</td>
		 <td>&nbsp;</td>
		 <td colspan="3"><input type=text id=tcellpading name=tcellpading size=3></td>
		  <td class="maintext">CellSpacing</td>
		 <td><input type=text id=tcellspacing name=tcellspacing size=3></td>
	  </tr>
	  <tr>
	     <td class="maintext">Border</td>
		 <td>&nbsp;</td>
		 <td colspan="3"><input type=text id=tborder  size=3></td>
		  <td class="maintext">Width</td>
		 <td><input type=text id=twidth  size=3></td>
	  </tr>
	  <tr>
	    <td colspan="6" align="center">
            <input type=button value="Create Table" onClick="savetblpro();" class="editorbutton">
          <input type=button value="Cancel"  onClick="canceltblpro();"  class="editorbutton"></td>
		<td>&nbsp;</td>
	  </tr>
	  </form>
	  	
  </table>
  </fieldset>
	</td>
	</tr>
</table>
<?php
  include "./includes/editorfooter.php";
?> 
