<%@LANGUAGE="VBSCRIPT"%> 
<!--#include file="Connections/connfu.asp" -->
<!--#include file="fso/color.asp" -->
<!--#include file="fso/fso_set.asp" -->
<%
Dim Recordset2__MMColParam
Recordset2__MMColParam = "1"
If (Session("MM_username") <> "") Then 
  Recordset2__MMColParam = Session("MM_username")
End If
%>
<%
set Recordset2 = Server.CreateObject("ADODB.Recordset")
Recordset2.ActiveConnection = MM_connfu_STRING
Recordset2.Source = "SELECT * FROM book WHERE imgsrc = '" + Replace(Recordset2__MMColParam, "'", "''") + "'"
Recordset2.CursorType = 0
Recordset2.CursorLocation = 2
Recordset2.LockType = 3
Recordset2.Open()
Recordset2_numRows = 0
%>
<%
width=request("width")
height=request("height")
id=replace(request.QueryString("id"),"'","")
action=request.QueryString("action")
%>
<HTML>
<HEAD>
<TITLE>paintbbs 涂鸦板！</TITLE>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<STYLE type=text/css></STYLE>
<Script Language="JavaScript">
<!--
var Palettes = new Array();
Palettes[0] = "#000000\n#FFFFFF\n#B47575\n#888888\n#FA9696\n#C096C0\n#FFB6FF\n#8080FF\n#25C7C9\n#E7E58D\n#E7962D\n#99CB7B\n#FCECE2\n#F9DDCF";
Palettes[1] = "#FFF0DC\n#52443C\n#FFE7D0\n#5E3920\n#FFD6C0\n#B06A54\n#FFCBB3\n#C07A64\n#FFC0A3\n#DEA197\n#FFB7A2\n#ECA385\n#000000\n#FFFFFF";
Palettes[2] = "#FFEEF7\n#FFE6E6\n#FFCAE4\n#FFC4C4\n#FF9DCE\n#FF7D7D\n#FF6AB5\n#FF5151\n#FF2894\n#FF0000\n#CF1874\n#BF0000\n#851B53\n#800000";
Palettes[3] = "#FFE3D7\n#FFFFDD\n#FFCBB3\n#FFFFA2\n#FFA275\n#FFFF00\n#FF8040\n#D9D900\n#FF5F11\n#AAAA00\n#DB4700\n#7D7D00\n#BD3000\n#606000";
Palettes[4] = "#C6FDD9\n#E8FACD\n#8EF09F\n#B9E97E\n#62D99D\n#9ADC65\n#1DB67C\n#65B933\n#1A8C5F\n#4F8729\n#136246\n#2B6824\n#0F3E2B\n#004000";
Palettes[5] = "#DFF4FF\n#C1FFFF\n#80C6FF\n#6DEEFC\n#60A8FF\n#44D0EE\n#1D56DC\n#209CCC\n#273D8F\n#2C769A\n#1C2260\n#295270\n#000040\n#003146";
Palettes[6] = "#E9D2FF\n#E1E1FF\n#DAB5FF\n#C1C1FF\n#CE9DFF\n#8080FF\n#B366FF\n#6262FF\n#9428FF\n#3D44C9\n#6900D2\n#33309E\n#3F007D\n#252D6B";
Palettes[7] = "#ECD3BD\n#F7E2BD\n#E4C098\n#DBC7AC\n#C8A07D\n#D9B571\n#896952\n#C09450\n#825444\n#AE7B3E\n#5E4435\n#8E5C2F\n#493830\n#5F492C";
Palettes[8] = "#FFEADD\n#DED8F5\n#FFCAAB\n#9C89C4\n#F19D71\n#CF434A\n#52443C\n#F09450\n#5BADFF\n#FDF666\n#0077D9\n#4AA683\n#000000\n#FFFFFF";
Palettes[9] = "#F6CD8A\n#FFF99D\n#89CA9D\n#C7E19E\n#8DCFF4\n#8CCCCA\n#9595C6\n#94AAD6\n#AE88B8\n#9681B7\n#F49F9B\n#F4A0BD\n#8C6636\n#FFFFFF";
Palettes[10] = "#C7E19E\n#D1E1FF\n#A8D59D\n#8DCFE0\n#7DC622\n#00A49E\n#528413\n#CBB99C\n#00B03B\n#766455\n#007524\n#5B3714\n#0F0F0F\n#FFFFFF";
Palettes[11] = "#FFFF80\n#F4C1D4\n#EE9C00\n#F4BDB0\n#C45914\n#ED6B9E\n#FEE7DB\n#E76568\n#FFC89D\n#BD3131\n#ECA385\n#AE687E\n#0F0F0F\n#FFFFFF";
Palettes[12] = "#FFFFFF\n#7F7F7F\n#EFEFEF\n#5F5F5F\n#DFDFDF\n#4F4F4F\n#CFCFCF\n#3F3F3F\n#BFBFBF\n#2F2F2F\n#AFAFAF\n#1F1F1F\n#0F0F0F\n#000000";
function setPalette(){
	d = document
	d.paintbbs.setColors(Palettes[d.Palette.select.selectedIndex])
	//if (! d.grad.view.checked){return}
	GetPalette();
}
function PaletteSave(){
	Palettes[0] = String(document.paintbbs.getColors())
}
var cutomP = 0;
function PaletteNew(){
	d = document
	p = String(d.paintbbs.getColors())
	s = d.Palette.select
	Palettes[s.length] = p
	cutomP++
	str = prompt("为新增的色盘取名","新色盘" + cutomP)
	if(str == null || str == ""){cutomP--;return}
	s.options[s.length] = new Option(str)
	if(s.length < 30) s.size = s.length
}
function PaletteRenew(){
	d = document
	Palettes[d.Palette.select.selectedIndex] = String(d.paintbbs.getColors())
}
function PaletteDel(){
	p = Palettes.length
	s = document.Palette.select
	i = s.selectedIndex
	if(i == -1)return
	
	flag = confirm("确定删除色盘["+s.options[i].text + "]吗？")
	if (!flag) return
	s.options[i] = null
	while(i<p){
		Palettes[i] = Palettes[i+1]
		i++
	}
	if(s.length < 30) s.size = s.length
}
function P_Effect(v){
	v=parseInt(v)
	x = 1
	if(v==255)x=-1
	d = document.paintbbs
	p=String(d.getColors()).split("\n")
	l = p.length
	var s = ""
	for(n=0; n<l;n++){
		R = v+(parseInt("0x" + p[n].substr(1,2))*x)
		G = v+(parseInt("0x" + p[n].substr(3,2))*x)
		B = v+(parseInt("0x" + p[n].substr(5,2))*x)
		if(R > 255){ R = 255}
		else if(R < 0){ R = 0}
		if(G > 255){ G = 255}
		else if(G < 0){ G = 0}
		if(B > 255){ B = 255}
		else if(B < 0){ B = 0}
		s += "#"+Hex(R)+Hex(G)+Hex(B)+"\n"
	}
	d.setColors(s)
}
function PaletteMatrixGet(){
	d = document.Palette
	p = Palettes.length
	s = d.select
	m = d.m_m.selectedIndex
	t = d.setr
	t.value = "!Palette\n"+String(document.paintbbs.getColors())
	switch(m){
	case 0:case 2:default:
		n=0;c=0
		while(n<p){
			if(s.options[n] != null){ t.value = t.value + "\n!"+ s.options[n].text +"\n" + Palettes[n];c++}
			n++
		}
		alert ("已取得色盘颜色咨讯！");break
	case 1:
		alert("已取得色盘颜色咨讯！");break
	}
		t.value = t.value + "\n!Matrix"
}
function PalleteMatrixSet(){
	m = document.Palette.m_m.selectedIndex;
	str = ""
	switch(m){
	case 0:default:
		flag = confirm(str+"\n确定使用此区颜色？");break
	case 1:
		flag = confirm(str+"\n确定使用此区颜色？");break;
	case 2:
		flag = confirm(str+"\n确定使用此区颜色？");break
	}
		if (!flag) return
	
	PaletteSet()
	if(s.length < 30){ s.size = s.length}else{s.size=30};
	
}

