<%@ Page Language="VB" ContentType="text/html" ResponseEncoding="gb2312" Inherits="b2bNet.Admin_Classad_edit" %>
<%On Error Resume Next%>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<link href="inc/admin_style.css" rel="stylesheet" type="text/css" /><link href="inc/style.css" rel="stylesheet" type="text/css" />
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<meta name="GENERATOR" content="Microsoft FrontPage 4.0" />
<meta name="ProgId" content="FrontPage.Editor.Document" />
<title>修改信息</title>
<script type="Text/JavaScript" language="JavaScript">
function checkadd()
{   
       //检查年月日是否是合法日期
       function isdate(intYear,intMonth,intDay)
       { 
          if(isNaN(intYear)||isNaN(intMonth)||isNaN(intDay)) return false;     
          if(intMonth>12||intMonth<1) return false;  
          if ( intDay<1||intDay>31)return false;  
          if((intMonth==4||intMonth==6||intMonth==9||intMonth==11)&&(intDay>30)) return false;  
          if(intMonth==2){  
             if(intDay>29) return false;    
             if((((intYear%100==0)&&(intYear%400!=0))||(intYear%4!=0))&&(intDay>28))return false; 
            }  
          return true;  
       }  

       //检查身份证是否是正确格式
       function checkCard(dcardid) 
       {
           var pattern;
            if (dcardid.length==15)
            {
                 pattern= /^\d{15}$/;//正则表达式,15位且全是数字
                 if (pattern.exec(dcardid)==null)
                 {
                    alert("15位身份证号码必须为数字！")
                      return false;
                 }
                 if (!isdate("19"+dcardid.substring(6,8),dcardid.substring(8,10),dcardid.substring(10,12)))
                 {
              alert("身份证号码中所含日期不正确") 
                 return false;}
            }
            else     if (dcardid.length==18)
            {
                pattern= /^\d{17}(\d|x|X)$/;//正则表达式,18位且前17位全是数字，最后一位只能数字,x,X
                 if (pattern.exec(dcardid)==null)
                 {
                    alert("18位身份证号码必须为数字！")
                    return false;
                 }
                 if (!isdate(dcardid.substring(6,10),dcardid.substring(10,12),dcardid.substring(12,14)))
                 {
                    alert("身份证号码中所含日期不正确")  
                    return false;
                 }
                 var strJiaoYan  =[  "1", "0", "X", "9", "8", "7", "6", "5", "4", "3", "2"];
                 var intQuan =[7, 9, 10, 5, 8, 4, 2, 1, 6, 3, 7, 9, 10, 5, 8, 4, 2, 1];
                 var intTemp=0;
                 for(i = 0; i < dcardid.length - 1; i++)
                 intTemp +=  dcardid.substring(i, i + 1)  * intQuan[i];  
                 intTemp %= 11;
                 if(dcardid.substring(dcardid.length - 1,dcardid.length).toUpperCase()!=strJiaoYan[intTemp])
                 {
                    alert("身份证末位验证码失败！")
                    return false;
                 }
            }
            else
            {
                alert("身份证号长度必须为15或18！")
                return false;
            }
        return true;
       }
 
    if (document.postart.dtitle.value.length<1)
	{
        alert("请填写信息标题！");
        document.postart.dtitle.focus();
        return false;
    }
    if (document.postart.dlei.value=="选择信息类别")
	{
        alert("请选择信息类别！");
        document.postart.dlei.focus();
        return false;
    }
    if (document.postart.dtext.value.length>1500)
	{
        alert("请把信息内容的字数控制在1500以内！");
        document.postart.dtext.focus();
        return false;
    }
	if (document.postart.dusername.value.length == 0) {
		alert("请您填写联系人姓名！");
		document.postart.dusername.focus();
		return false;
	}
	
	
	var str="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ,./'[]{}`1234567890-=\~!@#$%^&*()_+|?><:";
	var errorChar
	errorChar = isCharsInBag(postart.dusername.value,str)
	if (errorChar != "" )
	{
		alert('联系人姓名必须是中文！');
		postart.dusername.focus();
		return false;
	} 
	
    function isCharsInBag (s, bag)
    { 
        var i,c;
        for (i = 0; i < s.length; i++)
        { 
            c = s.charAt(i);//字符串s中的字符
            if (bag.indexOf(c) > -1) 
            return c;
        }
        return "";
    }
	
    if(document.postart.dusername.value.length<2||document.postart.dusername.value.length>4){
		alert("联系人姓名不能少于2字多于4字！");
		document.postart.dusername.focus();
		return false;
	}
	
	<%if AppConst.ValidateCardId Then%>
	if (document.postart.dcardid.value.length == 0) {
		alert("请填写您的身份证号！");
		document.postart.dcardid.focus();
		return false;
	}
	if(checkCard(document.postart.dcardid.value)==false)
	{
		document.postart.dcardid.focus(); 
		return false; 
	} 
	<%end if%>
	
    if (document.postart.dtel.value.length<1)
	{
        alert("请填写您的联系电话！");
        document.postart.dtel.focus();
        return false;
    }

       var dtel=document.postart.dtel.value;
       for (var i=0;i<dtel.length;i++){
              var c=dtel.charAt(i);
              if (c<"0" || c>"9") break;
       }
       if (i<7){
              alert("电话号码必须是7位以上的数字！");
			  document.postart.dtel.focus();
              return false;
       }
       
    if (document.postart.dstop.value=="选择有效期")
	{
        alert("请选择有效期！");
        document.postart.dstop.focus();
        return false;
    }
}


