<!-- #include file=../../inc/BBSsetup.asp -->
<!-- #include file=../../inc/Board_popfun.asp -->
<!--#include file="cook_conn.asp"-->
<script language="JavaScript">
function checkform()
{
if(document.cookmain.username.value == ""){
 alert("请输入接受人名称！");
 return false ;
 }
}
</script>

<%
DEF_BBS_HomeUrl = "../../"
dim menu,stats
dim headvar
headvar="&nbsp>>&nbsp<a href=cook_index.asp><font class=NavColor>厨房</font></a>"
'menu=request.querystring("menu")
'orders=request.querystring("orders")

'if orders="" then orders=2'默认显示答题数排行top 10

stats="厨房首页"

	BBS_SiteHead DEF_SiteNameString&" "&DEF_BBS_Name,GBL_board_ID,headvar &" &nbsp>>&nbsp"& stats
dim plrs,iiii,cookstate,slttime,starttime,stime,sdate,nowsecond,stasecond
dim lefttime,useckrs,menurs,xxxstate,fridgers
dim sellever
cookstate=0
xxxstate=0
'tinder
dim membername,founderr,SQL,Rs,tinder_errmsg
'dim iif
membername=GBL_CHK_User'tinder
if membername="" then
	founderr=true
end if

'stats="雪石厨房"
'call nav()
'call head_var(2,0,"","")
call subckmain()
cookconn.close
Set cookconn = Nothing
'call footer()

'sub部分
sub subckmain()
OpenDatabase
if founderr then
	tinder_errmsg=tinder_errmsg+"<br>"+"<li>您没有进入厨房的权限，请先登陆或者同管理员联系。"
	call tinder_error()
	exit sub
end if
	set useckrs=server.createobject("adodb.recordset")
	sql="Select * from usercook where username='"&membername&"'"
	useckrs.open sql,cookconn,1,3
	
	if not useckrs.bof and not useckrs.eof then
		cookstate=useckrs("state")
		slttime=useckrs("selecttime")
		starttime=useckrs("starttime")
	      
	      if not isnumeric(cookstate) or not isnumeric(useckrs("pl1")) or not isnumeric(useckrs("pl2")) then'未开始
		cookstate=0'未开始
		useckrs("state")=0
		useckrs.update
	      end if
	      	     
if cookstate=0 then'未开始
		if Trim(Request.QueryString("action"))="cookstart" then
		   con.execute "update [leadbbs_user] set points=points-"&request("price1")&"-"&request("price2")&" where username='"&membername&"'"
		   useckrs("state")=1
'出现pl1、pl2字段为空有可能是用户以无参数方式提交请求造成数据库数据不完整。
'下面凡是request(key)都改成iif(request(key)="",default,request(key))
'by Kenton on 2003/8/2
			if request("pl1")="" then
				useckrs("pl1")=1
			else   
	   			useckrs("pl1")=request("pl1")
			end if
		   'useckrs("pl1")=iif(request("pl1")="",1,request("pl1"))
			if request("pl2")="" then
				useckrs("pl2")=1
			else
		   		useckrs("pl2")=request("pl2")
			end if
	   	   'useckrs("pl2")=iif(request("pl2")="",1,request("pl2"))
			if request("needtime")="" then
				useckrs("selecttime")=5
			else
	   	   		useckrs("selecttime")=request("needtime")
		   	end if
		   'useckrs("selecttime")=iif(request("needtime")="",5,request("needtime"))
		   if request("needfire")="" then
		    	useckrs("selectfire")="小"
			else
	   	   		useckrs("selectfire")=request("needfire")
		   end if
		   'useckrs("selectfire")=iif(request("needfire")="","小",request("needfire"))
	   	   		useckrs("starttime")=now
	   	   		useckrs("dotimes")=useckrs("dotimes")+1
	   	   if useckrs("dotimes")<80 then
	   	     	 useckrs("lever")=1
	   	   elseif useckrs("dotimes")>=80 and useckrs("dotimes")<360 then
	   	      	useckrs("lever")=2
	   	   elseif useckrs("dotimes")>=360 and useckrs("dotimes")<36000 then
	   	      	useckrs("lever")=3
	   	   end if
	   	   if cint(request("sellever"))>cint(useckrs("lever")) then 
	   	      sellever=useckrs("lever")
	   	   else
		   		if request("sellever")="" then
					sellever=1
				else
	   	      		sellever=request("sellever")
			  	end if
			  'sellever=iif(request("sellever")="",1,request("sellever"))
	   	   end if
	   	   useckrs("sellever")=sellever
	   	   useckrs.update
	   	  if request("needtime")="" then
		  slttime=5
		  else
	   	   slttime=request("needtime")
		   end if
		   'slttime=iif(request("needtime")="",5,request("needtime"))
		   starttime=now
		   cookstate=1'正在烧

	end if