function PaletteSet(){
	d = document.Palette
	se = d.setr.value;
	s = d.select;
	m = d.m_m.selectedIndex;
	l = se.length
	if(l<1){
		alert("现在没有任何色盘颜色咨讯！");return
	}
		n = 0;o = 0;e = 0
	switch(m){
	case 0:default:
		n = s.length
		while(n > 0){
			n--
			s.options[n] = null
		}
	case 2:
		i=s.options.length
		n = se.indexOf("!",0)+1
		if(n == 0)return
		while(n<l){
			e = se.indexOf("\n#",n)
			if(e == -1)return
			
			pn = se.substring(n,e-1)
			o = se.indexOf("!",e)
			if(o == -1)return
			pa = se.substring(e+1,o-2)
			if (pn != "Palette"){
			if(i >= 0)s.options[i] = new Option(pn)
			
			Palettes[i] = pa
			i++
			}else{document.paintbbs.setColors(pa)}
			
			n=o+1
		}
		break
	case 1:
		n = se.indexOf("!",0)+1
		if(n == 0)return
		e = se.indexOf("\n#",n)
		o = se.indexOf("!",e)
			if(e >= 0){
				pa = se.substring(e+1,o-2)
			}
		document.paintbbs.setColors(pa)
	}
}

function ChengeGrad(){
	d =document
	var st = d.grad.pst.value
	var ed = d.grad.ped.value
	//Chenge_()
	
	var degi_R = parseInt("0x" + st.substr(0,2))
	var degi_G = parseInt("0x" + st.substr(2,2))
	var degi_B = parseInt("0x" + st.substr(4,2))
	 var R = parseInt((degi_R - parseInt("0x" + ed.substr(0,2)))/15)
	 var G = parseInt((degi_G - parseInt("0x" + ed.substr(2,2)))/15)
	 var B = parseInt((degi_B - parseInt("0x" + ed.substr(4,2)))/15)
	 if(isNaN(R)) R = 1
	 if(isNaN(G)) G = 1
	 if(isNaN(B)) B = 1
		var p = new String()
		for(cnt=0,m1=degi_R,m2=degi_G,m3=degi_B; cnt<14; cnt++,m1-=R,m2-=G,m3-=B){
		if ((m1 > 255)||(m1 < 0)){ R *= -1;m1-=R}
		if ((m2 > 255)||(m2 < 0)){ G *= -1;m2-=G}
		if ((m3 > 255)||(m3 < 0)){ B *= -1;m2-=B}
		p += "#"+Hex(m1)+Hex(m2)+Hex(m3)+"\n"
		
		}
	document.paintbbs.setColors(p);
}
function Hex(n){
	n = parseInt(n);if (n < 0) n *=-1;
	var hex = new String()
	var m
	var k
	while(n > 16){
	m = n
	if (n >16){
		n = parseInt(n/16)
		m -= (n * 16)
	}
		k = Hex_(m)
		hex = k + hex
	}
		k = Hex_(n)
		hex = k + hex
	while(hex.length < 2){hex="0" + hex}
	return hex
}
function Hex_(n){
	if(! isNaN(n)){
		if(n == 10){n="A"}
		else if(n == 11){n="B"}
		else if(n == 12){n="C"}
		else if(n == 13){n="D"}
		else if(n == 14){n="E"}
		else if(n == 15){n="F"}
	}else{n=""}
	return n
}
function GetPalette(){
	d = document
	p = String(document.paintbbs.getColors());
	 if(p == "null" || p == ""){return};
	ps = p.split("\n");
	st = d.grad.p_st.selectedIndex
	ed = d.grad.p_ed.selectedIndex
	d.grad.pst.value = ps[st].substr(1.6)
	d.grad.ped.value = ps[ed].substr(1.6)
	GradSelC()
	//GradView(ps[st],ps[ed])
}
function GradSelC(){
	//if (! d.grad.view.checked)return
	d = document.grad
	l = ps.length
	pe=""
	for(n=0; n<l;n++){
		R = 255+(parseInt("0x" + ps[n].substr(1,2))*-1)
		G = 255+(parseInt("0x" + ps[n].substr(3,2))*-1)
		B = 255+(parseInt("0x" + ps[n].substr(5,2))*-1)
		if(R > 255){ R = 255}
		else if(R < 0){ R = 0}
		if(G > 255){ G = 255}
		else if(G < 0){ G = 0}
		if(B > 255){ B = 255}
		else if(B < 0){ B = 0}
		pe += "#"+Hex(R)+Hex(G)+Hex(B)+"\n"
	}
	pe = pe.split("\n");
	for(n=0;n < l;n++){
		d.p_st.options[n].style.background = ps[n];
		d.p_st.options[n].style.color = pe[n];
		d.p_ed.options[n].style.background = ps[n];
		d.p_ed.options[n].style.color = pe[n];
	}
}

