<%
guidedisplay=1
copyrightend=1
%>
<!--#include file="admin_start.asp" -->
<!--#include file="edit/edit_html.asp" -->
<!--#include file="edit/active_frame.asp" -->
<%
Session("FB_EM_1_ACC_c")=request.form("c")
Session("FB_EM_1_ACC_c_sql")=request.form("c_sql")
tools_width="99%"
dim labels
labels=","
%>
<scrip src="edit/edit_html.js" type="text/javascript"></script>
<body  style="background-color:#EBE9ED ;margin: 0px;" onmousemove="changew(2,event.x)" onmouseup="changew(1,event.x)" onmouseout="changew(3,event.x)" onmouseover="changew(4,event.x)">
<form name='form1' method="post" action=admin_edit_html_prev.asp target=_blank>
<table cellpadding="0" cellspacing="0"  border="0" id=label_show width="20%" height=100% align=left >
    <tr> 
      <td valign=top style='padding:0' colspan="10" bgcolor="#ffffff" >
		<%
		dim show
		dim c_show
		show=request("show")
		if show<>"" then show=split(show,",")
		for i=0 to ubound(show)
			show(i)=split(show(i),"?")
			c_show=show(i)(0)
			if ubound(show(i))>0 then q_show="&"&show(i)(1)
			%>
			<table id="label_show_<%=c_show%>" cellpadding="0" cellspacing="0"  border="0" width="100%" height=<%if i<ubound(show) then%>30<%end if%> >
				<tr> 
				  <td valign=top style='padding:0' colspan="10" bgcolor="#ffffff" >
				<iframe name=f_label_show_<%=c_show%> id=f_label_show_<%=c_show%>  style='border:solid #b0b0b0 0px' marginheight=0 marginwidth=0 frameborder=0  scrolling="no"  align=middle height=100% width=100% src='admin_edit_label_<%=c_show%>.asp<%if i<ubound(show) then%>?display=none<%=q_show%><%else%>?k=1<%=q_show%><%end if%>' ></iframe>
				  </td>
				</tr>
			</table>
			<%
			if i=0 then labels=labels&"'label_show_"&c_show&"'" else labels=labels&",'label_show_"&c_show&"'"
		next
		
		labels=right(labels,len(labels)-1)
		%>
      </td>
    </tr>
</table>

<table cellpadding="0" cellspacing="0"  border="0"  height=100% width="15" align=left>
    <tr> 
      <td align=right style="cursor:e-resize;" height="47%" width='50%'  background="images/bg_a.gif" onmouseup="changew(1,-1)"  onMousedown="changew(0,-1)"  ></td>
      <td align=right height="47%" width='50%'></td>
    </tr>
    <tr> 
      <td align=right  width='50%'  ><img src="images/d_0.gif" onMouseOver='changei(this)'; onMouseOut='changei(this)'; onMouseDown='changeii(this)'></td>
      <td align=right  width='50%'></td>
    </tr>
    <tr> 
      <td align=right style="cursor:e-resize;"  height="47%" width='50%'  background="images/bg_a.gif"  onmouseup="changew(1,-1)"  onMousedown="changew(0,-1)" ></td>
      <td align=right height="47%" width='50%'></td>
    </tr>
</table>