end if
'************************************************************	
      if cookstate=1 then'正在烧
		sdate=left(starttime,10)
		stime=right(starttime,8)
		nowsecond=hour(now)*3600+minute(now)*60+second(now)
		stasecond=hour(stime)*3600+minute(stime)*60+second(stime)
		if sdate=left(NOW,10) then
	  	  if nowsecond-stasecond > slttime*60 or nowsecond-stasecond<0 then
		  	cookstate=2'烧完
		  	useckrs("state")=2
		  	xxxstate=1
		  else
		  	lefttime=slttime*60-(nowsecond-stasecond)
		  end if
		elseif left(NOW,10)<sdate then
		  cookstate=2'烧完
		  useckrs("state")=2
		  xxxstate=1
	  	else'left(NOW,10)>sdate
	  	  if hour(now)=0 and hour(stime)=23 then
	  	  	if 24*3600+minute(now)*60+second(now)-stasecond>slttime*60 then
	  	  	   cookstate=2'烧完
	  	  	   useckrs("state")=2
	  	  	   xxxstate=1
	  	  	else
	  	  	   lefttime=slttime*60-(24*3600+minute(now)*60+second(now)-stasecond)
	  	  	end if
	  	  else
	  	  	cookstate=2'烧完
	  	  	useckrs("state")=2
	  	  	xxxstate=1
	  	  end if
		end if
	      end if
	      if cookstate=2 then'烧完xx
	       if xxxstate=1 then'更新烧完
	   	set menurs=server.createobject("adodb.recordset")
	   	sql="Select * from menu where (pl1="&useckrs("pl1")&" and pl2="&useckrs("pl2")&") or (pl1="&useckrs("pl2")&" and pl2="&useckrs("pl1")&")"
	   	menurs.open sql,cookconn,1,1
	   	
	   	if menurs.recordcount<1 then
	      	   useckrs("dishid")=0
	      	   useckrs("dish")="奇怪的小菜"
	      	   useckrs("addwealth")=2
	      	   useckrs("addep")=-2
	      	   useckrs("addcp")=-1
	      	else
	      	  '判断火候时间对否
	      	  if cint(useckrs("selecttime"))<>cint(menurs("needtime")) or useckrs("selectfire")<>menurs("needfire") then
	      	    useckrs("dishid")=0
	      	    useckrs("dish")="奇怪的小菜"
	      	    useckrs("addwealth")=2
	      	    useckrs("addep")=-2
	      	    useckrs("addcp")=-1
	      	  else
	      	   useckrs("dishid")=menurs("id")
	      	   
	      	   select case useckrs("sellever")
	      	      case 1
	      	   	useckrs("dish")=menurs("lever1")
	      	   	useckrs("addwealth")=menurs("wealth1")
	      	   	useckrs("addep")=menurs("ep1")
	      	   	useckrs("addcp")=menurs("cp1")
	      	   	useckrs("dishpic")=menurs("pic1")
	      	      case 2
	      	   	if trim(menurs("lever2"))="" or isnull(menurs("lever2")) then
	      	      		useckrs("dish")=menurs("lever1")
	      	      		useckrs("addwealth")=menurs("wealth1")
	      	      		useckrs("addep")=menurs("ep1")
	      	      		useckrs("addcp")=menurs("cp1")
	      	      		useckrs("dishpic")=menurs("pic1")
	      	        else
	      	      		useckrs("dish")=menurs("lever2")
	      	      		useckrs("addwealth")=menurs("wealth2")
	      	      		useckrs("addep")=menurs("ep2")
	      	      		useckrs("addcp")=menurs("cp2")
	      	      		useckrs("dishpic")=menurs("pic2")
	      	      	end if
	      	      case 3
	      	   	if trim(menurs("lever3"))="" or isnull(menurs("lever3")) then
	      	      	   if trim(menurs("lever2"))="" or isnull(menurs("lever2")) then
	      	      	   	useckrs("dish")=menurs("lever1")
	      	      	   	useckrs("addwealth")=menurs("wealth1")
	      	      	   	useckrs("addep")=menurs("ep1")
	      	      	   	useckrs("addcp")=menurs("cp1")
	      	      	   	useckrs("dishpic")=menurs("pic1")
	      	      	   else
	      	      	   	useckrs("dish")=menurs("lever2")
	      	      	   	useckrs("addwealth")=menurs("wealth2")
	      	      	   	useckrs("addep")=menurs("ep2")
	      	      	   	useckrs("addcp")=menurs("cp2")
	      	      	   	useckrs("dishpic")=menurs("pic2")
	      	      	   end if
	      	        else
	      	           useckrs("dish")=menurs("lever3")
	      	      	   useckrs("addwealth")=menurs("wealth3")
	      	      	   useckrs("addep")=menurs("ep3")
	      	      	   useckrs("addcp")=menurs("cp3")
	      	      	   useckrs("dishpic")=menurs("pic3")
	      	        end if
	      	      case else
	      	   	
		   end select
	      	   
		  end if'判断火候时间对否
	      	end if
	   	useckrs.update
	   	menurs.close
	   	set menurs=nothing
	       end if'更新烧完
	       
	       if Trim(Request.QueryString("action"))="sending" then'送
	          set rs=server.createobject("adodb.recordset")
	          sql="select * from [leadbbs_user] where username='"&request("username")&"'"
	          rs.open sql,con,1,1
	          if rs.recordcount<1 then
	             %><script language="vbscript">
			msgbox"无此用户“<%=request("username")%>”，请检查！",0,"雪石"
			history.back
			</script><%
			rs.close
			set rs=nothing
			exit sub
	          end if
	          rs.close
		  set rs=nothing
		  if len(request("Content"))>50 then
		     %><script language="vbscript">
			msgbox"赠言超过50个了，请减短！",0,"雪石"
			history.back
			</script><%
			exit sub
		  end if
		  cookstate=0'未烧
	  	  useckrs("state")=0
	  	  useckrs.update
		  cookconn.execute "insert into fridge(username,dish,addwealth,addep,addcp,dishpic,type,senduser,sendword,adddate) values('"&request("username")&"','"&useckrs("dish")&"',"&useckrs("addwealth")&","&useckrs("addep")&","&useckrs("addcp")&",'"&useckrs("dishpic")&"',1,'"&membername&"','"&request("Content")&"',now)"
		  
		  dim msgsender,msgtitle,msgbody
		  msgsender=membername
		  msgtitle=DEF_BBS_Name&"送菜服务。"
		  msgbody="“"&request("username")&"”你好，“"&membername&"”送了一道亲手做的菜给你，"&chr(10)&"已经放在你的冰箱！"
	sql="insert into LeadBBS_InfoBox(FromUser,ToUser,title,content,sendtime,ReadFlag) values('"&request("username")&"','"&msgsender&"','"&msgtitle&"','"&msgbody&"',Now(),0)"
	
		 con.Execute sql
		' Con.Execute("Update LeadBBS_User Set MessageFlag=1 where username=" & msgsender)
	  	  %><script language="vbscript">
		  msgbox"菜已经送出！",0,"雪石"
		  </script><%
	       end if
	       
	       if request("action")="dele" then'扔了
	          cookstate=0'未烧
	  	  useckrs("state")=0
	  	  useckrs.update
	  	  %><script language="vbscript">
		  msgbox"小菜已经扔了！",0,"雪石"
		  </script><%
	       end if
	       
	       if request("action")="eat" then'吃了
	       	  con.execute "update [leadbbs_user] set onlinetime=onlinetime+"&useckrs("addep")*60&",charmpoint=charmpoint+"&useckrs("addcp")&" where username='"&membername&"'"
	          cookstate=0'未烧
	  	  useckrs("state")=0
	  	  useckrs.update
	  	  %><script language="vbscript">
		  msgbox"小菜已经吃了，增加经验<%=useckrs("addep")%>点，魅力<%=useckrs("addcp")%>点！",0,"雪石"
		  </script><%
	       end if
	       
	       if request("action")="sell" then'卖了
	       	  con.execute "update [leadbbs_user] set points=points+"&useckrs("addwealth")&" where username='"&membername&"'"
	          cookstate=0'未烧
	  	  useckrs("state")=0
	  	  useckrs.update
	  	  %><script language="vbscript">
		  msgbox"小菜已经卖了，增加财产<%=useckrs("addwealth")%>元！",0,"雪石"
		  </script><%
	       end if
	       
	       if request("action")="save" then'放冰箱
	       	  cookstate=0'未烧
	  	  useckrs("state")=0
	  	  useckrs.update
	  	  cookconn.execute "insert into fridge(username,dish,addwealth,addep,addcp,dishpic,type,senduser,sendword,adddate) values('"&membername&"','"&useckrs("dish")&"',"&useckrs("addwealth")&","&useckrs("addep")&","&useckrs("addcp")&",'"&useckrs("dishpic")&"',0,'','',now)"
	  	  %><script language="vbscript">
		  msgbox"小菜已经放入冰箱！",0,"雪石"
		  </script><%
	       end if
	       
	      end if'烧完xx
	else
	      useckrs.addnew
	      useckrs("username")=membername
	      useckrs("state")=0
	      useckrs("pl1")=1
	      useckrs("pl2")=1
	      useckrs("selecttime")=5
	      useckrs("selectfire")="小"
	      useckrs("starttime")=now
	      useckrs("dotimes")=0
	      useckrs("lever")=1
	      useckrs("sellever")=1
	      useckrs.update
	end if
	
	useckrs.close
	set useckrs=nothing

	'response.write lefttime
	
	if cookstate=1 then
