var useradmin=0;
var bgcolor;
var statesa;
var stcompany;
function DateTime(str)
{
	var time=str.match(/^(\d{1,4})(-|\/)(\d{1,2})\2(\d{1,2}) (\d{1,2}):(\d{1,2}):(\d{1,2})$/);
	if(time==null) return str;
	return time[1]+'-'+time[3]+'-'+time[4];
}
function ex_each_stock_top()
{
	document.write ('<table class=a2 width='+assignwidth+' cellspacing=1 cellpadding=3 align=center border=0>');
	document.write ('<tr><td colspan=10 align=center height=25 class=a1>-=> 个 人 股 票 上 市 申 请 一 览 表 <=-</td></tr>');
	document.write ('<tr align="center"><td class=a4><b>ID</b></td><td class=a4><b>代码</b></td><td class=a4><b>股票名称</b></td><td class=a4><b>申请人</b></td><td class=a4><b>股票数量</b></td><td class=a4><b>上市价格</b></td><td class=a4><b>每日交易量</b></td><td class=a4><b>申请日期</b></td><td class=a4><b>审批</b></td><td class=a4><b>操作</b></td></tr>');
}
function ex_each_stock(id,code,sid,username,eachuserid,company,stockprice,stocknum,applydate,states,explain,decideid,todaytradesum,lockstock)
{
	if (bgcolor=='a3'){bgcolor='a4';}else{bgcolor='a3';}
	if (decideid>0){stcompany='<div><a href=Exsm_Plus_DispCompare.asp?sid='+decideid+'>上市资讯</a></div><div><a href=Exsm_Plus_Exchange.asp?sid='+decideid+'>进行交易</a></div>';}else{stcompany='';}
	if (lockstock==0){if (states==0){statesa='未审核';}else{if (states==1){statesa='已批准';}else{if (states==2){statesa='待批准';}else{statesa='不批准';}}}}else{statesa='<font color="#FF0000">封盘</font>';}
	if (useradmin==1)
	{
		var adminmenueach='<a onmouseover="cziemenu(event,\'';
		if (states==0)
		{
			adminmenueach+='<div><a href=?action=UserStat&stat=Yes&sid='+sid+'>批准</a></div><div><a href=?action=UserStat&stat=No&sid='+sid+'>不准</a></div>';
		}
		else
		{
			if (states==1)
			{
				if (lockstock==0)
				{
					adminmenueach+='<div><a href=Exsm_Plus_Admin_Gupiao.asp?action=ChangStat&stat=closethis&sid='+decideid+'>封盘</a></div>';
				}
				else
				{
					adminmenueach+='<div><a href=Exsm_Plus_Admin_Gupiao.asp?action=ChangStat&stat=openthis&sid='+decideid+'>开市</a></div>';
				}
			}
			else
			{
				if (decideid==0)
				{
					adminmenueach+='<div><a href=?action=UserStat&stat=Yes&sid='+sid+'>批准</a></div>';
				}
				else
				{
					if (lockstock==0)
					{
						adminmenueach+='<div><a href=?action=UserStat&stat=OnceAgainYes&sid='+sid+'>批准</a></div><div><a href=?action=UserStat&stat=No&sid='+sid+'>不准</a></div><div><a href=Exsm_Plus_Admin_Gupiao.asp?action=ChangStat&stat=closethis&sid='+decideid+'>封盘</a></div>';
					}
					else
					{
						adminmenueach+='<div><a href=Exsm_Plus_Admin_Gupiao.asp?action=ChangStat&stat=openthis&sid='+decideid+'>开市</a></div>';
					}
				}
			}
		}
		adminmenueach+='<div><a href=?action=edit&sid='+sid+'>编辑</a></div><div>';
		if (states==0)
		{
			adminmenueach+='<div><a href=javascript:DelUserSt('+sid+')>撤销</a>';
		}
		else
		{
			adminmenueach+='<a href=Exsm_Plus_Admin_Gupiao.asp?action=DelStock&Sid='+decideid+'>删除</a>';
		}
		adminmenueach+='</div>\',\'\',0)">操作</a>';
	}
	else
	{
		if (eachuserid==userid)
		{
			var adminmenueach='<a onmouseover="cziemenu(event,\'';
			adminmenueach+='<div><a href=?action=edit&sid='+sid+'>编辑</a></div>';
			if (states==0)
			{
				adminmenueach+='<div><a href=javascript:DelUserSt('+sid+')>注销</a>';
			}
			adminmenueach+='</div>\',\'\',0)">操作</a>';
		}
		else
		{
			var adminmenueach='-';
		}
	}
	document.write ('<tr align="center"><td class="'+bgcolor+'" rowspan=2>'+id+'</td>');
	document.write ('<td class="'+bgcolor+'"><Font color="olive">'+code+'</Font></td>');
	document.write ('<td class="'+bgcolor+'"><a title="进入个股编辑页" href="?action=edit&sid='+sid+'" onmouseover="cziemenu(event,\'<div><a href=?action=edit&sid='+sid+'>编辑该股</a></div>'+stcompany+'\',\'\',15)">'+company+'</a></td>');
	document.write ('<td class="'+bgcolor+'"><a href="Exsm_Plus_Dispu.asp?uid='+eachuserid+'&username='+username+'">'+username+'</a></td>');
	document.write ('<td class="'+bgcolor+'">'+Compute(stocknum,0)+'</td>');
	document.write ('<td class="'+bgcolor+'">'+Formatnumber(''+Compute(stockprice,2)+'')+'</td>');
	document.write ('<td class="'+bgcolor+'">'+Compute(todaytradesum,0)+'</td>');
	document.write ('<td class="'+bgcolor+'">'+DateTime(applydate)+'</td>');
	document.write ('<td class="'+bgcolor+'">'+statesa+'</td>');
	document.write ('<td class="'+bgcolor+'">'+adminmenueach+'</td></tr>');
	document.write ('<tr><td colspan=11 class="'+bgcolor+'">公司简介：'+explain+'</td></tr>');
}
function ex_each_stock_root()
{
	ex_each_stock_menu();
	document.write ('<table width='+assignwidth+' cellspacing=0 cellpadding=1 align=center border=0>');
	document.write ('<tr><td align=left>页次：'+page+' / '+pagecount+'页 每页'+pagesize+'个 共'+recordcount+'个</td>');
	document.write ('<td Align=Right>分页：'+DispPageNum(page,pagecount,'?page=','','','""')+'</td></tr>');
	document.write ('</table>');
}
function ex_each_stock_menu()
{
	if (bgcolor=='a3'){bgcolor='a4';}else{bgcolor='a3';}
	document.write ('<tr><td class="'+bgcolor+'" align=center colspan=10><a href=?action=NewStock>申请上市</a>&nbsp;&nbsp;&nbsp;&nbsp;<a href="Exsm_Plus_Gupiao.asp"><< 返回股市大厅</a></td></tr>');
	document.write ('</table>');
}
function ex_each_stock_naught()
{
	document.write ('<tr><td colspan=10 class=a3>没有人申请个股上市股票</td></tr>');
	ex_each_stock_menu();
}
function ex_each_stock_new()
{
	document.write ('<table class=a2 width='+assignwidth+' cellspacing=1 cellpadding=3 align=center border=0>');
	document.write ('<tr><td colspan=2 align=center height=25 class=a1>-=> 个 股 上 市 申 请 表 <=-</td></tr>');
	document.write ('<form method=post action="?action=SaveUsSt" name="form1">');
	document.write ('<tr><td class=a3 width="50%"><u>申请人</u></td><td class=a3 width="50%">&nbsp;'+username+'</td></tr>');
	document.write ('<tr><td class=a4><u>股票代码</u><br>必须填写股市代码方便以后查询</td><td class=a4>&nbsp;<input type=text name=gpcode value=""></td></tr>');
	document.write ('<tr><td class=a3><u>上市公司名称</u><br>即股票名，最短['+minname+']Byte，最长['+maxname+']Byte</td><td class=a3 width="50%">&nbsp;<input type=text name=gpname value="">&nbsp;<input type=button value="检测股票代码和名称　" name=button onclick=ExCheckData(1)></td></tr>');
	document.write ('<tr><td class=a4><u>上市股票单价</u><br>单价范围：[￥'+minprice+']～[￥'+maxprice+']！您的资金['+Formatnumber(''+Compute(usercash,2)+'')+']元</td><td class=a4>&nbsp;<input type=text name=price value="">&nbsp;<input type=button value="计算最大上市股票数量" name=Button onclick=checknum('+Compute(usercash,2)+','+minstocknum+','+minprice+','+maxprice+')></td></tr>');
	document.write ('<tr><td class=a3><u>上市股票数量</u><br>每股单价乘以您打算发行的股票数不能大于您现在的账户资金总额，发行的股票数量必需大于[<font color=red>'+Compute(minstocknum,2)+'</font>]股，您将控股[50%]</td><td class=a3>&nbsp;<input type=text name=gpnum value="">&nbsp;股&nbsp;<span id="maxnum"><font color=#FF0000>注意：</font>提交后所需的资金将被冻结</span></td></tr>');
	document.write ('<tr><td class=a4><u>初始每日交易量：</u><br>即股票每日允许的最大交易量，请不要大于上市股票数量</td><td class=a4>&nbsp;<input type=text name=inigpnum value="">&nbsp;股</td></tr>');
	document.write ('<tr><td class=a3 valign="top"><u>上市公司简介</u><br><br>请对对上市公司作简要的介绍，对您的申请的成功率会有影响<br>公司简介不能超过['+companyint+']Byte</td><td class=a3>&nbsp;<textarea cols="39" name="Explain" rows="5">这个家伙很懒，什么都没有留下！</textarea></td></tr>');
	document.write ('<input type=hidden name=MinPrice value="'+minprice+'"><input type=hidden name=MaxPrice value="'+maxprice+'">');
	document.write ('<tr><td class=a4 colspan="2" align="center"><input type="submit" name="submit" value="申请">&nbsp;&nbsp;<input type=reset name=submit value=重填></td></tr>');
	document.write ('</form>');
	document.write ('</table>');
}
function ex_each_stock_edit()
{
	document.write ('<table class=a2 width='+assignwidth+' cellspacing=1 cellpadding=3 align=center border=0>');
	document.write ('<tr><td colspan=2 align=center height=25 class=a1>-=> 编 辑 个 人 上 市 公 司 <font color=red>'+company+'</font> 资 料 <=-</td></tr>');
	document.write ('<form method=post action="?action=SaveEdit" name="form1">');
	document.write ('<tr><td class=a3><u>股票代码</u><br>必须填写股市代码方便以后查询</td><td class=a3>&nbsp;<input type=text name=gpcode value="'+stockcode+'"><input type=hidden name=gpoldcode value="'+stockcode+'"></td></tr>');
	document.write ('<tr><td class=a4 width="50%"><u>上市公司名称</u><br>即股票名，最短['+minname+']，Byte最长['+maxname+']Byte</td><td class=a4 width="50%">&nbsp;<input type=text name=gpname value="'+company+'"><input type=hidden name=gpoldname value="'+company+'">&nbsp;<input type=button value="检测股票代码和名称" name=button onclick=ExCheckData(0)></td></tr>');
	document.write ('<tr><td class=a3><u>上市股票单价</u></td><td class=a3>&nbsp;'+Formatnumber(''+Compute(stockprice,2)+'')+'<input type=hidden name=sid value="'+sid+'"></td></tr>');
	document.write ('<tr><td class=a4><u>上市股票数量</u></td><td class=a4>&nbsp;'+Compute(stocknum,0)+'<input type=hidden name=Stocknum value="'+Compute(stocknum,0)+'"> 股</td></tr>');
	document.write ('<tr><td class=a3><u>初始每日交易量：</u><br>即股票每日允许的最大交易量，请不要大于上市股票数量</td><td class=a3>&nbsp;<input type=text name=inigpnum value="'+Compute(todaytradesum,0)+'">&nbsp;股</td></tr>');
	document.write ('<tr><td class=a4 valign="top"><u>上市公司简介</u><br>请对对上市公司作简要的介绍，对您的申请的成功率会有影响<br>公司简介不能超过['+companyint+']Byte</td><td class=a4>&nbsp;<textarea cols="39" name="Explain" rows="5">'+explain+'</textarea></td></tr>');
	document.write ('<tr><td colspan="2" class=a3 align="center"><input type=submit name=submit value=提交>&nbsp;&nbsp;<input type=reset name=submit value=重填></td></tr>');
	document.write ('</form>');
	document.write ('</table>');
}
function DelUserSt(id)
{
	if(confirm("您确定要撤销（注销）吗？"))
	{
		location.href='?action=DelEachStock&Gpsid='+id;
		return true;
	}
//	return false;
}