<table cellpadding="0" cellspacing="0"  border="0" width="77%"  id=sql_show>
    <tr> 
      <td  colspan=10  height=20>
	  &nbsp
	  </td>
    </tr>
    <tr> 
      <td align=right height="21" width='1%'><img src="images/bg_di_l.gif"></td>
      <td  valign=bottom background="images/bg_di_m.gif" align=center><nobr>源码编辑环境</nobr></td>
      <td align=left width='1%' ><img src="images/bg_di_r.gif"></td>
      <td style='border-bottom:1px solid #808080;' width=90% >
	  &nbsp
	  </td>
    </tr>
    <tr> 
      <td  style='border:1px solid #808080; border-top:0px;padding:5;padding-top:10px' colspan="10" background="images/bg_di.gif" >
		<table cellpadding="3" cellspacing="1" border="0" width="<%=tools_width%>" align=center style='background-color:#ffffff;border:1px dotted #808080'>
			<tr> 
			  <td>
		<!-- edit bar start //-->
				<img vspace='2' hspace="2" onMouseDown="Check(this,2)" onMouseOver="Check(this,1)" onMouseOut="Check(this,0)" onMouseUp="Check(this,1)" src="images/edit/selectall.gif" align="absmiddle" border="0" alt="全选" onClick="selectall()" style="cursor: hand;"> 
				<img vspace='2' hspace="2" onMouseDown="Check(this,2)" onMouseOver="Check(this,1)" onMouseOut="Check(this,0)" onMouseUp="Check(this,1)" src="images/edit/cut.gif"  align="absmiddle" onClick="FormatText('cut')" style="cursor: hand;" alt="剪切"> 
				<img vspace='2' hspace="2" onMouseDown="Check(this,2)" onMouseOver="Check(this,1)" onMouseOut="Check(this,0)" onMouseUp="Check(this,1)"src="images/edit/copy.gif"  align="absmiddle" onClick="FormatText('copy')" style="cursor: hand;" alt="复制"> 
				<img vspace='2' hspace="2" onMouseDown="Check(this,2)" onMouseOver="Check(this,1)" onMouseOut="Check(this,0)" onMouseUp="Check(this,1)" src="images/edit/paste.gif"  align="absmiddle" onClick="FormatText('paste')" style="cursor: hand;" alt="粘贴"> 
				<img vspace='2' hspace="2" onMouseDown="Check(this,2)" onMouseOver="Check(this,1)" onMouseOut="Check(this,0)" onMouseUp="Check(this,1)" src="images/edit/DELETE.gif" align="absmiddle" border="0" alt="删除" onClick="FormatText('DELETE')" style="cursor: hand;"> 
				<img vspace='2' hspace="2" onMouseDown="Check(this,2)" onMouseOver="Check(this,1)" onMouseOut="Check(this,0)" onMouseUp="Check(this,1)" src="images/edit/undo.gif" align="absmiddle" border="0" alt="撤销" onClick="FormatText('undo')" style="cursor: hand;"> 
				<img vspace='2' hspace="2" onMouseDown="Check(this,2)" onMouseOver="Check(this,1)" onMouseOut="Check(this,0)" onMouseUp="Check(this,1)" src="images/edit/redo.gif" align="absmiddle" border="0" alt="重做" onClick="FormatText('redo')" style="cursor: hand;"> 
		<!-- edit bar end //-->
			 </td>
			</tr> 
		</table>
		
		<table cellpadding="3" cellspacing="1" border="0" width="100%" align=center  >
			<tr> 
			  <td align=center >
			   <iframe src="../admin_edit_html_ini.asp?action=s" frameborder=0 name="source_s" id="message" width="100%" style='border:1px solid #808080 ;' height="540" ></iframe>
			</td>
			</tr>
		</table>
		
      </td>
    </tr>
</table>

<table cellpadding="3" cellspacing="1" border="0" width="78%" align=center >
    <tr> 
      <td align=center>
	  <input type="hidden" name=content  >
	  <input type="submit" value="预览" onclick='javascript:document.form1.content.value=frames.message.document.body.innerHTML;form1.submit'>
	  <input type="button" value="提交" onclick='send()'>
	  <input type="reset" value="重置">
      </td>
    </tr>
</table>
</form>
<%if labels<>"" then%>
<script language="javascript" >
	var i_n=0;
	var ff_h=0
	var ff=new Array(<%=labels%>)
    document.getElementById(ff[ff.length-1]).style.height=(window.document.body.scrollHeight-30*(ff.length-1))
	
	var h_ff=new Array(ff_h)
    for (i_n=0;i_n<ff.length;i_n++){h_ff.push(document.getElementById(ff[i_n]).scrollHeight)
	}
	
	function InsertLabel(s){
	   message.focus();
	   var range =message.document.selection.createRange();
	   range.pasteHTML(s);
	   changel()
	   message.focus();
    }
	function FarmatLabel(s){
	   var bodys=frames.message.document.getElementsByTagName("pre")[0];
	   var c_f=bodys.innerHTML
	   var r_f=FarmatLabels(s,c_f)
	   if(r_f!='false')bodys.innerHTML=r_f
	   changel();
	}