%>
<script language="JavaScript">
	var time=<%=lefttime%>;
	function myint(f)
	{
		if(f<1)return '00';
		var x=parseInt(f);
		if(x<10)x='0'+x;
		return x;
	}
	function fmttime(time)
	{
		var hour=myint(time/3600);
		var minute=myint((time%3600)/60);
		var second=myint(time%60);
		return hour+":"+minute+":"+second;
		return x;
	}
	function mytimer()
	{
		var tmp;
		time--;
		if(time<-4)
		{
			window.location.replace("cook_index.asp?action=finish");
			return;
		}
		tmp=time;
		if(tmp<0)
		{
			if(tmp==-1)tmp="...快好了";
			else if(tmp==-2)tmp="..快好了";
			else if(tmp==-3)tmp=".快好了";
			else tmp="做好了";
		}
		else tmp=fmttime(tmp);
		document.cookmain.lefttime.value=tmp;
		setTimeout('mytimer()',1000);
	}
	setTimeout('mytimer()',500);
</script>
<%
	end if
%>

<table align=center cellSpacing="1" cellPadding="3" class=TBone width="<%=DEF_BBS_ScreenWidth%>">
 <form name="cookmain" method="POST" action=cook_index.asp?action=<%if cookstate=0 then%>cookstart<%end if%><%if request("action")="send" then%>sending<%end if%>> 
    <tr class=tbhead2> <th height="25" align="center">雪石厨房</th>
      </tr><tr class=tbbg1>
      <td align="center" valign="top" class=tablebody2>
	<table align=center cellSpacing="0" cellPadding="0" class=TBone width=100%>
	  <tr class=tbbg1>
	  <td width=25% valign="top">
	  <table align=center cellSpacing="1" cellPadding="0" class=TBone width=100% background="kitchen/img/cookgb.jpg">
	     <%
	     if cookstate=1 then
	     	%><tr class=tbbg1><td height="25" align="center" colspan="2" Class=TableTitle2><b>选择配料</b></td></tr><%
	        call pllist1()
	     elseif cookstate=2 then
	        %><tr class=tbbg1><td height="25" align="center" colspan="2" Class=TableTitle2><b>选择配料</b></td></tr><%
	        call pllist1()
	     else
	     	%><tr class=tbbg1><td height="25" align="center" colspan="2" Class=TableTitle2><b>选择配料</b></td></tr><%
	     	call pllist()
	     end if
	     %>
	     <tr class=tbbg1>
  		<td height="25" align="center" valign="center" colspan="2" Class=TableTitle2><b>已有菜谱</b></td>
	     </tr><%
	     call pulist()
	     %>
	  </table>
	  </td>
	  <td valign="top">
	  <table align=center cellSpacing="1" cellPadding="0" width=100% background="kitchen/img/cookbg.jpg">
	     <%
	     if cookstate=1 then
	     	%><tr><td height="25" align="center" colspan="2" Class=TableTitle2><b>还在烧呢，要等等才知道做出来什么呢</b></td></tr><%
	        call cooker1()
	     elseif cookstate=2 then
	     	%><tr><td height="25" align="center" Class=TableTitle2 colspan="2"><b>终于做好了，看起来好诱人啊，想自己品尝还是。。。</b></td></tr><%
	        call cooker2()
	     else
	     	%><tr><td height="25" align="center" Class=TableTitle2><b>来烧一顿可口的饭菜慰劳自己一下吧</b></td></tr><%
	     	call cooker()
	     end if
	     %>
	  </table>
	  <td width=25% valign="top">
	  <table align=center cellSpacing="1" cellPadding="0" class=TBone width=100% background="kitchen/img/cookgb.jpg">
	     
	     <%
	     if cookstate=1 then
	     	%><tr class=tbbg1><td height="25" align="center" colspan="3" Class=TableTitle2><b>烹饪方法</b></td></tr><%
	        call cookway1()
	     elseif cookstate=2 then
	        %><tr class=tbbg1><td height="25" align="center" colspan="3" Class=TableTitle2><b>烹饪方法</b></td></tr><%
	        call cookway1()
	     else
	     	%><tr class=tbbg1><td height="25" align="center" colspan="3" Class=TableTitle2><b>烹饪方法</b></td></tr><%
	     	call cookway()
	     end if
	     %>
	     <tr class=tbbg1>
	        <td height="25" align="center" valign="center" Class=TableTitle2><b>我的信息</b></td>
  		<td height="25" align="center" valign="center" colspan="2" Class=TableTitle2><b>我的冰箱</b></td>
	     </tr>
	     <tr class=tbbg1>
	        <td height="25" align="left" valign="center" Class=tableBody2><%
	        	call mycookinf()
	        %><% if CheckSupervisorUserName = 1 then %><br><a href="cook_admin_kitchen.asp?id=0&type=pllist">配料管理</a><br><a href="cook_admin_kitchen.asp?id=0&type=mnlist">菜谱管理</a><% End If %>
