<?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: sudheesh<sudheesh@armia.com>        		              	  |
// |          									                          |
// +----------------------------------------------------------------------+
  include "../includes/session.php";
  include "../includes/config.php";
  include "../includes/function.php";
  $currentloc="../";
  include "../includes/applicationheader.php";
?>
<script>
function checkNumber(t)
{
    t . value = parseInt(t . value);
    if (t . value . length == 0 || isNaN(t . value) || t . value . substr(0, 1) == " " || parseInt(t . value) < 0) {
        t . value = "";
        alert("Please enter numeric value");
    } 
} 
var theArg = window . dialogArguments;
function canceltblpro()
{
    window . returnValue = "";
    window . close();
} 
/* used to change the table background color*/
function changefontcolor1(colorType)
{
    var Callcolordialog1 = colordialog1 . ChooseColorDlg();
    Callcolordialog1 = Callcolordialog1 . toString(16);
	/* if the user close the window without selecting the color nothing to be done*/
    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 ;
} 
function changefontcolor2(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("bgclr") . style . backgroundColor = "#" + Callcolordialog1;
    } 
    return ;
} 
/* set the new table properties into object s.this object is then returned to parent window
*/
function savetblpro()
{
    s = new Object();
    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 . align = document . getElementById("talign") . value;
    s . bgColor = document . getElementById("bgclr") . style . backgroundColor;
    s . borderColor = document . getElementById("bgtd") . style . backgroundColor;
    window . returnValue = s;
    window . close();
} 
/* set the values
   when calling this page table properties are passed as an object argument -theArg
*/
function loadvalues()
{
    var widthwithpercentage;
    var widthwithoutpercentage;
    widthwithpercentage = theArg . width;
	/* trim the '%' in width */
    if (widthwithpercentage . substr(widthwithpercentage . length-1, widthwithpercentage . length) == "%")
        widthwithoutpercentage = widthwithpercentage . substr(0, widthwithpercentage . length-1);
    else
        widthwithoutpercentage = widthwithpercentage; 
   
    document . getElementById("talign") . value = theArg . align;
    document . getElementById("tcellpading") . value = theArg . getAttribute('cellspacing');
    document . getElementById("tcellspacing") . value = theArg . getAttribute('cellspacing');
    document . getElementById("tborder") . value = theArg . border;
    document . getElementById("twidth") . value = widthwithoutpercentage;
    document . getElementById("bgtd") . style . backgroundColor = theArg . getAttribute('borderColor');
    document . getElementById("bgclr") . style . backgroundColor = theArg . getAttribute('bgColor'); 
  
} 	

</script>
<body onload="loadvalues()">
<OBJECT id=colordialog1 height=0px width=0px  classid=clsid:3050f819-98b5-11cf-bb82-00aa00bdce0b></OBJECT>
<table width="100%" align=center>
      <tr>
	     <td align=center>
		    <FIELDSET>
					      <legend class=maintextbold>Table Properties</legend>
						  <table width="100%" border=0>
						      <form name=tableproper method=post>
						      <tr>
							     <td class=maintext align=left>Align</td>
								 <td align=left>
								    <select id=talign class=selectbox>
									  <option value="left">left</option>
									  <option value="right">right</option>
									  <option value="center">center</option>
									</select>
								 </td>
								 <td class=maintext align=left>Width</td>
								 <td class=maintext align=left><input class=textbox type=text id=twidth  size=5  maxlength=3 onBlur="javascript:checkNumber(this);">%</td> 
							  </tr>
							  <tr>
							     <td class=maintext align=left>Cell Padding</td>
								 <td align=left><input class=textbox type=text id=tcellpading name=tcellpading size=5  maxlength=2 onBlur="javascript:checkNumber(this);"></td>
								  <td class=maintext align=left>CellSpacing</td>
								 <td align=left><input class=textbox type=text id=tcellspacing name=tcellspacing size=5  maxlength=2 onBlur="javascript:checkNumber(this);"></td>
							  </tr>
							  <tr>
							     <td class=maintext align=left>Border</td>
								 <td align=left><input class=textbox type=text id=tborder  size=5  maxlength=2 onBlur="javascript:checkNumber(this);"></td>
								 <td class=maintext align=left>BorderColor</td>
								 <td align=left><input class=textbox id=bgtd size=5 readonly style="background-color: red"><input class=button type=button value=".." onclick="changefontcolor1(2);"></td>
								  
							  </tr>
							  <tr>
							     <td>&nbsp;</td>
								 <td>&nbsp;</td>
								 <td class=maintext align=left>BackColor</td>
								 <td align=left><input class=textbox id=bgclr size=5 readonly style="background-color:white"><input class=button type=button value=".." onclick="changefontcolor2(2);"></td>
								  
							  </tr>
							  <tr>
							    <td colspan=2><input class=button type=button value="Modify Table" onclick="savetblpro();"></td>
								<td colspan=2><input class=button type=button value="Cancel" onclick="canceltblpro();"></td>
							  </tr>
							  </form>
						  </table>
			 </FIELDSET>
		 </td>
	</tr>
</table>		 	 			  
<?php
  include "./includes/editorfooter.php";
?>  