</script>
<script language="vbscript">
	Function FarmatLabels(s,ss)
	
		if ss="" or s="" then 
			FarmatLabels="false"
			exit function
		end if
		
		ss=CutHtml(ss,len(ss))
		ss=replace(ss," ","")
		ss=replace(ss,vbcrlf,"")
		
		do while instr(1,ss,s&s)>0
			ss=replace(ss,s&s,s)
		loop
		
		if left(ss,4)="<br>" then ss=right(ss,len(ss)-4)
		if right(ss,5)="</br>" then ss=left(ss,len(ss)-5)

		if left(ss,1)=s then ss=right(ss,len(ss)-1)
		if right(ss,1)=s then ss=left(ss,len(ss)-1)
		
		ss=replace(ss,",","</font>,<br><font color=blue>")
		
		FarmatLabels="<font color=blue>"&ss&"</font>"
		
		
	End Function
</script>
<%end if%>
<SCRIPT LANGUAGE="JAVASCRIPT" >
	var f_now = window.frames["source_s"];
	var body;
	var rng;
	var n_line;//?′??DDêy
	var key_ctrl=0
	
	f_now.document.designMode="on";

	f_now.document.onkeydown = function(){ 
		var  keycode=f_now.event.keyCode; 
		//alert(keycode)
		
		if(keycode==13) {
			rng=f_now.document.selection.createRange();
			rng.pasteHTML("</pre></pre><br><pre>");
			return false
		}
		if(keycode==17) {
			key_ctrl=1
		}
		if(keycode==65&&key_ctrl==1) {
			selectall()
			return false
		}
	}
	f_now.document.oncontextmenu=function(){return false}
	f_now.document.onclick = function(){changel()}
	f_now.document.onkeyup = function(){
		var  keycode=f_now.event.keyCode; 
		if(keycode==17)key_ctrl=0;
		changel()
	}
	//f_now.document.onselectstart =function(){return false} 
	//f_now.document.onselect=function(){f_now.document.selection.empty()}
	//f_now.document.onselectall =function(){return false} 
	
	window.document.onclick = function(){changel()}
	
	function selectall(){
	    var bodys=frames.message.document.getElementsByTagName("pre")[0];
		var node=bodys.el;
		var range=frames.message.document.body.createTextRange();
		range.moveToElementText(bodys);
		range.select();
	}

	function changel(){ 
		var n_lines
		var cc=""
		var i
	    var bodys=frames.message.document.getElementsByTagName("pre")[0];
		if(bodys){
			f_now.document.getElementById("lines").onselectstart =function(){return false} 
			f_now.document.getElementById("lines").onselect=function(){f_now.document.getElementById("lines").selection.empty()}
			n_lines=getlines(bodys.innerHTML)
			for(i=0;i<n_lines;i++)cc+=(i+1)+"<br>"
			f_now.document.getElementById("lines").innerHTML=cc
		}
	}
	
</SCRIPT>
<script language="javascript" >
	
	function send(){
	    var bodys=frames.message.document.getElementsByTagName("pre")[0];
		dd=trans_s(trans_h(bodys.innerHTML));
		opener.document.<%=request("formname")%>.<%=request("inputname")%>.value=dd;
		opener.focus();
		window.close();
	}
	
	var key_d=0
	var x_m_o=document.getElementById("label_show").scrollWidth
	function changew(nn,xx){
	
	    if(xx==-1)xx=event.x
		
		if (nn==0&&key_d==0){
			
			key_d=1
			x_m_o=xx-document.getElementById("label_show").scrollWidth
			
		}else if (nn==1&&key_d==1){
		
			key_d=0
		
		}
		else if (nn==2&&key_d==1){
		
			var x_m=xx
			var x_n=document.getElementById("label_show").scrollWidth
			document.getElementById("label_show").style.width=x_m-x_m_o;
			document.getElementById("sql_show").style.width=document.body.scrollWidth-document.getElementById("label_show").scrollWidth-15-15;
		
		}
		else if (nn==3&&key_d==1){
			if(ined==0){
				ined=1;
				fs_s=xx
			}		
		}
		else if (nn==4&&key_d==1){
			if(ined==1)ined=0;
		}
	}
	
	var fs_m=new Array();
	var ined=0
	var fs_s=0
	fs_m[0]=window.frames["source_s"]
	fs_m[0].document.onmousemove = function(){changew(2,fs_m[0].event.x+fs_s);}	
	fs_m[0].document.onmouseup = function(){changew(1,fs_m[0].event.x+fs_s);}

