<style>
.cp_editor{
	overflow: hidden;
	zoom: 1;
	position:absolute;
	z-index:2001;
	margin-top:2px;
}
.cp_editor_text{
	width: 100%;
	height: 85%;

}
.cp_button{
	text-align: center;
}
	.cp_button input{
		margin:3px;
	}
</style>
<script type="text/javascript">
function initCustomizePanel__MODULE_ID__()
{
	var div = document.createElement("DIV");
	div.id = "DD___cp___MODULE_ID__";
	div.style.display = "none";
	div.className = "cp_editor";
	
	div.style.height = "auto";
	div.style.minHeight = "300px";
	div.style.width = "550px";

	_gel("DS_DD_div").appendChild(div);

	if ({showborder}=='0')
	{
		_gel("m___MODULE_ID__").getElementsByTagName('h2')[0].style.display = 'none';
		_gel("m___MODULE_ID___b").style.border = 'none';
	}
}

function saveeditcp__MODULE_ID__()
{
	var iframe = _gel('e_cp__MODULE_ID___iframe');
	var doc = iframe.contentWindow.document;
	var value;
	if (doc.getElementById('e_textarea').style.display == 'none')
	{
		value = doc.getElementById('e_iframe').contentWindow.document.body.innerHTML;
	}
	else
	{
		value = doc.getElementById('e_textarea').value;
	}
	_xsetp('action=updatecustomizepanel&cp_module_id=__MODULE_ID__&cp_module_content='+ _esc(value));	
	_gel('cp___MODULE_ID___content').innerHTML = value;
	canceleditcp__MODULE_ID__();
}

function canceleditcp__MODULE_ID__()
{
	_gel('DD___cp___MODULE_ID__').style.display = 'none';
	//_gel('cp_editor_owner__MODULE_ID__').style.display = 'none';
}

function editpanel___MODULE_ID__()
{
	var div = _gel('DD___cp___MODULE_ID__');

	if (!_gel('e_cp__MODULE_ID___iframe'))
	{
		var iframe = document.createElement("IFRAME");
		
		iframe.id = 'e_cp__MODULE_ID___iframe';
		iframe.src = '{forumpath}editor/cp_editor.htm?style={forumpath}space/skins/themes/{themepath}/editor.css';
  iframe.frameBorder="0";
  iframe.width = '100%';
  iframe.scrolling="no";
  //alert(div.offsetHeight);
  if (DragUtil.isIE)
  {
  iframe.height = '332px';
  }
  else
  {
  iframe.height = '333px';
  }

  div.appendChild(iframe);
  iframe.onload = function() {
  iframe.contentWindow.document.getElementById('editorcss').href = '{forumpath}space/skins/themes/{themepath}/editor.css';
  iframe.contentWindow.document.getElementById('e_iframe').contentWindow.document.body.innerHTML = _gel('cp___MODULE_ID___content').innerHTML;
  iframe.contentWindow.document.getElementById('e_textarea').value = _gel('cp___MODULE_ID___content').innerHTML;
  };
  iframe.onreadystatechange = function() {
  if(this.readyState=='complete')
  {
  iframe.contentWindow.document.getElementById('editorcss').href = '{forumpath}space/skins/themes/{themepath}/editor.css';
  iframe.contentWindow.document.getElementById('e_iframe').contentWindow.document.body.innerHTML = _gel('cp___MODULE_ID___content').innerHTML;
  iframe.contentWindow.document.getElementById('e_textarea').value = _gel('cp___MODULE_ID___content').innerHTML;
  }
  };
  var div1 = document.createElement("DIV");
  div1.className = 'cp_button';
  div1.innerHTML = '<input type="button" name="submit_m___MODULE_ID__" value="保存" onclick="saveeditcp__MODULE_ID__();" />&nbsp;<input type="button" name="cancel_m___MODULE_ID__" value="取消" onclick="canceleditcp__MODULE_ID__();" />';
		div.appendChild(div1);
	}
}

_DS_RegisterOnloadHandler(initCustomizePanel__MODULE_ID__);


</script>

<div id="cp___MODULE_ID___content">{customizepanelcontent}</div>