maxLen = 1500;
function checkMaxInput(form) {
if (form.dtext.value.length > maxLen)
form.remLen.value = 0;
else form.remLen.value = maxLen - form.dtext.value.length;
}

function changeColor(o) {
    document.getElementById("colorBox").style.color = o.value;
}

function changeColor1(o) {
    document.getElementById("colorBox").style.background = o.value;
}
</script>
</head>
<body style="background-image:url(images/background.gif)" onload="checkMaxInput(document.form);">
<table style="height:22; width:100%" border="0" cellpadding="0" cellspacing="1">
      <tr class="topbg">
        <td style="height:22" align="center" class="topbg"><strong> 发布分类信息</strong></td>
      </tr>
</table>
<table style="width:100%"  border="0" align="center" cellpadding="0" cellspacing="0">
        <tr>
          <td style="height:27; width:30" align="center"><img src="<%=AppConst.SiteUrl%>/<%=AppConst.Skinpath%>/gojump01.gif" width="16" height="16" /></td>
          <td> <a href="classad_add.aspx">添加分类信息 </a>  | 
          <a href="Classad_list.aspx">管理分类信息 </a>  | 
          <a href="Classad_shouye.aspx">首页分类信息</a>  | 
          <a href="Classad_fufeiad.aspx">付费分类信息</a>  | 
          <a href="Classad_gudingad.aspx">固顶分类信息</a>  | 
          <a href="Classad_hotad.aspx">热点分类信息</a>  | 
          <a href="Classad_type.aspx">分类管理</a></td>
        </tr>
      </table>