</td>
  		<td height="25" align="center" valign="center" colspan="2" Class=tableBody2>
  		<a href="#" onclick="window.open('cook_fridge.asp','boarderwin','left=150, top=60, width=300,height=370,status=0,menubar=0');">
  		<img src="Kitchen/img/fridge.gif" border=0></a></td>
	     </tr>
	  </table>
	  </td>
	  </tr>
	</table>
      </td>
      </tr>
</form></table>

<%
closeDatabase
end sub

sub pllist()'当cookstate=0

set plrs=server.createobject("adodb.recordset")
sql="Select * from pldata order by id"
plrs.open sql,cookconn,1,1
%>
<tr class=tbbg1>
<td height="25" align="center" valign="center" Class=tableBody2>配料1</td>
<td height="25" align="center" valign="center" Class=tableBody2>
<script language="JavaScript">
function selectchange1(selindex)
{
selectvalue=selindex;
j=selectvalue.indexOf("|");
document.cookmain.pl1.value=selectvalue.substr(0,j);
selectvalue = selectvalue.substr(j+1,selectvalue.length-j+1);
j=selectvalue.indexOf("|");
document.images['pl1pic'].src=selectvalue.substr(0,j);
document.cookmain.price1.value=selectvalue.substr(j+1,selectvalue.length-j+1);
}
</script>

