<!--#include file="top.asp"--><%usertopview%>
<%if userflag1=0 then
response.redirect"ok.asp?action=flag"
end if%>
<script language = "JavaScript" src = "user_admin.js" type="text/javascript"></script>
<%sql = "select *  from dlxf_ypxxtwo order by dlxf_date desc"
set rs=server.createobject("ADODB.Recordset")
rs.open sql,conn,1,1%>
<script language = "JavaScript">
var onecount;
onecount=0;
subcat = new Array();
<%count = 0
do while not rs.eof%>
subcat[<%=count%>] = new Array("<%= trim(rs("dlxf_ypxxtwo"))%>","<%= trim(rs("dlxf_ypxxone_id"))%>","<%= trim(rs("dlxf_ypxxtwo_id"))%>");
        <%count = count + 1
        rs.movenext
        loop
        rs.close
        set rs=nothing%>
onecount=<%=count%>;

function changelocation(ypxxone)
    {
    document.addform.ypxxtwo_id.length = 0; 

    var ypxxone_id=ypxxone_id;
    var i;
    document.addform.ypxxtwo_id.options[0] = new Option('请选择小类','');
    for (i=0;i < onecount; i++)
        {
            if (subcat[i][1] == ypxxone)
            { 
                document.addform.ypxxtwo_id.options[document.addform.ypxxtwo_id.length] = new Option(subcat[i][0], subcat[i][2]);
            }        
        }
        
    }    
</script>
<script language="JavaScript">
<!--
function checkdata() {
if( addform.cpname.value =="") {
alert("\添加产品出错，下面是产生错误的可能原因：\n\n·请输入产品名称")
return false;
}
if( addform.sortid.value =="") {
alert("\添加产品出错，下面是产生错误的可能原因：\n\n·请选择产品分类")
return false;
}
if( addform.cpjg.value =="") {
alert("\添加产品出错，下面是产生错误的可能原因：\n\n·请输入产品价格")
return false;
}
if( addform.cpjl.value =="") {
alert("\添加产品出错，下面是产生错误的可能原因：\n\n·请输入产品计量单位")
return false;
}
if( addform.ypxxone_id.value !="") {
if( addform.ypxxtwo_id.value =="") {
alert("\发布商机出错，下面是产生错误的可能原因：\n\n·如果您选择了行业大类，那么其小类必须选择")
return false;
}
}
if( addform.cpjm.value =="" || addform.cpjm.value.length>100) {
alert("\添加产品出错，下面是产生错误的可能原因：\n\n·请输入不多于100字符的产品简介")
return false;
}
return true;
}
// -->
</script>
<script LANGUAGE=JavaScript>
  function textLimitCheck(thisArea, maxLength){
    if (thisArea.value.length > maxLength){
      alert(maxLength + ' 个字限制. \r超出的将自动去除.');
      thisArea.value = thisArea.value.substring(0, maxLength);
      thisArea.focus();
    }
    /*回写span的值，当前填写文字的数量*/
    messageCount.innerText = thisArea.value.length;
  }
</script>
<table width="760" border="0" cellspacing="0" cellpadding="0" bgcolor="#FFFFFF">
<tr>
<td width="160" valign=top bgcolor=#efefef>
<!--==============-->
<!--#include file="left.asp"-->
<!--==============-->
</td>
<td width="600" valign=top>
<!--==============-->
<table width="500" border="0" cellspacing="0" cellpadding="0" align="center">
<tr><td height=25>您现在的位置是：管理中心 > 产品管理</td></tr>
  <tr>
    <td>
<!--####################################-->
<table width="100%" border="0" cellspacing="1" cellpadding="0" bgcolor=#6C94D1>
  <tr>
    <td height=25 bgcolor=#6C94D1>　　<font color=white>产品添加</font></td>
  </tr>
  <tr>
    <td bgcolor=#ffffff height=25>
<!--======-->
<table width="80%" border="0" cellspacing="0" cellpadding="0" align=center>
<form name="addform" method="post" action="cp_save.asp" onSubmit="return checkdata()">
<%sql1="select *  from dlxf_yp where dlxf_id="&session("id")
set rs1=server.createobject("ADODB.Recordset")
rs1.open sql1,conn,1,1%>
<input name="aaa" type="hidden" value="<%=rs1("dlxf_ypxxone_id")%>">
<input name="bbb" type="hidden" value="<%=rs1("dlxf_ypxxtwo_id")%>">
<%rs1.close
set rs1=nothing%>
  <tr>
    <td height=30 align="center" colspan="2"><font color=#666666>带 * 为必填项</font></td>
  </tr>
  <tr>
    <td width="21%" align=right height=30><font color=red>*</font>产品名称： &nbsp;</td>
	<td width="79%"><input name="cpname" type="text" size="20" maxlength="40"></td>
  </tr>
  <tr>
    <td align=right height=30><font color=red>*</font>产品分类： &nbsp;</td>
	<td><select name="sortid">