</script>
<script language="vbscript" >

	function crlf()
		crlf=vbcrlf
	end function

	function replace_to(s,s1,s2)
		replace_to=replace(s,s1,s2,1,-1,1)
	end function
	
	function trans_s_t(c)
		
		c=replace(c,vbcrlf,"<br>")
		c=replace(c," ","&nbsp;")
		c=replace(c,"	","&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;")
	
		c=replace(c,"{$","<font color=blue>{$")
		c=replace(c,"$}","$}</font>")
	
		c=replace(c,"&lt;script","<font color=#990033>&lt;SCRIPT",1,-1,1)
		c=replace(c,"&lt;/script&gt;","&lt;/SCRIPT&gt;</font>",1,-1,1)
	
		c=replace(c,"&lt;!--","<font color=gray>&lt;!--")
		c=replace(c,"--&gt;","--&gt;</font>")
	
		c=replace(c,"&lt;style","<font color=red>&lt;style",1,-1,1)
		c=replace(c,"&lt;/style&gt;","&lt;/style&gt;</font>",1,-1,1)
	
		c=replace(c,"&lt;html&gt;","<font color=#000099>&lt;html&gt;</font>",1,-1,1)
		c=replace(c,"&lt;/html&gt;","<font color=#000099>&lt;/html&gt;</font>",1,-1,1)
	
		c=replace(c,"&lt;head&gt;","<font color=#000099>&lt;head&gt;</font>",1,-1,1)
		c=replace(c,"&lt;/head&gt;","<font color=#000099>&lt;/head&gt;</font>",1,-1,1)
	
		c=replace(c,"&lt;title&gt;","<font color=#000099>&lt;title&gt;</font>",1,-1,1)
		c=replace(c,"&lt;/title&gt;","<font color=#000099>&lt;/title&gt;</font>",1,-1,1)
		
		trans_s_t= c
	
	end function
	
	function trans_s(c)
		
		c=replace(c,"&amp;","&")
		
		c=replace(c,"&#39;","'")
		c=replace(c,"&quot;","""")
		
		c=replace(c,"&lt;","<")
		c=replace(c,"&gt;",">")
		
		trans_s= c
	
	end function
	
	function trans_h(c)
		
		c=replace(c,"<br>",vbcrlf,1,-1,1)
		c=CutHtml(c,len(c))
		
		trans_h= c
	
	end function
	
	function CutHtml(str,l) 
		Dim re 
		Set re=new RegExp 
		re.IgnoreCase =True 
		re.Global=true 
		re.Pattern="<([^<>]*?)>" 
	
		Do while re.Test(str) 
			str=re.Replace(str,"") 
		Loop 
		set re=Nothing 
	
		CutHtml=str
		//CutHtml=Replace(CutHtml,chr(10),"") 
		//CutHtml=Replace(CutHtml,chr(13),"") 
		CutHtml=left(CutHtml,l)
	
	End Function
	
	Function getlines(c)
		if c="" then 
			getlines=-1
			exit function
		end if
		
		c=trans_h(c)
		
		if c="" then 
			getlines=-1
			exit function
		end if
		
		getlines=ubound(split(c,vbcrlf))+1
		//getlines=getlines+ubound(split(c,"<br>"))
		//getlines=getlines+ubound(split(c,"<BR>"))
	
	End Function

</script>

</body>
<!--#include file="admin_end.asp" -->