<select size="1" name="pl1sel" onChange="selectchange1(options[selectedIndex].value)"><%
iiii=0
plrs.movefirst

do while not plrs.eof
  if iiii<1 then %>
    <option selected value="<%=plrs("id")%>|<%if trim(plrs("pic"))="" or isnull(plrs("pic")) then%>kitchen/img/p000000.gif<%else %><%=plrs("pic")%><%end if%>|<%=plrs("price")%>"><%=plrs("plname")%></option><%
  else
    %>
    <option value="<%=plrs("id")%>|<%if trim(plrs("pic"))="" or isnull(plrs("pic")) then%>kitchen/img/p000000.gif<%else %><%=plrs("pic")%><%end if%>|<%=plrs("price")%>"><%=plrs("plname")%></option><%
  end if
  iiii=iiii+1
  plrs.movenext
loop
  %>
</td>
</tr>
<tr class=tbbg1>
<td height="25" align="center" valign="center" Class=tableBody1>
<%
plrs.movefirst
if trim(plrs("pic"))="" or isnull(plrs("pic")) then%>
<img id=pl1pic src="Kitchen/img/p000000.gif" height="32" width="32"><%else %>
<img id=pl1pic src="<%=plrs("pic")%>" height="32" width="32"><%end if%></td>
<td height="25" align="center" valign="center" Class=tableBody1>
<input type="hidden" name="pl1" size="5" value="<%=plrs("id")%>">
<input type="text" name="price1" size="15" value="<%=plrs("price")%>" readonly>元</td>
</tr>

<tr class=tbbg1>
<td height="25" align="center" valign="center" Class=tableBody2>配料2</td>
<td height="25" align="center" valign="center" Class=tableBody2>
<script language="JavaScript">
function selectchange2(selindex)
{
selectvalue=selindex;
j=selectvalue.indexOf("|");
document.cookmain.pl2.value=selectvalue.substr(0,j);
selectvalue = selectvalue.substr(j+1,selectvalue.length-j+1);
j=selectvalue.indexOf("|");
document.images['pl2pic'].src=selectvalue.substr(0,j);
document.cookmain.price2.value=selectvalue.substr(j+1,selectvalue.length-j+1);
}
</script>

<select size="1" name="pl2sel" onChange="selectchange2(options[selectedIndex].value)"><%
iiii=0
plrs.movefirst

do while not plrs.eof
  if iiii<1 then %>
    <option selected value="<%=plrs("id")%>|<%if trim(plrs("pic"))="" or isnull(plrs("pic")) then%>kitchen/img/p000000.gif<%else %><%=plrs("pic")%><%end if%>|<%=plrs("price")%>"><%=plrs("plname")%></option><%
  else
    %>
    <option value="<%=plrs("id")%>|<%if trim(plrs("pic"))="" or isnull(plrs("pic")) then%>kitchen/img/p000000.gif<%else %><%=plrs("pic")%><%end if%>|<%=plrs("price")%>"><%=plrs("plname")%></option><%
  end if
  iiii=iiii+1
  plrs.movenext
