<?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>        		              	  |
// +----------------------------------------------------------------------+
//Modifying a table in the editable area.
//It modifies the table properties using javascript.
include "../includes/session.php";
include "../includes/config.php";
$currentloc="../";	  
include "../includes/applicationheader.php";
?>
<script>
 var theArg = window.dialogArguments;
 
 //Change border color of the table
 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 ;
 }
 //change backcolor of the table
 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 ;
 }
 //modify table
 //create an object with attribute values as given by the user input fields
 //set the returnValue as object and close the 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();
 }
 //called at the time of loading
 //sets values in the object theArg to the input fields in the document 
 function loadvalues(){
  document.getElementById("tcellpading").value=theArg.getAttribute('cellspacing');
  document.getElementById("tcellspacing").value=theArg.getAttribute('cellspacing');
  document.getElementById("tborder").value=theArg.border;
  document.getElementById("twidth").value=theArg.width;
  document.getElementById("bgtd").style.backgroundColor=theArg.getAttribute('borderColor');
  document.getElementById("bgclr").style.backgroundColor=theArg.getAttribute('bgColor');
  //window.returnValue =s;
 }
 //sets the returnValue as "" and closes the window.
function canceltblpro() {
 	window.returnValue="";
	window.close();
}
</script>
<body onload="loadvalues()">
<OBJECT id=colordialog1 height=0px width=0px  classid=clsid:3050f819-98b5-11cf-bb82-00aa00bdce0b></OBJECT>
<table>
	<tr>
		<td width="2%"></td>
		<td width="96%">
			<fieldset><legend class="maintext"><b>Modify table properties</b></legend>
			<table>
				  <form name=tableproper method=post>
				  <tr>
					 <td width="71" class="maintext">Align</td>
					 <td width="83">
						<select id=talign>
						  <option value="left">left</option>
						  <option value="right">right</option>
						  <option value="center">center</option>
						</select>
					 </td>
					 <td width="70" class="maintext">Width</td>
					 <td width="58"><input type=text id=twidth  size=5></td> 
				  </tr>
				  <tr>
					 <td class="maintext">Cell Padding</td>
					 <td><input type=text id=tcellpading name=tcellpading size=5></td>
					  <td class="maintext">CellSpacing</td>
					 <td><input type=text id=tcellspacing name=tcellspacing size=5></td>
				  </tr>
				  <tr>
					 <td class="maintext">Border</td>
					 <td><input type=text id=tborder  size=5></td>
					 <td class="maintext">BorderColor</td>
					 <td><input id=bgtd size=5 readonly style="background-color: red"><input class=editorbutton type=button value=".." onclick="changefontcolor1(2);"></td>
					  
				  </tr>
				  <tr>
					 <td>&nbsp;</td>
					 <td>&nbsp;</td>
					 <td class="maintext">BackColor</td>
					 <td><input id=bgclr size=5 readonly style="background-color:white"><input class=editorbutton  type=button value=".." onclick="changefontcolor2(2);"></td>
					  
				  </tr>
				  <tr>
					<td colspan=2 align="right"><input type=button value="Modify Table" onclick="savetblpro();" class="editorbutton"></td>
					<td colspan=2><input type=button value="Cancel" onclick="canceltblpro();" class="editorbutton"></td>
				  </tr>
				  </form>
			  </table>
			 </fieldset>
		</td>
		<td width="2%"></td>
	</tr>
</table>
<?php
  include "./includes/editorfooter.php";
?> 