<%sql="select * from dlxf_cp_sort where dlxf_yp_id="&session("id")&" order by dlxf_date desc"
set rs=server.createobject("ADODB.Recordset")
rs.open sql,conn,1,1
if rs.eof then%>
<option value="" selected>请先添加您的产品分类</option>
<%else%>
<option value="" selected>请选择...</option>
<%while not rs.eof%>
<option value="<%=rs("dlxf_id")%>"><%=rs("dlxf_cpsort")%></option>
<%rs.movenext
wend
end if
rs.Close()
%> 
</select> <font color=#666666>如没有请先<a href=cp_sort.asp class=red>添加分类</a></font></td>
  </tr>
  <tr>
    <td align=right height=30><font color=red>*</font>参考价格： &nbsp;</td>
	<td><input name="cpjg" type="text" size="10" maxlength="10">
<select name="jgdw">
<option value="美元">美元</option>
<option value="欧元">欧元</option>
<option value="英镑">英镑</option>
<option value="港币">港币</option>
<option value="日元">日元</option>
<option value="人民币" selected>人民币</option>
<option value="澳门元">澳门元</option>
<option value="泰国铢">泰国铢</option>
<option value="加拿大元">加拿大元</option>
<option value="瑞士法郎">瑞士法郎</option>
<option value="新加坡元">新加坡元</option>
<option value="瑞典克朗">瑞典克朗</option>
<option value="丹麦克朗">丹麦克朗</option>
<option value="挪威克朗">挪威克朗</option>
<option value="新西兰元">新西兰元</option>
<option value="澳大利亚元">澳大利亚元</option>
<option value="菲律宾比索">菲律宾比索</option>
</select></td>
  </tr>
  <tr>
    <td align=right height=30><font color=red>*</font>计量单位： &nbsp;</td>
	<td><input name="cpjl" type="text" size="10" maxlength="10"></td>
  </tr>
  <tr>
    <td align=right height=30>产品编号： &nbsp;</td>
	<td><input name="cpbh" type="text" size="30" maxlength="48"></td>
  </tr>
  <tr>
    <td align=right height=30>产地： &nbsp;</td>
	<td><input name="cpcd" type="text" size="30" maxlength="48"></td>
  </tr>
  <tr>
    <td align=right height=30>规格： &nbsp;</td>
	<td><input name="cpgg" type="text" size="30" maxlength="48"></td>
  </tr>
  <tr>
  <td align=right height=40>主营行业： &nbsp;</td>
  <td><p style="line-height:180%"><select name="ypxxone_id" onChange="changelocation(document.addform.ypxxone_id.options[document.addform.ypxxone_id.selectedIndex].value)">
<option value="" selected>请选择大类</option>
<%sql="select *  from dlxf_ypxxone order by dlxf_date desc"
set rs=server.createobject("ADODB.Recordset")
rs.open sql,conn,1,1
while not rs.eof%>
<option value="<%=rs("dlxf_ypxxone_id")%>"><%=rs("dlxf_ypxxone")%></option>
<%rs.movenext
wend
rs.Close()
%> 
</select>
<select name="ypxxtwo_id">
<option selected value="">请选择小类</option>
</select><br><font color=#666666>如不选则默认为您的企业所在的行业</font></td>
  </tr>
  <tr>
    <td align=right height=30>产品图片： &nbsp;</td>
	<td><input name="dlxf_pic" type="text" size="40" maxlength="48" onClick="lookmagic(1)" ID="magicfacepic(1)" readonly> <font onclick="lookmagic(1)" style="CURSOR:hand">选择图片</font>
	<div id="magicframe(1)" style="visibility:hidden; position: absolute;width:10; left: 2px; top: 479px;"><iframe src="my_picture_view.asp?action=1" width="380" height="270" frameborder="0" scrolling="no"></iframe></div></td>
  </tr>

  <tr>
    <td align=right height=102><font color=red>*</font>产品简介： &nbsp;</td>
	<td><p style="line-height:180%"><textarea name="cpjm" cols=45 rows=4></textarea><br><font color=#666666>限 100 个字符</font></td>
  </tr>
  <tr>
    <td align=right height=30>详细说明： &nbsp;</td>
	<td><p style="line-height:180%"><textarea name="cpsm" cols=45 rows=10 onkeyUp="textLimitCheck(this, 1000);"></textarea><br><font color=#666666>限 1000 个字符  已输入 <font color="#CC0000"><span id="messageCount">0</span></font> 个字</font></td>
  </tr>
  <tr>
    <td height=30 align="center" colspan="2"><input type="submit" name="Submit" value="提 交" class="input1"></td>
  </tr>
</form>
</table>
<!--======-->
	</td>
  </tr>
</table>
<!--####################################-->
	</td>
  </tr>
<tr><td height=25></td></tr>
</table>
<!--==============-->
</td>
</tr>
</table>
<!--====== bottom ========-->
<table width="100%" border="0" align="center" cellpadding="0" cellspacing="0" background="img/bottom_bg.gif">
<tr><td height=2 bgcolor=#6C94D1></td></tr>
  <tr>
    <td align="center" height=80><%=citybottom%></td>
  </tr>
</table>
<script language="javascript"> 
    changelocation(document.addform.ypxxone_id.options[document.addform.ypxxone_id.selectedIndex].value); 
</script>