loop
  %>
</td>
</tr>
<tr class=tbbg1>
<td height="25" align="center" valign="center" Class=tableBody1>
<%
plrs.movefirst
if trim(plrs("pic"))="" or isnull(plrs("pic")) then%>
<img id=pl2pic src="Kitchen/img/p000000.gif" height="32" width="32"><%else %>
<img id=pl2pic src="<%=plrs("pic")%>" height="32" width="32"><%end if%></td>
<td height="25" align="center" valign="center" Class=tableBody1>
<input type="hidden" name="pl2" size="5" value="<%=plrs("id")%>">
<input type="text" name="price2" size="15" value="<%=plrs("price")%>" readonly>元</td>
</tr>
<%
plrs.close
set plrs=nothing

set useckrs=cookconn.execute("Select lever from usercook where username='"&membername&"'")
%>
<tr class=tbbg1>
  <td height="25" align="center" valign="center" Class=tableBody2 colspan="2">
  <input type="radio" name="sellever" value=1 checked>一级&nbsp;
  <input type="radio" name="sellever" value=2 <%if useckrs("lever")<2 then%>disabled<%end if%>>二级&nbsp;
  <input type="radio" name="sellever" value=3 <%if useckrs("lever")<3 then%>disabled<%end if%>>三级
  </td>
</tr><%
end sub


sub pllist1()'当cookstate=1

set useckrs=server.createobject("adodb.recordset")
sql="Select * from usercook where username='"&membername&"'"
useckrs.open sql,cookconn,1,1

set plrs=cookconn.execute("Select * from pldata where id="&useckrs("pl1"))
%>
<tr class=tbbg1>
<td height="25" align="center" valign="center" Class=tableBody2>配料1</td>
<td height="25" align="center" valign="center" Class=tableBody2><%=plrs("plname")%></td>
</tr>
<tr class=tbbg1>
<td height="25" align="center" valign="center" Class=tableBody1>
<%
if trim(plrs("pic"))="" or isnull(plrs("pic")) then%>
<img src="Kitchen/img/p000000.gif" height="32" width="32"><%else %>
<img src="<%=plrs("pic")%>" height="32" width="32"><%end if%></td>
<td height="25" align="center" valign="center" Class=tableBody1>
<input type="hidden" name="pl1" size="5" value="<%=useckrs("pl1")%>">
<input type="hidden" name="price1" size="15" value="<%=plrs("price")%>">
<%=plrs("price")%>元</td>
</tr><%
set plrs=cookconn.execute("Select * from pldata where id="&useckrs("pl2"))
%><tr class=tbbg1>
<td height="25" align="center" valign="center" Class=tableBody2>配料2</td>
<td height="25" align="center" valign="center" Class=tableBody2><%=plrs("plname")%></td>
</tr>
<tr class=tbbg1>
<td height="25" align="center" valign="center" Class=tableBody1>
<%
if trim(plrs("pic"))="" or isnull(plrs("pic")) then%>
<img id=pl2pic src="Kitchen/img/p000000.gif" height="32" width="32"><%else %>
<img id=pl2pic src="<%=plrs("pic")%>" height="32" width="32"><%end if%></td>
<td height="25" align="center" valign="center" Class=tableBody1>
<input type="hidden" name="pl2" size="5" value="<%=useckrs("pl2")%>">
<input type="hidden" name="price2" size="15" value="<%=plrs("price")%>">
<%=plrs("price")%>元</td>
</tr>
<tr class=tbbg1>
  <td height="25" align="center" valign="center" Class=tableBody2 colspan="2">
  	<input type="radio" name="sellever" value=1 <%if useckrs("sellever")=1 then%>checked<%end if%> disabled>一级&nbsp;
  	<input type="radio" name="sellever" value=2 <%if useckrs("sellever")=2 then%>checked<%end if%> disabled>二级&nbsp;
  	<input type="radio" name="sellever" value=3 <%if useckrs("sellever")=3 then%>checked<%end if%> disabled>三级
  </td>
</tr>
<%
set plrs=nothing
useckrs.close
set useckrs=nothing
end sub

sub cookway()'当cookstate=0
%>
<tr class=tbbg1>
  <td height="25" align="center" valign="center" colspan="3" Class=tableBody2>烹饪火候</td>
</tr>
<tr class=tbbg1>
  <td height="25" align="center" valign="center" Class=tableBody1>
  	<input type="radio" name="needfire" value="小" checked>小
  </td>
  <td height="25" align="center" valign="center" Class=tableBody1>
	<input type="radio" name="needfire" value="中">中
  </td>
  <td height="25" align="center" valign="center" Class=tableBody1>
	<input type="radio" name="needfire" value="大">大
  </td>
