<HTML>
<HEAD>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<meta HTTP-EQUIV=Expires CONTENT=0>
<Link rel="stylesheet" type="text/css" href="pop.css">
<script language="JavaScript">
var sAction = "INSERT";
var sTitle = "&#25554;&#20837;";
var oControl;
var oSeletion;
var sRangeType;
var sRow = "1";
var sCol = "1";
var sAlign = "";
var sBorder = "1";
var sCellPadding = "3";
var sCellSpacing = "2";
var sWidth = "";
var sBorderColor = "#CCCCCC";
var sBgColor = "#FFFFFF";
var sWidthUnit = "%"
var bCheck = true;
var bWidthDisable = false;
var sWidthValue = "100"

oSelection = dialogArguments.Dvbbs_Composition.document.selection.createRange();
sRangeType = dialogArguments.Dvbbs_Composition.document.selection.type;
if (sRangeType == "Control") {
	if (oSelection.item(0).tagName == "TABLE"){
		sAction = "MODI";
		sTitle = "&#20462;&#25913;";
		oControl = oSelection.item(0);
		sRow = oControl.rows.length;
		sCol = getColCount(oControl);
		sAlign = oControl.align;
		sBorder = oControl.border;
		sCellPadding = oControl.cellPadding;
		sCellSpacing = oControl.cellSpacing;
		sWidth = oControl.width;
		sBorderColor = oControl.borderColor;
		sBgColor = oControl.bgColor;
	}
}
document.write("<TITLE>Dvbbs&#22810;&#21151;&#33021;&#32534;&#36753;&#22120;--&#34920;&#26684;&#23646;&#24615;[" + sTitle + "]</TITLE>");
// &#21021;&#22987;&#20540;
function InitDocument(){
	SearchSelectValue(d_align, sAlign.toLowerCase());

	// &#20462;&#25913;&#29366;&#24577;&#26102;&#21462;&#20540;
	if (sAction == "MODI"){
		if (sWidth == ""){
			bCheck = false;
			bWidthDisable = true;
			sWidthValue = "100";
			sWidthUnit = "%";
		}else{
			bCheck = true;
			bWidthDisable = false;
			if (sWidth.substr(sWidth.length-1) == "%"){
				sWidthValue = sWidth.substring(0, sWidth.length-1);
				sWidthUnit = "%";
			}else{
				sWidthUnit = "";
				sWidthValue = parseInt(sWidth);
				if (isNaN(sWidthValue)) sWidthValue = "";
			}
		}
	}

	switch(sWidthUnit){
	case "%":
		d_widthunit.selectedIndex = 1;
		break;
	default:
		sWidthUnit = "";
		d_widthunit.selectedIndex = 0;
		break;
	}

	d_row.value = sRow;
	d_col.value = sCol;
	d_border.value = sBorder;
	d_cellspacing.value = sCellSpacing;
	d_cellpadding.value = sCellPadding;
	d_widthvalue.value = sWidthValue;
	d_widthvalue.disabled = bWidthDisable;
	d_widthunit.disabled = bWidthDisable;
	d_bordercolor.value = sBorderColor;
	s_bordercolor.style.backgroundColor = sBorderColor;
	d_bgcolor.value = sBgColor;
	s_bgcolor.style.backgroundColor = sBgColor;
	d_check.checked = bCheck;


}

// &#25628;&#32034;&#19979;&#25289;&#26694;&#20540;&#19982;&#25351;&#23450;&#20540;&#21305;&#37197;&#65292;&#24182;&#36873;&#25321;&#21305;&#37197;&#39033;
function SearchSelectValue(o_Select, s_Value){
	for (var i=0;i<o_Select.length;i++){
		if (o_Select.options[i].value == s_Value){
			o_Select.selectedIndex = i;
			return true;
		}
	}
	return false;
}