<table style="width:100%" border="0" align="center" cellpadding="1" cellspacing="1" class="border">
  <tr>
    <td style="height:22" align="center" class="Title"><strong>编辑分类信息</strong></td>
  </tr>
  <tr><form action="" method="post" name="postart" onsubmit="return checkadd()">
    <td align="center">
      
        <table style="width:100%" border="0" cellpadding="1" cellspacing="1">
          <tr class="tdbg">
            <td style="height:26; width:27%" align="right">信息标题：</td>
            <td style="height:26" colspan="2"><input type="text" name="dtitle" size="20" maxlength="15" value="<%=rs("title").Value%>" />
              <font color="#FF0000">*<%=rs("ip").Value%></font></td>
          </tr>
          <tr class="tdbg">
            <td style="height:26" align="right">是否加粗：</td>
            <td style="height:26" colspan="2"><input type="radio" value="no" <%If rs("cu").Value="no" Then%>checked<%End If%> name="dcu" />
              否&nbsp;
              <input type="radio" value="yes" name="dcu" <%If rs("cu").Value="yes" Then%>checked<%End If%> />
              是</td>
          </tr>
          <tr class="tdbg">
            <td align="right">标题颜色：</td>
            <td style="height:26; width:160"><input name="dcolor" type="text" id="dcolor" onchange="changeColor(this);" value="<%=rs("color").Value%>" size="8" />
              <input type="button" name="Submit" value="选择颜色" onclick="window.open('../Include/colorpicker.aspx?txtColor=dcolor&onchange=changeColor', 'colorPicker', 'width=200, height=160');" />            </td>
            <td rowspan="2"><div align="center">
                <table style="background-color:#cae2f8; height:24; width:182" border="0" cellpadding="0" cellspacing="1">
        <tr>
          <td style="" align="center" <%If rs("bgcolor1").Value<>"" Then%>bgcolor="<%=rs("bgcolor1").Value%>"<%Else%>bgcolor="#EFF7FE"<%End If%>>
            <table style="height:5; width:166" border="0" cellspacing="0" cellpadding="0">
              <tr>
                <td></td>
              </tr>
            </table>
            <font style="font-size:14px" color="<%If rs("color").Value<>"" Then%><%=rs("color").Value%><%Else%>#000000<%End If%>"><b>原来的标题和背景颜色</b></font></td>
        </tr>
      </table>
        <table style="height:2; width:166" border="0" cellspacing="0" cellpadding="0">
          <tr>
            <td></td>
          </tr>
        </table>
    <table style="background-color:#CAE2F8; height:24; width:182" border="0" cellpadding="0" cellspacing="1">
        <tr>
          <td style="" align="center" <%If rs("bgcolor1").Value<>"" Then%>bgcolor="<%=rs("bgcolor1").Value%>"<%Else%>bgcolor="#EFF7FE"<%End If%>><div id="colorBox1" style="width: 180px;height: 24px">
            <table style="height:5; width:166" border="0" cellspacing="0" cellpadding="0">
              <tr>
                <td></td>
              </tr>
            </table>
                <font style="font-size:14px" color="<%If rs("color").Value<>"" Then%><%=rs("color").Value%><%Else%>#000000<%End If%>"><div id="colorBox"><b>修改后标题和背景颜色</b></div></font>
            </div></td>
        </tr>
      </table>
            </div></td>
          </tr>
          <tr class="tdbg">
            <td align="right">标题背景：</td>
            <td style="height:26"><input name="dbgcolor1" type="text" id="dbgcolor1" onchange="changeColor1(this);" value="<%=rs("bgcolor1").Value%>" size="8" />
              <input type="button" name="Submit" value="选择颜色" onclick="window.open('../Include/colorpicker.aspx?txtColor=dbgcolor1&onchange=changeColor1', 'colorPicker', 'width=200, height=160');" />            </td>
          </tr>		
          <tr class="tdbg">
            <td style="height:26" align="right">信息类别：</td>
            <td style="height:26" colspan="2">
              <select name="dlei" size="1"><%=GetAdClassTypeOptions() %></select>
            </td>
            <script type="text/javascript">document.all.dlei.value='<%=Rs("type").Value%>';</script>
          </tr>
          <tr class="tdbg">
            <td style="height:26" align="right">信息形式：</td>
            <td style="height:26" colspan="2"><input type="radio" value="no" name="dispic" <%If rs("ispic").Value="no" Then%>checked<%End If%> />
              文字信息&nbsp;
              <input type="radio" value="yes" name="dispic" <%If rs("ispic").Value="yes" Then%>checked<%End If%> />
              图片信息</td>
          </tr>
          <tr class="tdbg">
            <td style="height:26" align="right">图片路径：</td>
            <td style="height:26" colspan="2">
              <script type="Text/JavaScript" language="Javascript">
                function openScript(url, width, height)
                {
	                var Win = window.open(url,"openScript",'width=' + width + ',height=' + height + ',resizable=1,scrollbars=no,menubar=no,frameborder=0,status=yes' );
                }
                function openem()
                { 
                    openScript('../upad.htm',300,60); 
                }
      </script>
              <input type="text" name="dpic" size="30" value="<%=rs("pic").Value%>" />
        <input type="button" name="Submit2" value="上传图片" onclick="window.open('../Include/load.aspx?formname=postart&editname=dpic&uppath=/upload/classad/&imagename=&filelx=jpg','','status=no,scrollbars=no,top=20,left=110,width=420,height=165')" /><font color="#FF0000">支持gif、jpg格式</font></td>
          </tr>
          <tr class="tdbg">
            <td style="height:26" align="right">链接推广：</td>
            <td style="height:26" colspan="2"><input name="durl" type="text" id="durl" value="<%=rs("url").Value%>" size="50" /> 
              若为网址推广，请填写链接网址，否则留空</td>
          </tr>
          <tr class="tdbg">
            <td style="height:26" align="right" valign="top">信息内容：</td>
            <td colspan="2"><textarea rows="6" name="dtext" cols="50" onkeydown="checkMaxInput(this.form)" onkeyup="checkMaxInput(this.form)"><%=Rs("text").Value%></textarea>
              <font color="#FF0000">*&nbsp;</font> <font color="#FF0000"><br>
              目前还可写
                  <input readonly type="text" name="remLen" size="4" maxlength="4" style="border: 1 solid #888888" />
        个字！</font> </td>
          </tr>
          <tr class="tdbg">
            <td style="height:26" align="right">联系人：</td>
            <td style="height:26" colspan="2"><input name="dusername" type="text" id="dusername" value="<%=rs("username").Value%>" size="20" maxlength="20" />
              <font color="#FF0000">* </font></td>
          </tr>
          <tr class="tdbg" <%If Not AppConst.ValidateCardId Then%>style="display:none"<%End If%>>
            <td style="height:26" align="right">身份证号：</td>
            <td style="height:26" colspan="2"><input name="dcardid" type="text" id="dcardid" value="<%=rs("cardid").Value%>" size="20" maxlength="18" />
              <font color="#FF0000">* </font></td>
          </tr>
          <tr class="tdbg">
            <td style="height:26" align="right">联系电话：</td>
            <td style="height:26" colspan="2"><input name="dtel" type="text" id="dtel" value="<%=rs("tel").Value%>" size="20" maxlength="20" />
              <font color="#FF0000">* </font></td>
          </tr>
          <tr class="tdbg">
            <td style="height:26" align="right">生效日期：</td>
            <td style="height:26" colspan="2"><input name="dtime" id="dtime" value="<%=String.Format("{0:yyyy-MM-dd}",rs("time").Value)%>" size="15" maxlength="50" />
              <font color="#FF0000">（格式如：2004-10-1）</font></td>
          </tr>
          <tr class="tdbg">
            <td style="height:26" align="right">有效期至：</td>
            <td style="height:26" colspan="2"><input name="dstop" size="15" maxlength="50" value="<%=String.Format("{0:yyyy-MM-dd}",rs("stop").Value)%>" />
              <font color="#FF0000">（格式如：2004-10-1）</font></td>
          </tr>
          <tr class="tdbg">
            <td style="height:26" align="right">是否固顶：</td>
            <td style="height:26" colspan="2"><input type="radio" value="0" name="dtop" <%If rs("ontop").Value="0" Then%>checked<%End If%> />
              否&nbsp;
              <input type="radio" value="1" name="dtop" <%If rs("ontop").Value="1" Then%>checked<%End If%> />
              是</td>
          </tr>
          <tr class="tdbg">
            <td style="height:26" align="right">是否首页显示：</td>
            <td style="height:26" colspan="2"><input type="radio" value="0" name="dshouye" <%If rs("shouye").Value="0" Then%>checked<%End If%> />
              否&nbsp;
              <input type="radio" value="1" name="dshouye" <%If rs("shouye").Value="1" Then%>checked<%End If%> />
              是</td>
          </tr>
          <tr class="tdbg">
            <td style="height:26" align="right">热点分类信息：</td>
            <td style="height:26" colspan="2"><input type="radio" value="0" name="dhot" <%If rs("hot").Value="0" Then%>checked<%End If%> />
              否&nbsp;
              <input type="radio" value="1" name="dhot" <%If rs("hot").Value="1" Then%>checked<%End If%> />
              是</td>
          </tr>
          <tr class="tdbg">
            <td style="height:26" align="right">信息费用：</td>
            <td style="height:26" colspan="2"><input name="dmoney" size="15" maxlength="50" value="<%=rs("money").Value%>" />
        元 </td>
          </tr>
          <tr class="tdbg">
            <td style="height:26" align="right">审核：</td>
            <td style="height:26" colspan="2"><input name="dmark" type="radio" value="0" <%If rs("mark").Value=0 Then%>checked<%End If%> />
        未审核
          <input type="radio" name="dmark" value="1" <%If rs("mark").Value=1 Then%>checked<%End If%> />
        已审核</td>
          </tr>
          <tr class="tdbg">
            <td style="height:30" align="right"> </td>
            <td style="height:30" colspan="2" align="right">
              <p align="left">
                <input type="submit" value="修改" name="submit" />
      &nbsp;
                <input type="reset" value="取消" name="reset" />
      &nbsp;
                <input type="button" value="返回" name="back" onclick="javascript:history.back()" />
            </td>
          </tr>
        </table>
      
      </td>
  </form></tr>
</table>
</div>
</body>
<%Page_Loaded()%>
</html>