</tr>
<tr class=tbbg1>
  <td height="25" align="center" valign="center" colspan="3" Class=tableBody2>烹饪时间</td>
</tr>
<tr class=tbbg1>
  <td height="25" align="center" valign="center" Class=tableBody1>
  	<input type="radio" name="needtime" value="5" checked>5分钟
  </td>
  <td height="25" align="center" valign="center" Class=tableBody1>
	<input type="radio" name="needtime" value="10">10分钟
  </td>
  <td height="25" align="center" valign="center" Class=tableBody1>
	<input type="radio" name="needtime" value="15">15分钟
  </td>
</tr>
<%
end sub

sub cookway1()'当cookstate=1
set useckrs=server.createobject("adodb.recordset")
sql="Select * from usercook where username='"&membername&"'"
useckrs.open sql,cookconn,1,1
%>
<tr class=tbbg1>
  <td height="25" align="center" valign="center" colspan="3" Class=tableBody2>烹饪火候</td>
</tr>
<tr class=tbbg1>
  <td height="25" align="center" valign="center" Class=tableBody1>
  	<input type="radio" name="needfire" value="小" <%if useckrs("selectfire")="小" then%>checked<%end if%> disabled>小
  </td>
  <td height="25" align="center" valign="center" Class=tableBody1>
	<input type="radio" name="needfire" value="中" <%if useckrs("selectfire")="中" then%>checked<%end if%> disabled>中
  </td>
  <td height="25" align="center" valign="center" Class=tableBody1>
	<input type="radio" name="needfire" value="大" <%if useckrs("selectfire")="大" then%>checked<%end if%> disabled>大
  </td>
</tr>
<tr class=tbbg1>
  <td height="25" align="center" valign="center" colspan="3" Class=tableBody2>烹饪时间</td>
</tr>
<tr class=tbbg1>
  <td height="25" align="center" valign="center" Class=tableBody1>
  	<input type="radio" name="needtime" value="5" <%if useckrs("selecttime")=5 then%>checked<%end if%> disabled>5分钟
  </td>
  <td height="25" align="center" valign="center" Class=tableBody1>
	<input type="radio" name="needtime" value="10" <%if useckrs("selecttime")=10 then%>checked<%end if%> disabled>10分钟
  </td>
  <td height="25" align="center" valign="center" Class=tableBody1>
	<input type="radio" name="needtime" value="15" <%if useckrs("selecttime")=15 then%>checked<%end if%> disabled>15分钟
  </td>
</tr>

<%
end sub

sub cooker()'当cookstate=0
%>
<tr>
<td height="25" align="center" valign="top"></td>
</tr>
<tr>
<td height="280" align="center" valign="center">
<input type="submit" name="Submit" value="开 始">
</td>
</tr>
<%
end sub

sub cooker1()'当cookstate=1
%>
<tr >
  <td height="50" align="center" valign="center" colspan="2">
  	<input type="text" name="lefttime" size="8" value="" disabled>
  </td>
</tr>
<tr >
  <td height="50" width=29 align="center" valign="bottom">
  	
  </td>
  <td height="50" align="left" valign="bottom">
  	<img src="Kitchen/img/smoke.gif">
  </td>
</tr>
<tr >
  <td height="39" width=29 align="center" valign="bottom">
  	
  </td>
  <td height="39" align="left" valign="bottom">
  	<img src="Kitchen/img/firexx.gif">
  </td>
</tr>
<tr >
  <td height="150" align="center" valign="bottom" colspan="2">
  	
  </td>
  
</tr>
<%
end sub

sub cooker2()'当cookstate=2

set useckrs=server.createobject("adodb.recordset")
sql="Select * from usercook where username='"&membername&"'"
useckrs.open sql,cookconn,1,1
if request("action")="send" then	
	%>
  <tr >
  <td height="150" align="center" valign="bottom">
  	<%=useckrs("dish")%><br>
  	<%if trim(useckrs("dishpic"))="" or isnull(useckrs("dishpic")) then%>
	<img src="Kitchen/img/d000000.gif" height="86" width="86"><%else %>
	<img src="<%=useckrs("dishpic")%>" height="86" width="86"><%end if%>
	<br>
  </td>
  </tr>
  <tr >
  <td height="80" align="center" valign="top">
  	<font color="#000000">送给：</font><input type="text" name="username" size="25" value=""><br>
   	<font color="#000000">赠言：</font><br>
   	<textarea cols=34 name=Content rows=6 title="填入您想留给对方赠言"></textarea><br>
   	<input type="submit" name="Submit1" value="确定">&nbsp;&nbsp;
   	<input type="button" name="cancel" size="3" value="取消" onclick='document.location.replace("cook_index.asp");'>
   </td>
   </tr>
   <%