//-->
</Script>
<script language="JavaScript">
<!--
function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);
// -->
</script>
<link rel="stylesheet" href="fso/c.asp" type="text/css">
</HEAD>
<BODY bgcolor="<%=web_bg%>" background="<%=web_bgimg%>">
<div align="center"> 
  <table border="0" cellpadding="0" cellspacing="1" width="600">
    <tr> 
      <td colspan="2" width="594" height="22"> 
        <div align="center"></div>
      </td>
    </tr>
    <tr> 
      <td colspan="2" width="594" height="22"> 
        <div align="left"><font color=""> <a href="help.htm" target="_blank"><font color="#0066CC"><b>&nbsp;&nbsp;</b></font></a></font><a href="index.asp">&nbsp;</a><a href="help.htm" target="_blank"><b>帮助文件</b></a><font color=""> 
          &nbsp;画布大小：<%=(Recordset2.Fields.Item("img_wid").Value)%></font>×<%=(Recordset2.Fields.Item("img_hgi").Value)%>&nbsp; 
          <%if Recordset2.Fields.Item("img_wid").Value >"300" then w =(Recordset2.Fields.Item("img_wid").Value)+150 end if %>
          <% if Recordset2.Fields.Item("img_hgi").Value >"300" then h =(Recordset2.Fields.Item("img_hgi").Value)+150 end if %>
          <% if Recordset2.Fields.Item("img_wid").Value ="300" then w=450 end if %>
          <% if Recordset2.Fields.Item("img_hgi").Value ="300" then h=450 end if %>
          <% if Recordset2.Fields.Item("img_wid").Value<"300" then w=450 end if %>
          <% if Recordset2.Fields.Item("img_hgi").Value <"300" then h=450 end if %>
        </div>
      </td>
    </tr><tr>
    <td bgcolor="" width="400"> 
      <table border="0" cellpadding="0" cellspacing="0" width="100%">
        <tr> 
          <TD> 
            <table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#D4D4D4" width="99%" id="AutoNumber1" bgcolor="#FFF0E6">
              <tr> 
                <td width="100%" bgcolor="ffffff"> 
                  <% pic="upload/" & Recordset2.Fields.Item("imgsrc").Value %><%pic= "BwArt_"&year(now)&month(now)&day(now)&hour(now)&minute(now)&second(now)&".png"
		pch= "BwArt_"&year(now)&month(now)&day(now)&hour(now)&minute(now)&second(now)&".pch"%>
                  <APPLET CODE="pbbs.PaintBBS.class" archive="PaintBBS.jar" NAME="paintbbs" WIDTH="<%=w %>" HEIGHT="<%=h %>">
                    <param name="color_bk" value="#ffffff">
                    <param name="color_bk2" value="#ffffff">
                    <param name="color_icon" value="#cccccc">
                    <param name="color_iconselect" value="#cccccc">
                    <param name="image_width" value="<%=(Recordset2.Fields.Item("img_wid").Value)%>">
                    <param name="image_height" value="<%=(Recordset2.Fields.Item("img_hgi").Value)%>">
                    <param name="image_bkcolor" value="#FFFFFF">
                    <param name="image_interlace" value="true">
                    <param name="thumbnail_type" value="animation">
                    <param name="thumbnail_width" value="50%">
                    <param name="thumbnail_height" value="50%">
                    <param name="undo" value="60">
                    <%if Recordset2.Fields.Item("upload").Value ="1" then %>
                    <param name="image_jpeg" value="true">
                    <param name="thumbnail_type2" value="png">
                    <%end if %>
                    <param name="undo_in_mg" value="15">
                    <param name="image_size" value="60">
                    <param name="compress_level" value="15">
                    <param name="color_text" value="#000000">
                    <param name="image_bk" value="">
                    <param name="send_header" value="10">
                    <param name="send_advance" value="true"><param name="url_save" value="savepb.asp?action=save&pic=<%=pic%>&pch=<%=pch%>"> 
