<!--#include file="../inc/config.asp"-->
<!--#include file="../inc/conn.asp"-->
<!--#include file="../esf/inc/function.asp"-->
<!-- #include file="inc/Session.asp" -->
<!-- #include file="inc/checkrole.asp" -->
<%
'''''''''''''''''''''''''''''''''''''''''''''''
call checkPrevilege(Session("Name"),"p14")
'''''''''''''''''''''''''''''''''''''''''''''''
dim act,id
act=request.queryString("act")
id=Clng(request.QueryString("id"))
%>
<html>
<head>
<title>二手房发布</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link href="/style/global.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="/js/common.js"></script>
<script language="javascript" src="http://api.51ditu.com/js/maps.js"></script>
<script language="javascript" src="http://api.51ditu.com/js/ezmarker.js"></script>
<style type="text/css">
<!--
.style3 {	color: #003366;
	font-weight: bold;
}
.style4 {color: #FF0000}
.style5 {
	font-size: 16px;
	color: #CC0000;
}
-->
</style>
<script type="text/javascript">
//检查是否为数字
function checkint(elem)
{
  var checkOK = ".0123456789";
  var checkStr = elem.value;
  var allValid = true;
  var decPoints = 0;
  var allNum = "";
  for (i = 0;  i < checkStr.length;  i++)
  {
		ch = checkStr.charAt(i);
    	for (j = 0;  j < checkOK.length;  j++)
      	if (ch == checkOK.charAt(j))
        break;
    	if (j == checkOK.length)
    	{
      		allValid = false;
      		break;
    	}
  }
  if (!allValid)
  {
    	alert("只能输入数字。");
    	elem.focus();
    	return (false);
  }
  return (true);
}
//
function checkprice(){
	if (event.keyCode < 48 || event.keyCode > 57)
		event.returnValue = false;
	if(event.keyCode==46)
		event.returnValue = true;
}
function check(obj)
{	
	obj.Submit.disabled=true;
	if(document.fdcform.Address.value==""){
		alert("请输入房屋具体位置!");
		document.fdcform.Address.select();
		document.fdcform.Address.focus();
		obj.Submit.disabled=false;
		return false; 
	}
	if(document.fdcform.Address.value.search(/\d{7,11}/g)!= -1){
		alert("房屋具体位置中不能有电话号码"); 
		document.fdcform.Address.select();
		document.fdcform.Address.focus();
		obj.Submit.disabled=false;
		return false; 
	}
	if(document.fdcform.Address.value.length>=25){
		alert("房屋具体位置不能超过25个字符"); 
		document.fdcform.Address.select();
		document.fdcform.Address.focus();
		obj.Submit.disabled=false;
		return false; 
	}
	if (document.fdcform.Price.value.length<=0)
 	{  
		alert ("价格不能为空");
  		document.fdcform.Price.focus();
		obj.Submit.disabled=false;
  		return false;
 	}
	if (document.fdcform.ContactMan.value.length<=0)
 	{  
		alert ("联系人不能为空");
  		document.fdcform.ContactMan.focus();
		obj.Submit.disabled=false;
  		return false;
 	}
	if (document.fdcform.ContactType.value.length<=0)
 	{
		alert ("联系方式不能为空");
  		document.fdcform.ContactType.focus();
		obj.Submit.disabled=false;
  		return false;
 	}	
 	if (document.fdcform.OtherDes.value.search(/\d{7,11}/g)!= -1 ) 
	{ 
		alert("说明中不能有电话号码"); 
		document.fdcform.OtherDes.select();
		document.fdcform.OtherDes.focus();
		obj.Submit.disabled=false;
		return false; 
	}
	
	return true;
}
function SelectOption(obj,id){
	for(var i=0;i<obj.length;i++){
		if(obj.options[i].value==id)
			obj.options[i].selected=true;
			
	}
}
</script>
</head>
<body>
<%
if(act="do") then
dim AreaId,InfotypeId,RoomTypeId,FloorLevelId,Address,Acreage,Price,PriceUnit,ContactMan,ContactType,OtherDes,HouseType,DelPass,SexDemond,MapX,MapY,MapZ,Photo,Bus
	dim AreaTitle,InfoTypeTitle,RoomTypeTitle,FloorLevelTitle
	dim AreaName,Zxcd,Ptss,Snss,Cqxz,Jznd
	AreaId=Cint(request.form("AreaId"))
	AreaTitle=getAreaTitle(AreaId)
	InfotypeId=Cint(request.form("InfotypeId"))
	InfoTypeTitle=getInfoTypeTitle(InfotypeId)
	RoomTypeId=Cint(request.form("RoomTypeId"))
	RoomTypeTitle=getRoomTypeTitle(RoomTypeId)
	FloorLevelId=Cint(request.form("FloorLevelId"))
	FloorLevelTitle=getFloorLevelTitle(FloorLevelId)
	Address=request.form("Address")
	Acreage=CDbl(request.form("Acreage"))
	Price=CDbl(request.form("Price"))
	PriceUnit=left(request.Form("PriceUnit"),10)
	ContactMan=request.form("ContactMan")
	ContactType=request.form("ContactType")
	OtherDes=request.form("OtherDes")
	HouseType=Cint(request.Form("HouseType"))
	DelPass=request.Form("DelPass")
	Bus=left(request.Form("Bus"),50)
	if(request.Form("MapX")<>"") then
		MapX=Clng(request.Form("MapX"))
	else
		MapX=0
	end if
	if(request.Form("MapY")<>"") then
		MapY=Clng(request.Form("MapY"))
	else
		MapY=0
	end if
	if(request.Form("MapZ")<>"") then
		MapZ=Clng(request.Form("MapZ"))
	else
		MapZ=0
	end if
	AreaName=request.form("AreaName")
	Zxcd=request.form("Zxcd")
	Ptss=request.form("Ptss")
	Snss=request.form("Snss")
	Cqxz=request.form("Cqxz")
	Jznd=request.form("Jznd")
	set rs=server.CreateObject("adodb.recordset")
	rs.open "select * from t_2house where id="&id,conn,3,3
	rs("InfoTypeId")=InfoTypeId
	rs("AreaId")=AreaId
	rs("RoomTypeId")=RoomTypeId
	rs("FloorLevelId")=FloorLevelId
	rs("Acreage")=Acreage
	rs("Price")=Price
	rs("PriceUnit")=PriceUnit
	rs("Address")=Address
	rs("ContactMan")=ContactMan
	rs("ContactType")=ContactType
	rs("OtherDes")=OtherDes
	rs("IsCheck")=1
	rs("UserIp")=GetIp
	rs("HouseType")=HouseType
	rs("ModiTime")=now()
	rs("DelPass")=DelPass
	rs("MapX")=MapX
	rs("MapY")=MapY
	rs("MapZ")=MapZ
	rs("Bus")=Bus
	rs("AreaTitle")=AreaTitle
	rs("InfoTypeTitle")=InfoTypeTitle
	rs("RoomTypeTitle")=RoomTypeTitle
	rs("FloorLevelTitle")=FloorLevelTitle
	rs("AreaName")=AreaName
	rs("Zxcd")=Zxcd
	rs("Ptss")=Ptss
	rs("Snss")=Snss
	rs("Cqxz")=Cqxz
	rs("Jznd")=Jznd
	rs.update
	rs.close
	set rs=nothing
	'call SendHtm()
	response.write("<p align=""center"">成功修改二手房信息!&nbsp;&nbsp;<a href=""javascript:history.back();"">返回</a></p>")
else
	set rs=server.CreateObject("adodb.recordset")
	rs.open "select * from t_2house where id="&id,conn,3,1
	if not rs.eof then		
		OtherDes=rs("OtherDes")
%>
<form id="fdcform" name="fdcform" method="post" action="?act=do&id=<%=id%>" onSubmit="return check(this)">
  <table width="760" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#fff0cf">
    <tr>
      <td height="24" bgcolor="#fff0cf"><div align="center"><a href="/esf/">二手房首页</a>&lt;&lt;</div></td>
      <td height="24" bgcolor="#fff0cf"><div align="left"><span class="style3 style5">二手房信息修改</span></div></td>
    </tr>
    <tr>
      <td bgcolor="#FFFFFF" class="padleft_10">信息类别：</td>
      <td bgcolor="#FFFFFF" class="pad_5"><div align="left">
        <select name="InfoTypeId">
          <%=getInfoTypeSelect(rs("InfoTypeId"))%>
        </select>
      </div></td>
    </tr>
    <tr>
      <td bgcolor="#FFFFFF" class="padleft_10">地区：</td>
      <td bgcolor="#FFFFFF" class="pad_5"><div align="left">
        <select name="AreaId" id="AreaId">
					<script type="text/javascript" src="/js/area.js"></script>
        </select>
        <script type="text/javascript">
				SelectOption(document.fdcform.AreaId,<%=rs("AreaId")%>);
				</script>
      所属小区：
                    <input name="AreaName" type="text" id="AreaName" value="<%=rs("AreaName")%>" size="15">
      </div></td>
    </tr>
    <tr>
      <td bgcolor="#FFFFFF" class="padleft_10">房屋具体位置：</td>
      <td bgcolor="#FFFFFF" class="pad_5"><div align="left">
        <input name="Address" type="text" id="Address" value="<%=rs("Address")%>" size="44" maxlength="70">
        <span class="style4">*</span> 
        <input type="hidden" name="MapX" id="MapX" value="<%=rs("MapX")%>">
        <input type="hidden" name="MapY" id="MapY" value="<%=rs("MapY")%>">
        <input type="hidden" name="MapZ" id="MapZ" value="<%=rs("MapZ")%>">
        <script language="JavaScript">
				<!--
						//setMap是ezmarker内部定义的接口，这里可以根据实际需要实现该接口 
						function setMap(point,zoom)
						{
							document.getElementById("MapX").value=point.getLongitude();
							document.getElementById("MapY").value=point.getLatitude();
							document.getElementById("MapZ").value=zoom;
							ezmarker.setButtonImage("/images/updataMap.jpg");
							document.getElementById('MapResult').innerHTML='<span style="color:red;">成功标注!</span>';
						}
				
						var ezmarker = new LTEZMarker("pos");
						ezmarker.setDefaultView('<%=CityName%>',2);
						ezmarker.setPlaceList(false);//在地图上显示快速定位控件
						LTEvent.addListener(ezmarker,"mark",setMap);//"mark"是标注事件
					
				//-->
				</script>
        <span id="MapResult"></span>
      </div></td>
    </tr>
    <tr>
      <td bgcolor="#FFFFFF" class="padleft_10">公交：</td>
      <td bgcolor="#FFFFFF" class="pad_5"><input type="text" name="Bus" id="Bus" value="<%=rs("Bus")%>"></td>
    </tr>
    <tr>
      <td bgcolor="#FFFFFF" class="padleft_10">物业类型：</td>
      <td bgcolor="#FFFFFF" class="pad_5">
        <select name="HouseType">
            <option value="1">普通住宅</option>
            <option value="2">公寓</option>
            <option value="3">别墅</option>
            <option value="4">经济适用房</option>
            <option value="5">商住楼</option>
            <option value="6">花园洋房</option>
            <option value="7">高尚住宅</option>
            <option value="8">复式</option>
            <option value="9">店面</option>
            <option value="10">其他</option>
      	</select>
        <script type="text/javascript">
				SelectOption(document.fdcform.HouseType,<%=rs("HouseType")%>);
				</script>
      </td>
    </tr>
    <tr>
      <td bgcolor="#FFFFFF" class="padleft_10">户型：</td>
      <td bgcolor="#FFFFFF" class="pad_5"><div align="left">
        <select name="RoomTypeId" id="RoomTypeId" >
          <%=getRoomTypeSelect(rs("RoomTypeId"))%>
        </select>
      </div></td>
    </tr>
    <tr>
      <td width="227" bgcolor="#FFFFFF" class="padleft_10">楼层：</td>
      <td width="530" bgcolor="#FFFFFF" class="pad_5"><div align="left">
        <select name="FloorLevelId" id="FloorLevelId" >
          <%=getFloorLevelSelect(rs("FloorLevelId"))%>
        </select>
      </div></td>
    </tr>
    <tr bgcolor="#F5F5F5">
      <td bgcolor="#FFFFFF" class="padleft_10">使用面积：</td>
      <td height="30" bgcolor="#FFFFFF" class="pad_5"><div align="left">
        <input name="Acreage" type="text" id="Acreage" onBlur="checkint(this)" onKeyPress="checkprice()" value="<%=rs("Acreage")%>" size="8" maxlength="8">
      </div></td>
    </tr>
    <tr bgcolor="#F5F5F5">
      <td bgcolor="#FFFFFF" class="padleft_10">价格：</td>
      <td height="30" bgcolor="#FFFFFF" class="pad_5"><div align="left">
        <input name="Price" type="text" id="Price" onKeyPress="checkprice()" value="<%=rs("Price")%>" size="5" maxlength="10">
        <select name="PriceUnit" id="PriceUnit">
          <option value="元">元</option>
          <option value="万元">万元</option>
        </select>
        [租赁以元/月为单位，售以万元/套为单位]<span class="style4">*</span></div></td>
    </tr>
    <tr bgcolor="#F5F5F5">
                    <td bgcolor="#FFFFFF" class="padl10">装修程度：</td>
                    <td height="30" bgcolor="#FFFFFF" class="padl5"><input name="Zxcd" type="text" id="Zxcd" value="<%=rs("Zxcd")%>"></td>
          </tr>
                  <tr bgcolor="#F5F5F5">
                    <td bgcolor="#FFFFFF" class="padl10">配套设施：</td>
                    <td height="30" bgcolor="#FFFFFF" class="padl5"><input name="Ptss" type="text" id="Ptss" value="<%=rs("Ptss")%>"></td>
                  </tr>
                  <tr bgcolor="#F5F5F5">
                    <td bgcolor="#FFFFFF" class="padl10">产权性质：</td>
                    <td height="30" bgcolor="#FFFFFF" class="padl5"><input name="Cqxz" type="text" id="Cqxz" value="<%=rs("Cqxz")%>">
                    建筑年代：
                    <input name="Jznd" type="text" id="Jznd" value="<%=rs("Jznd")%>" size="15"></td>
                  </tr>
                  
                  <tr align="left" bgcolor="#F3F3F3">
                    <td height="25" bgcolor="#FFFFFF" class="padl10">室内设施：</td>
                    <td  bgcolor="#FFFFFF" class="padl5"><input name="Snss" type="text" id="Snss" value="<%=rs("Snss")%>"></td>
                  </tr>
    <tr bgcolor="#F5F5F5">
      <td bgcolor="#FFFFFF" class="padleft_10">其他说明：</td>
  <td height="30" bgcolor="#FFFFFF" class="pad_5">请写入煤气、暖气、有线电视等基础设施状况，房价等等。<br>
      <textarea name="OtherDes" cols="61" rows="3" id="OtherDes"><%=OtherDes%></textarea>      </td>
    </tr>
    <tr align="left" valign="top" bgcolor="#F3F3F3"  id="hz3" style="display:none ">
      <td bgcolor="#FFFFFF" class="padleft_10">&nbsp;</td>
      <td bgcolor="#FFFFFF" class="pad_5"> 请详细填写个人情况、房屋情况、合租伙伴要求、合租房屋要求等情况 </td>
    </tr>
    <tr bgcolor="#F5F5F5">
      <td bgcolor="#FFFFFF" class="padleft_10">联系人：</td>
      <td height="30" bgcolor="#FFFFFF" class="pad_5"><div align="left">
        <input name="ContactMan" type="text" id="ContactMan" value="<%=rs("ContactMan")%>" size="15" maxlength="30">
      <span class="style4">*</span></div></td>
    </tr>
    <tr bgcolor="#F5F5F5">
      <td bgcolor="#FFFFFF" class="padleft_10">联系方式：</td>
      <td height="30" bgcolor="#FFFFFF" class="pad_5"><div align="left">
        <input name="ContactType" type="text" id="ContactType" value="<%=rs("ContactType")%>" size="40" maxlength="50">
      <span class="style4">*</span></div></td>
    </tr>    

  </table>
  <table width="760" border="0" align="center" cellpadding="0" cellspacing="0">
    <tr>
      <td height="30" bgcolor="#FFF0CF"><div align="center">
        <input type="submit" name="Submit" value="提  交" />
        &nbsp;&nbsp;
        <input type="reset" name="Submit2" value="重  填" />
      </div></td>
    </tr>
  </table>
</form>
<%
	end if
end if
function SendHtm()
	dim show_htm,last_id
	set rs=server.CreateObject("adodb.recordset")
	rs.open "select top 1 id from  t_2house order by id desc",conn,3,1
	if not rs.eof then
		last_id=rs(0)
		show_htm=ReadHtml(SiteUrl&"/esf/show.asp?id="&last_id,"gb2312")
		response.Write(last_id)
		call SaveTextFile(server.MapPath("/esf/show/")&"\"&last_id&".htm",show_htm)		
	end if
	rs.close
	set rs=nothing
end function
%>
</body>
</html>
<%
call connclose()
%>