else
%>
<tr >
  <td height="170" align="center" valign="bottom">
  	<%if trim(useckrs("dishpic"))="" or isnull(useckrs("dishpic")) then%>
	<img src="Kitchen/img/d000000.gif" height="86" width="86"><%else %>
	<img src="<%=useckrs("dishpic")%>" height="86" width="86"><%end if%>
  </td>
</tr>
<tr >
  <td height="25" align="center" valign="top"><%=useckrs("dish")%>
  </td>
</tr>
<tr >
  <td height="100" align="center" valign="center">
  	<input title="将劳动成果吃下去，好开心！" type="button" name="eat" size="3" value="吃了" onclick='document.location.replace("cook_index.asp?action=eat");'>&nbsp;
  	<input title="卖给社区餐厅，换两个钱！" type="button" name="sell" size="3" value="卖掉" onclick='document.location.replace("cook_index.asp?action=sell");'>&nbsp;
  	<input title="送给朋友，联络联络感情！" type="button" name="send" size="3" value="送人" onclick='document.location.replace("cook_index.asp?action=send");'>&nbsp;
  	<input title="放冰箱了，我有收藏癖！" type="button" name="save" size="3" value="放冰箱" onclick='document.location.replace("cook_index.asp?action=save");'>&nbsp;
  	<input title="不值钱的东东，扔了！" type="button" name="dele" size="3" value="扔了" onclick='document.location.replace("cook_index.asp?action=dele");'>
  </td>
</tr>
<%
end if
useckrs.close
set useckrs=nothing

end sub

sub pulist()
	set rs=server.createobject("adodb.recordset")
	sql="SELECT menu.lever1,pldata.plName,pldata_1.plName,menu.needtime,menu.needfire,menu.pic1 FROM (menu INNER JOIN pldata ON menu.pl1 = pldata.ID) INNER JOIN pldata AS pldata_1 ON menu.pl2 = pldata_1.ID"
	rs.open sql,cookconn,1,1
%>
<tr class=tbbg1>
  		<td height="25" align="center" valign="center" colspan="2" Class=tableBody1>
  		<script language="JavaScript">
function selectpu(selindex)
{
selectvalue=selindex;
j=selectvalue.indexOf("|");
document.cookmain.pup.value=selectvalue.substr(0,j);
selectvalue = selectvalue.substr(j+1,selectvalue.length-j+1);
document.images['pupic'].src=selectvalue;
}
</script>

<select size="1" name="pusel" onChange="selectpu(options[selectedIndex].value)">
<option selected value="配料及做法|kitchen/img/d000000.gif">选择一级菜名</option><%
do while not rs.eof
  %>
    <option value="<%=rs(1)%>+<%=rs(2)%>，<%=rs(3)%>，<%=rs(4)%>|<%if trim(rs(5))="" or isnull(rs(5)) then%>kitchen/img/d000000.gif<%else %><%=rs(5)%><%end if%>"><%=rs(0)%></option><%
  rs.movenext
loop
  %>
  </td>
  </tr>
  <tr class=tbbg1>
  <td height="25" align="center" valign="center" colspan="2" Class=tableBody2>
  <input type="text" name="pup" size="20" value="配料及做法" disabled><br>
  <img id="pupic" src="kitchen/img/d000000.gif" height="86" width="86">
</td>
	     </tr><%
end sub

sub mycookinf()
%>
<table>

<%
set useckrs=cookconn.execute("Select * from usercook where username='"&membername&"'")
response.write "<tr class=tbbg1><td height='25' align='left' valign='center' Class=tableBody1>做菜次数：<br>"
response.write "<font color='#CC6600'>"&useckrs("dotimes")&"</font></td></tr>"

response.write "<tr class=tbbg1><td height='25' align='left' valign='center' Class=tableBody2>做菜级别：<br>"
response.write "<font color='#CC6600'>"&useckrs("lever")&"级</font></td></tr>"

response.write "<tr class=tbbg1><td height='25' align='left' valign='center' Class=tableBody1>号称：<br>"
response.write "<font color='#CC6600'>"
if useckrs("lever")=1 then
	response.write "见习厨师"
elseif useckrs("lever")=2 then
	response.write "大厨师"
elseif useckrs("lever")=3 then
	response.write "特级厨师"
end if
response.write "</font></td></tr>"

response.write "<tr class=tbbg1><td height='25' align='left' valign='center' Class=tableBody2>晋级所需：<br>"
response.write "<font color='#CC6600'>"
if useckrs("lever")=1 then
	response.write 80 - useckrs("dotimes")&"次"
elseif useckrs("lever")=2 then
	response.write 360 - useckrs("dotimes")&"次"
elseif useckrs("lever")=3 then
	response.write "经验已满！"
end if
response.write "</font></td></tr>"
set useckrs=nothing
%>
</table>
<%
end sub
%>