<param name="url_exit" value="post_paintbbs.asp?wid=<%=(Recordset2.Fields.Item("img_wid").Value)%>&hgi=<%=(Recordset2.Fields.Item("img_hgi").Value)%>&pic=<%=pic%>&pch=<%=pch%>">    
                    <param name="send_header_image_type" value="true">
                    <param name="poo" value="true">
                    <param name="image_interlace" value="true">
                    <param name="tool_alpha" value="true">
                    <%if Recordset2.Fields.Item("upload").Value ="0"then  %>
                    <param name="pch_file" value="<%=(Recordset2.Fields.Item("pchsrc").Value)%>">
                    <%end if %>
                    <%if Recordset2.Fields.Item("upload").Value ="1" then %>
                    <param name="image_canvas" value="<%=pic%>">
                    <%end if %>
                  </APPLET> </td>
              </tr>
            </table>
          </TD>
          <td width="100%"></td>
        </tr>
      </table>
    </td>
    <td bgcolor="ffffff" width="200"> 
      <div align="center"> 
        <center>
          <table border="0" cellpadding="0" cellspacing="0" width="95%"><tr>
            <TD ALIGN="CENTER" VALIGN="top" height="40"> <FORM name="Palette"> 
              <TABLE  CELLPADDING="0" CELLSPACING="0" width=100%>
                <TR> 
                  <TD bgcolor="#ffffff"> 
                    <TABLE CELLPADDING="2" CELLSPACING="0" width=100% style="border-collapse: collapse" bgcolor="#ffffff">
                      <TR> 
                        <TD bgcolor="#ffffff"> <FONT SIZE=2><font color="#0055BB" size="2">PALETTE</font> 
                          <INPUT TYPE="button" VALUE="暂存色盘" OnClick="PaletteSave()">
                          <BR>
                          <select name="select" size="14" STYLE="width:50%" onChange="setPalette()">
                            <option>色盘区</option>
                            <option>肤色系</option>
                            <option>红色系</option>
                            <option>黄橙系</option>
                            <option>绿色系</option>
                            <option>青色系</option>
                            <option>紫色系</option>
                            <option>黄褐系</option>
                            <option>彩虹色</option>
                            <option>淡色系</option>
                            <option>大草原</option>
                            <option>樱花色</option>
                            <option>黑白系</option>
                          </select>
                          <BR>
                          <INPUT TYPE="button" VALUE="新增" OnClick="PaletteNew()">
                          &nbsp; 
                          <INPUT TYPE="button" VALUE="更改" OnClick="PaletteRenew()">
                          <INPUT TYPE="button" VALUE="删除" OnClick="PaletteDel()">
                          <br>
                          <br>
                          <INPUT TYPE="button" VALUE="加亮" OnClick="P_Effect(10)">
                          &nbsp; 
                          <INPUT TYPE="button" VALUE="减暗" OnClick="P_Effect(-10)">
                          <INPUT TYPE="button" VALUE="反转" OnClick="P_Effect(255)">
                          <HR SIZE=1>
                          <font color="#0055BB" size="2">MATRIX</font> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
                          <SELECT name="m_m">
                            <option value=0>全部</option>
                            <option value=1>现在</option>
                            <option value=2>追加</option>
                          </SELECT>
                          <BR>
                          <INPUT name="m_g" TYPE="button" VALUE="取得" OnClick="PaletteMatrixGet()">
                          <INPUT name="m_s" TYPE="button" VALUE="使用" OnClick="PalleteMatrixSet()">
                          <BR>
                          <TEXTAREA rows="1" name="setr" cols="13" onmouseover="this.select()"></TEXTAREA>
                          <BR>
                          </font> </TD>
                      </TR>
                    </TABLE>
                  </TD></FORM></TR>
              </TABLE>
              <TABLE  CELLPADDING="1" CELLSPACING="0" width=100%>
                <TR> 
                  <TD> 
                    <TABLE CELLPADDING="3" CELLSPACING="1" width=100% style="border-collapse: collapse">
                      <TR> <FORM name="grad">
                        <TD bgcolor=""> <font SIZE=2 color="#0055BB" size="2">GRADATION</font> 
                          <INPUT TYPE="button" VALUE=" OK " OnClick="ChengeGrad()">
                          <BR>
                          <SELECT name="p_st" onChange="GetPalette()">
                            <option>1</option>
                            <option>2</option>
                            <option>3</option>
                            <option>4</option>
                            <option>5</option>
                            <option>6</option>
                            <option>7</option>
                            <option>8</option>
                            <option>9</option>
                            <option>10</option>
                            <option>11</option>
                            <option>12</option>
                            <option>13</option>
                            <option>14</option>
                          </SELECT>
                          <input type="text" name="pst" size="8" value="" onChange="Chenge_()">
                          <BR>
                          <SELECT name="p_ed" onChange="GetPalette()">
                            <option>1</option>
                            <option>2</option>
                            <option>3</option>
                            <option>4</option>
                            <option>5</option>
                            <option>6</option>
                            <option>7</option>
                            <option>8</option>
                            <option>9</option>
                            <option>10</option>
                            <option>11</option>
                            <option selected>12</option>
                            <option>13</option>
                            <option>14</option>
                          </SELECT>
                          <input type="text" name="ped" size="8" value="" onChange="Chenge_()">
                        </TD>
                      </TR>
                    </TABLE>
                  </TD></FORM>
                </TR>
              </TABLE>
            </TD></tr>
            <tr> 
              <td width="100%"></td>
            </tr>
          </table>
        </center>
      </div>
    </td></tr>
    <tr> 
      <td colspan="2" width="594" height="22"> 
        <p align="center">&nbsp;</p>
      </td>
    </tr>
  </table>
  <table width="554" border="0" cellspacing="0" cellpadding="0" align="center">
    <tr> 
      <td> 
        <div align="right">版权所有：<a href="<%=HostUrl%>"><%=hostName%></a></div>
      </td>
    </tr>
    <tr> 
      <td> 
        <div align="right">Client Program：<a href="http://poo.7i24.com">PooBBS 
          3.72</a></div>
      </td>
    </tr>
    <tr> 
      <td> 
        <div align="right">Client Program (java)：<a href="<%=jphttp%>" target="_blank"><%=jp1%></a></div>
      </td>
    </tr>
  </table>
</div>
</BODY>
</HTML>
<%
Recordset2.Close()
%>