// &#36873;&#39068;&#33394;
function SelectColor(what){
	var dEL = document.all("d_"+what);
	var sEL = document.all("s_"+what);
	//var url = "selcolor.htm?color="+encodeURIComponent(dEL.value);
	//var arr = showModalDialog(url,window,"dialogWidth:280px;dialogHeight:250px;help:no;scroll:no;status:no");
	var arr = showModalDialog("selcolor.html", "", "dialogWidth:18.5em; dialogHeight:17.5em; status:0; help:0");
	if (arr) {
		dEL.value=arr;
		sEL.style.backgroundColor=arr;
	}
}
// &#26159;&#21542;&#26377;&#25928;&#39068;&#33394;&#20540;
function IsColor(color){
	var temp=color;
	if (temp=="") return true;
	if (temp.length!=7) return false;
	return (temp.search(/\#[a-fA-F0-9]{6}/) != -1);
}
// &#21482;&#20801;&#35768;&#36755;&#20837;&#25968;&#23383;
function IsDigit(){
  return ((event.keyCode >= 48) && (event.keyCode <= 57));
}
// &#21028;&#26029;&#20540;&#26159;&#21542;&#22823;&#20110;0
function MoreThanOne(obj, sErr){
	var b=false;
	if (obj.value!=""){
		obj.value=parseFloat(obj.value);
		if (obj.value!="0"){
			b=true;
		}
	}
	if (b==false){
		BaseAlert(obj,sErr);
		return false;
	}
	return true;
}

// &#24471;&#21040;&#34920;&#26684;&#21015;&#25968;
function getColCount(oTable) {
	var intCount = 0;
	if (oTable != null) {
		for(var i = 0; i < oTable.rows.length; i++){
			if (oTable.rows[i].cells.length > intCount) intCount = oTable.rows[i].cells.length;
		}
	}
	return intCount;
}

// &#22686;&#21152;&#34892;
function InsertRows( oTable ) {
	if ( oTable ) {
		var elRow=oTable.insertRow();
		for(var i=0; i<oTable.rows[0].cells.length; i++){
			var elCell = elRow.insertCell();
			elCell.innerHTML = "&nbsp;";
		}
	}
}

// &#22686;&#21152;&#21015;
function InsertCols( oTable ) {
	if ( oTable ) {
		for(var i=0; i<oTable.rows.length; i++){
			var elCell = oTable.rows[i].insertCell();
			elCell.innerHTML = "&nbsp;"
		}
	}
}

// &#21024;&#38500;&#34892;
function DeleteRows( oTable ) {
	if ( oTable ) {
		oTable.deleteRow();
	}
}

// &#21024;&#38500;&#21015;
function DeleteCols( oTable ) {
	if ( oTable ) {
		for(var i=0;i<oTable.rows.length;i++){
			oTable.rows[i].deleteCell();
		}
	}
}

</script>

<SCRIPT event=onclick for=Ok language=JavaScript>
	// &#36793;&#26694;&#39068;&#33394;&#30340;&#26377;&#25928;&#24615;
	sBorderColor = d_bordercolor.value;
	if (!IsColor(sBorderColor)){
		BaseAlert(d_bordercolor,'&#26080;&#25928;&#30340;&#36793;&#26694;&#39068;&#33394;&#20540;&#65281;');
		return;
	}
	// &#32972;&#26223;&#39068;&#33394;&#30340;&#26377;&#25928;&#24615;
	sBgColor = d_bgcolor.value;
	if (!IsColor(sBgColor)){
		BaseAlert(d_bgcolor,'&#26080;&#25928;&#30340;&#32972;&#26223;&#39068;&#33394;&#20540;&#65281;');
		return;
	}
	// &#34892;&#25968;&#30340;&#26377;&#25928;&#24615;
	if (!MoreThanOne(d_row,'&#26080;&#25928;&#30340;&#34892;&#25968;&#65292;&#33267;&#23569;&#35201;1&#34892;&#65281;')) return;
	// &#21015;&#25968;&#30340;&#26377;&#25928;&#24615;
	if (!MoreThanOne(d_col,'&#26080;&#25928;&#30340;&#21015;&#25968;&#65292;&#33267;&#23569;&#35201;1&#21015;&#65281;')) return;
	// &#36793;&#32447;&#31895;&#32454;&#30340;&#26377;&#25928;&#24615;
	if (d_border.value == "") d_border.value = "0";
	if (d_cellpadding.value == "") d_cellpadding.value = "0";
	if (d_cellspacing.value == "") d_cellspacing.value = "0";
	// &#21435;&#21069;&#23548;0
	d_border.value = parseFloat(d_border.value);
	d_cellpadding.value = parseFloat(d_cellpadding.value);
	d_cellspacing.value = parseFloat(d_cellspacing.value);
	// &#23485;&#24230;&#26377;&#25928;&#20540;&#24615;
	var sWidth = "";
	if (d_check.checked){
		if (!MoreThanOne(d_widthvalue,'&#26080;&#25928;&#30340;&#34920;&#26684;&#23485;&#24230;&#65281;')) return;
		sWidth = d_widthvalue.value + d_widthunit.value;
	}

	sRow = d_row.value;
	sCol = d_col.value;
	sAlign = d_align.options[d_align.selectedIndex].value;
	sBorder = d_border.value;
	sCellPadding = d_cellpadding.value;
	sCellSpacing = d_cellspacing.value;

	if (sAction == "MODI") {
		// &#20462;&#25913;&#34892;&#25968;
		var xCount = sRow - oControl.rows.length;
  		if (xCount > 0)
	  		for (var i = 0; i < xCount; i++) InsertRows(oControl);
  		else
	  		for (var i = 0; i > xCount; i--) DeleteRows(oControl);
		// &#20462;&#25913;&#21015;&#25968;
  		var xCount = sCol - getColCount(oControl);
  		if (xCount > 0)
  			for (var i = 0; i < xCount; i++) InsertCols(oControl);
  		else
  			for (var i = 0; i > xCount; i--) DeleteCols(oControl);

		try {
			oControl.width = sWidth;
		}
		catch(e) {
			//alert("&#23545;&#19981;&#36215;&#65292;&#35831;&#24744;&#36755;&#20837;&#26377;&#25928;&#30340;&#23485;&#24230;&#20540;&#65281;\n&#65288;&#22914;&#65306;90%  200  300px  10cm&#65289;");
		}

		oControl.align			= sAlign;
  		oControl.border			= sBorder;
  		oControl.cellSpacing	= sCellSpacing;
  		oControl.cellPadding	= sCellPadding;
  		oControl.borderColor	= sBorderColor;
  		oControl.bgColor		= sBgColor;

	}else{
		var sTable = "<table align='"+sAlign+"' border='"+sBorder+"' cellpadding='"+sCellPadding+"' cellspacing='"+sCellSpacing+"' width='"+sWidth+"' bordercolor='"+sBorderColor+"' bgcolor='"+sBgColor+"'>";
		for (var i=1;i<=sRow;i++){
			sTable = sTable + "<tr>";
			for (var j=1;j<=sCol;j++){
				sTable = sTable + "<td>&nbsp;</td>";
			}
			sTable = sTable + "</tr>";
		}
		sTable = sTable + "</table>";
	}
	window.returnValue = sTable;
	window.close();
</SCRIPT>

</head>
<body bgcolor=menu onload="InitDocument()">

<table border=0 cellpadding=0 cellspacing=0 align=center>
<tr>
	<td>
	<fieldset>
	<legend>&#34920;&#26684;&#22823;&#23567;</legend>
	<table border=0 cellpadding=0 cellspacing=0>
	<tr><td colspan=9 height=5></td></tr>
	<tr>
		<td width=7></td>
		<td>&#34920;&#26684;&#34892;&#25968;:</td>
		<td width=5></td>
		<td><input type=text id=d_row size=10 value="" ONKEYPRESS="event.returnValue=IsDigit();" maxlength=3></td>
		<td width=40></td>
		<td>&#34920;&#26684;&#21015;&#25968;:</td>
		<td width=5></td>
		<td><input type=text id=d_col size=10 value="" ONKEYPRESS="event.returnValue=IsDigit();" maxlength=3></td>
		<td width=7></td>
	</tr>
	<tr><td colspan=9 height=5></td></tr>
	</table>
	</fieldset>
	</td>
</tr>
<tr><td height=5></td></tr>
<tr>
	<td>
	<fieldset>
	<legend>&#34920;&#26684;&#24067;&#23616;</legend>
	<table border=0 cellpadding=0 cellspacing=0>
	<tr><td colspan=9 height=5></td></tr>
	<tr>
		<td width=7></td>
		<td>&#23545;&#40784;&#26041;&#24335;:</td>
		<td width=5></td>
		<td>
			<select id="d_align" style="width:72px">
			<option value=''>&#40664;&#35748;</option>
			<option value='left'>&#24038;&#23545;&#40784;</option>
			<option value='center'>&#23621;&#20013;</option>
			<option value='right'>&#21491;&#23545;&#40784;</option>
			</select>
		</td>
		<td width=40></td>
		<td>&#36793;&#26694;&#31895;&#32454;:</td>
		<td width=5></td>
		<td><input type=text id=d_border size=10 value="" ONKEYPRESS="event.returnValue=IsDigit();"></td>
		<td width=7></td>
	</tr>
	<tr><td colspan=9 height=5></td></tr>
	<tr>
		<td width=7></td>
		<td>&#21333;&#20803;&#38388;&#36317;:</td>
		<td width=5></td>
		<td><input type=text id=d_cellspacing size=10 value="" ONKEYPRESS="event.returnValue=IsDigit();" maxlength=3></td>
		<td width=40></td>
		<td>&#21333;&#20803;&#36793;&#36317;:</td>
		<td width=5></td>
		<td><input type=text id=d_cellpadding size=10 value="" ONKEYPRESS="event.returnValue=IsDigit();" maxlength=3></td>
		<td width=7></td>
	</tr>
	<tr><td colspan=9 height=5></td></tr>
	</table>
	</fieldset>
	</td>
</tr>
<tr><td height=5></td></tr>
<tr>
	<td>
	<fieldset>
	<legend>&#34920;&#26684;&#23485;&#24230;</legend>
	<table border=0 cellpadding=0 cellspacing=0 width='100%'>
	<tr><td colspan=9 height=5></td></tr>
	<tr>
		<td width=7></td>
		<td onclick="d_check.click()" noWrap valign=middle><input id="d_check" type="checkbox" onclick="d_widthvalue.disabled=(!this.checked);d_widthunit.disabled=(!this.checked);" value="1"> &#25351;&#23450;&#34920;&#26684;&#30340;&#23485;&#24230;</td>
		<td align=right width="60%">
			<input name="d_widthvalue" type="text" value="" size="5" ONKEYPRESS="event.returnValue=IsDigit();" maxlength="4">
			<select name="d_widthunit">
			<option value='px'>&#20687;&#32032;</option><option value='%'>&#30334;&#20998;&#27604;</option>
			</select>
		</td>
		<td width=7></td>
	</tr>
	<tr><td colspan=9 height=5></td></tr>
	</table>
	</fieldset>
	</td>
</tr>
<tr><td height=5></td></tr>
<tr>
	<td>
	<fieldset>
	<legend>&#34920;&#26684;&#39068;&#33394;</legend>
	<table border=0 cellpadding=0 cellspacing=0>
	<tr><td colspan=9 height=5></td></tr>
	<tr>
		<td width=7></td>
		<td>&#36793;&#26694;&#39068;&#33394;:</td>
		<td width=5></td>
		<td><input type=text id=d_bordercolor size=7 value=""></td>
		<td><img border=0 src="rect.gif" width=18 style="cursor:hand" id=s_bordercolor onclick="SelectColor('bordercolor')"></td>
		<td width=40></td>
		<td>&#32972;&#26223;&#39068;&#33394;:</td>
		<td width=5></td>
		<td><input type=text id=d_bgcolor size=7 value=""></td>
		<td><img border=0 src="rect.gif" width=18 style="cursor:hand" id=s_bgcolor onclick="SelectColor('bgcolor')"></td>
		<td width=7></td>
	</tr>
	<tr><td colspan=9 height=5></td></tr>
	</table>
	</fieldset>
	</td>
</tr>
<tr><td height=5></td></tr>
<tr><td align=right>
<BUTTON id=Ok type=submit>&#30830;&#23450;</BUTTON>&nbsp;&nbsp;
<BUTTON onclick=window.close();>&#20851;&#38381;</BUTTON>
</td></tr>
</table>
</body>
</html>