<html>
<head>
<meta http-equiv='Content-Type' content='text/html; charset=gb2312'>
<title>查找会员</title>
<link href="newskin.css" rel="stylesheet" type="text/css">
<style>
.napisdiv {left:10;top:0;width:150;height:100;position:absolute;z-index:3}
.mbb { margin-bottom:3px; border:1px dashed #cdcdcd; }
.mbline { border-top:1px solid #eeeeee; border-bottom:1px solid #eeeeee }
</style>
<script language='javascript' src='area.js'></script>
<script language="javascript" src="../include/dedeajax2.js"></script>
<script language='javascript' src='main.js'></script>
<script language="JavaScript">
var pageno = 1;
var totalrow = <?php echo $totalRow?>;
var pagesize = <?php echo $pagesize?>;
var fkeyword,fsex,fage1,fage2,fprovince,fcity,fpic;
//分析搜索表单
function GetSearchQuery(){
	var searchQuery = "";
	fkeyword = $Obj('keyword').value.replace('&','');
	if($Obj('sex1').checked) fsex='男';
	else if($Obj('sex2').checked) fsex='女';
	else fsex = '';
	fage1 = $Obj('age1').value;
	fage2 = $Obj('age2').value;
	fprovince = $Obj('province').options[$Obj('province').selectedIndex].value;
	fcity = $Obj('city').options[$Obj('city').selectedIndex].value;
	if($Obj('pic1').checked) fpic = 1;
	else fpic = 0;
	searchQuery = "keyword="+fkeyword+"&sex="+fsex+"&age1="+fage1+"&age2="+fage2+"&province="+fprovince+"&city="+fcity+"&pic="+fpic;
  return searchQuery;
}
//加载列表
function ReLoadPage(){
	var listArea = $Obj('memberlist');
	var errMsg = "网络通信出错或没有找到任何记录！<br>[<a href=\"javascript:ReloadPage()\"><u>点击此重新尝试</u></a>]";
  var myajax = new DedeAjax(listArea,true,true,"",errMsg,"正在加载...");
  myajax.SendGet("search_member.php?dopost=getlist&pageno="+pageno+"&"+GetSearchQuery());
}
//载入指定页的列表
function LoadPage(npage){
	pageno = npage;
	ReLoadPage();
	ReloadPageNum(pageno);
}
//重新加载分页列表
function ReloadPageNum(startnum){
var ListArea = $Obj('pagelist');
var pagenum = Math.ceil(totalrow/pagesize);
var listsize = 3;
var ahtml = "";
var startloop = 1;
var endnum = 0;
ahtml += "共："+totalrow+" 条记录/"+pagenum+"页 ";
if(pageno>1 && pageno!=1) ahtml += " <a href='#' onclick='LoadPage(1)'>首页</a> ";
if(pageno>1) ahtml += "<a href='javascript:LoadPage("+(pageno-1)+");'>↑上页</a> ";
if(startnum >= pagenum-listsize){
	startloop = pagenum-(listsize*2);
	if(startloop<1) startloop = 1;
	for(i=startloop;i<=pagenum;i++){
		if(i==pageno) ahtml += i+" ";
		else ahtml += "<a href='javascript:LoadPage("+i+");'>["+i+"]</a> ";
	}
}
else if(pagenum < listsize){
	for(i=1;i<=pagenum;i++){
		if(i==pageno) ahtml += i+" ";
		else ahtml += "<a href='javascript:LoadPage("+i+");'>["+i+"]</a> ";
	}
}
else{
	startloop = startnum-listsize;
	if(startloop<1){ startloop=1; endnum = startloop + (listsize*2); }
	else{ endnum = startnum+listsize; }
	if(endnum >= pagenum) endnum = pagenum;
	for(i=startloop;i<=endnum;i++){
		if(i==pageno) ahtml += i+" ";
		else ahtml += "<a href='javascript:LoadPage("+i+");'>["+i+"]</a> ";
	}
}
if(pageno<pagenum) ahtml += "<a href='javascript:LoadPage("+(pageno+1)+");'>下页↓</a> ";
if(pageno!=pagenum && pagenum>1) ahtml += " <a href='#' onclick='LoadPage("+pagenum+")'>末页</a>";
ListArea.innerHTML = ahtml;
}
</script>
</head>
<body leftmargin='0' topmargin='0'>
<div align="center">
<?php  include(dirname(__FILE__)."/head.htm"); ?>
<table width="769" border="0" align="center" cellpadding="0" cellspacing="0">
<tr> 
<td width="152" height="216" valign="top"> 
<?php include(dirname(__FILE__)."/menu.php");?>
</td>
<td width="9">&nbsp;</td>
<td width="608" valign="top">
	<table width="100%" border="0" align="center" cellpadding="0" cellspacing="0" style="margin-bottom:3px">
<tr align="right" bgcolor="#ffffff"> 
<td background="img/nnnbg.gif" class="gdt">
<table width='97%' cellpadding='0' cellspacing='0'>
<tr>
<td width='30%'><b>查找会员：</b></td>
<td align='right'>&nbsp; </td></tr>
</table>
</td>
</tr>
</table>
<table width="100%" border="0" align="center" cellpadding="3" cellspacing="1" bgcolor="#666666" style="margin-bottom:6px">
<tr bgcolor="#E2EBC0" height="24"> 
<td colspan="6" bgcolor="#FFFFFF">
<form name='form2' action='search_member.php' method='post'>
<table width="585" border="0" cellspacing="2" cellpadding="2">
<tr> 
<td align="center">关键字：</td>
<td><input name="keyword" type="text" id="keyword" style="width:90%" value="<?php echo $keyword?>"></td>
<td>性　别：</td>
<td>
	<input type="radio" id="sex1" name="sex" value="男" class="np"<?php if($sex=='男') echo ' checked';?>>
男 
<input type="radio" id="sex2" name="sex" value="女" class="np"<?php if($sex=='女') echo ' checked';?>>
女 
<input type="radio" id="sex3" name="sex" value="" class="np"<?php if($sex=='') echo ' checked';?>>
不限
</td>
</tr>
<tr> 
<td align="center">年　龄：</td>
<td width="181">
<input name="age1" type="text" id="age1" style="width:50px" value="<?php echo $age1?>">
到 
<input name="age2" type="text" id="age2" style="width:50px" value="<?php echo $age2?>">
岁
</td>
<td width="72">地　区：</td>
<td width="236">
<select name="province" size="1" id="province" width="4" onChange="javascript:selNext($Obj('city'),this.value)" style="width:85">
<?php  if($province>0) echo "<option value='$province' selected>".GetProvince($province,$dsql)."</option>"; ?>
<option value="0">--不限--</option>
</select>
 &nbsp;城市： 
<select id="city" name="city" width="4" style="width:85">
<?php  if($city>0) echo "<option value='$city' selected>".GetProvince($city,$dsql)."</option>"; ?>
<option value="0">--不限--</option>
</select>
<script language='javascript'>
selTop($Obj('province'));
<?php  if($province>0){ ?>
selNextDf($Obj('city'),<?php echo $province?>,<?php echo $city?>,"<?php echo GetProvince($city,$dsql)?>");
<?php  } ?>
</script>
</td>
</tr>
<tr> 
<td width="70" align="center">相　片：</td>
<td>
<input type="radio" id="pic1" name="pic" value="1"<?php if($pic==1) echo " checked";?>>
有 
<input name="pic" id="pic2" type="radio" value="0"<?php if(empty($pic)) echo " checked";?>>
不限
</td>
<td>&nbsp;</td>
<td><input class="np" name="imageField" type="image" src="img/button_search.gif" width="60" height="22" border="0"></td>
</tr>
</table>
</form>
</td>
</tr>
</table>
<span id="memberlist"><?php  GetList($dsql,$pageno,$pagesize); ?></span> 
<table width="100%" border="0" align="center" cellpadding="3" cellspacing="1" bgcolor="#cdcdcd" style="margin-top:6px">
<tr bgcolor="#F9FCEF" height="24" align="center"> 
<td height="35">
<span id="pagelist"></span>
<script language='javascript'>ReloadPageNum(1);</script>
</td>
</tr>
</table>
</td>
</tr>
</table>
<?php 
include(dirname(__FILE__)."/foot.htm");
?>
</div>
</body>
</html>