<!--#include file="../../Include/Class_Main.asp" -->
<!-- #include file="VT_Page/VT_F_S.asp" --> 

<%User_CleanTable%>
<% 
Dim RoomId,RoomPwd
Dim RoomName,MemberNum,RoomRenName
RoomID = SafeRequest("RoomID")
RoomPWD = SafeRequest("RoomPWD")
Set RoomConn = Server.CreateObject("ADODB.Connection")
RoomConn.Open db_cnn_str
'//房间表
Set Rs = RoomConn.Execute("Select * From [RoomTable] Where RoomId="&RoomId)
RoomName = Rs("RoomName")
MemberNum = Rs("MemberNum")
RoomRenName = Rs("RoomRenName")
Rs.Close
'//企业表
Set Rs = RoomConn.Execute("Select ComId,CompanyName From [pH_Company_Base] Where Username='"&RoomRenName&"'")
CompanyName = Rs("CompanyName")
Rs.Close
RoomConn.Close
Set RoomConn = Nothing
 %>

<html>
<head>
<link href="../../Css/Css.css" rel="stylesheet" type="text/css">
<script  LANGUAGE="JavaScript">
	<!-- 
	function OpenMemberOutWin()
	{ 
	window.open ("MemberOut.asp?RoomID=<%=SafeRequest("RoomID")%>&Refresh=1", "", "height=100, width=400, toolbar =no, menubar=no, scrollbars=yes, resizable=yes, location=no, status=no") //写成一行 
	} 
	//--> 
</script>

<script language=javascript>
function GetZoomNumResult(ZoomInput,ZoomTimes,MinValue,MaxValue)
{
	var ZoomNum_1 = ZoomInput;
	var ZoomNum_2,i,k;
	ZoomNum_2 = 0;
	for (i=0;i<ZoomNum_1.length;i++)
	{
		if ( (ZoomNum_1.substr(i,1)>='0') && (ZoomNum_1.substr(i,1)<='9') )
			ZoomNum_2 = ZoomNum_2 * 10 + (ZoomNum_1.substr(i,1)-'0');
		else
			break;
	}
	k=1;
	i++;
	for (;i<ZoomNum_1.length;i++)
	{
		k *= 0.1;
		if ( (ZoomNum_1.substr(i,1)>='0') && (ZoomNum_1.substr(i,1)<='9') )
			ZoomNum_2 = ZoomNum_2 + (ZoomNum_1.substr(i,1)-'0')*k;
		else
			break;
	}
	if (ZoomNum_2 != ZoomNum_2 * ZoomTimes)
		ZoomNum_2 = ZoomNum_2 * ZoomTimes;
	else if (ZoomTimes>1)
		ZoomNum_2 = ZoomNum_2+1;
	else if (ZoomTimes<1)
		ZoomNum_2 = ZoomNum_2-1;

	if ( (ZoomNum_2<MinValue) || (ZoomNum_2>MaxValue) )
		ZoomNum_1 = "";
	else if (ZoomNum_1.substr(ZoomNum_1.length-1,1)=='%')
		ZoomNum_1 = ZoomNum_2 + "%"
	else
		ZoomNum_1 = ZoomNum_2 + "" ;

	return ZoomNum_1;
}

function ZoomInOut(TagID,ZoomTimes)
{
	var MinValue=50;
	var MaxValue=2000;
	var ZoomInput,WidthResult,HeightResult;

	ZoomInput = document.getElementById(TagID).width;
	WidthResult = GetZoomNumResult(ZoomInput,ZoomTimes,MinValue,MaxValue);

	ZoomInput = document.getElementById(TagID).height;
	HeightResult = GetZoomNumResult(ZoomInput,ZoomTimes,MinValue,MaxValue);

	if ( (WidthResult!="") && (HeightResult!="") )
	{		
		document.getElementById(TagID).width = WidthResult;
		document.getElementById(TagID).height = HeightResult;
	}
}

function GetZoomNumResult_2(ZoomInput,ZoomSpan,MinValue,MaxValue)
{
	var ZoomNum_1 = ZoomInput;
	var ZoomNum_2,i,k;
	ZoomNum_2 = 0;
	for (i=0;i<ZoomNum_1.length;i++)
	{
		if ( (ZoomNum_1.substr(i,1)>='0') && (ZoomNum_1.substr(i,1)<='9') )
			ZoomNum_2 = ZoomNum_2 * 10 + (ZoomNum_1.substr(i,1)-'0');
		else
			break;
	}
	k=1;
	i++;
	for (;i<ZoomNum_1.length;i++)
	{
		k *= 0.1;
		if ( (ZoomNum_1.substr(i,1)>='0') && (ZoomNum_1.substr(i,1)<='9') )
			ZoomNum_2 = ZoomNum_2 + (ZoomNum_1.substr(i,1)-'0')*k;
		else
			break;
	}

	ZoomNum_2 = ZoomNum_2 +ZoomSpan;

	if ( (ZoomNum_2<MinValue) || (ZoomNum_2>MaxValue) )
		ZoomNum_1 = "";
	else if (ZoomNum_1.substr(ZoomNum_1.length-1,1)=='%')
		ZoomNum_1 = ZoomNum_2 + "%"
	else
		ZoomNum_1 = ZoomNum_2 + "" ;

	return ZoomNum_1;
}

function ZoomInOut_2(TagID,ZoomWidthSpan,ZoomHieghtSpan)
{
	var MinValue=50;
	var MaxValue=2000;
	var ZoomInput,WidthResult,HeightResult;

	ZoomInput = document.getElementById(TagID).width;
	WidthResult = GetZoomNumResult_2(ZoomInput,ZoomWidthSpan,MinValue,MaxValue);

	ZoomInput = document.getElementById(TagID).height;
	HeightResult = GetZoomNumResult_2(ZoomInput,ZoomHieghtSpan,MinValue,MaxValue);

	if ( (WidthResult!="") && (HeightResult!="") )
	{		
		document.getElementById(TagID).width = WidthResult;
		document.getElementById(TagID).height = HeightResult;
	}
}

function ZoomIn(TagID)
{
	var ZoomTimes = 1.05;
	var ZoomWidthSpan = 20;
	var ZoomHeightSpan = 15;
	ZoomInOut_2(TagID,ZoomWidthSpan,ZoomHeightSpan);
}

function ZoomOut(TagID)
{
	var ZoomTimes = 0.95;
	var ZoomWidthSpan = -20;
	var ZoomHeightSpan = -15;
	ZoomInOut_2(TagID,ZoomWidthSpan,ZoomHeightSpan);
}
</script>

</head>
<title><%= Cls_WebName %> -- 视频面试房间</title>
<body >
<table width="99%" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td>&nbsp;</td>
  </tr>
</table>
<table width="99%" height="25" border="0" align="center" cellpadding="4" cellspacing="1" bgcolor="#CCCCCC">
  <tr> 
    <td bgcolor="f7f7f7"><table width="100%" border="0" cellspacing="0" cellpadding="0">
        <tr>
          <td width="50%"><%= "欢迎来到<u>"&CompanyName&"</u>开设的面试房间：<u>"&RoomName&"</u>" %></td>
          <td width="50%" align="right">系统提示：如果您还没有安装"客户端软件，请先<a href="Vt.rar" target="_blank"><u>下载并安装客户端软件</u></a></td>
        </tr>
      </table></td>
  </tr>
</table>
<table width="99%" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr> 
    <td>&nbsp;</td>
  </tr>
</table>
<table width="99%" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#CCCCCC">
  <tr>
    <td bgcolor="#FFFFFF"><table width="99%" border="0" align="center" cellpadding="0" cellspacing="0">
        <tr>
          <td>&nbsp;</td>
        </tr>
        <tr>
<td><a href="ListRoom.asp">返回房间列表</a><br>
<br> 
<%if session(VT_SysNum & "_" & "WebVT_IsNameOK")=1 then%>
<%


UserName = session(VT_SysNum & "_" & "WebVT_MemberName")

response.write "您好，" & UserName & "!"


nReturn = GetRoomInfo(int(RoomID))
if nReturn="1" then
	if Glb_RoomPWD="" OR Glb_RoomPWD=RoomPWD then
		response.write "<br>面试房间: " & Glb_RoomName & "<br>"
		nReturn = User_ApplyEnter(RoomID,UserName)
		if nReturn="1" then
%>
            <font id="VT_RoomM">&nbsp;</font><a id="VT_RoomMemberOut" href="#" onclick="OpenMemberOutWin()"></a> 
            <table>
              <tr>
                <td> <font size='2'> 
                  <form method="POST" action="talk.asp">
                    <input type="hidden" name="RoomPWD" value="<%=RoomPWD%>">
                    <input type="hidden" name="RoomID" value="<%=Glb_RoomID%>">
                    <input type="hidden" name="RoomName" value="<%=RoomName%>">
                    如果小屏幕显示“聊天请求已经过期”，则请
                    <input name="B1" type="submit" id="B1" value="重新进入房间">
                    <br>
                    <br>
                    如果小屏幕显示“请稍候”或“连接中”，则请耐心等待，直到连接结束或计时器变为0。(计时：<font id="VT_CNT_TIME" color=blue>60</font>) 
                    <script language=javascript>
var CNT_Time_Now;
CNT_Time_Now = 60;
function Change_CNT_Time()
{
	document.getElementById("VT_CNT_TIME").innerText = " " + CNT_Time_Now;
	CNT_Time_Now = CNT_Time_Now-1;
	if (CNT_Time_Now >= 0)
		setTimeout("Change_CNT_Time();",1000);
}
Change_CNT_Time();
</script>
                  </form>
                  </font> </td>
              </tr>
            </table>
            <script language=javascript>
var RoomMUpdate_xmlDoc;
RoomMUpdate_xmlDoc = new ActiveXObject("Microsoft.XMLDOM");

function RoomMUpdate()
{
	RoomMUpdate_xmlDoc.async = true;
	RoomMUpdate_xmlDoc.load("GetRoomM.asp?RoomID=<%=SafeRequest("RoomID")%>");
}

function RoomMUpdate_CheckState()
{
	if (RoomMUpdate_xmlDoc.readyState == 4)
	{
		if (RoomMUpdate_xmlDoc.parseError.errorCode==0)
		{
			document.getElementById("VT_RoomM").innerText = RoomMUpdate_xmlDoc.documentElement.childNodes[0].nodeValue;
			document.getElementById("VT_RoomMemberOut").innerText = RoomMUpdate_xmlDoc.documentElement.childNodes[1].nodeValue;
		}
		delete(RoomMUpdate_xmlDoc);
		RoomMUpdate_xmlDoc = new ActiveXObject("Microsoft.XMLDOM");
		RoomMUpdate_xmlDoc.onreadystatechange = RoomMUpdate_CheckState;
		setTimeout("RoomMUpdate();",6000);
	}
}

RoomMUpdate_xmlDoc.onreadystatechange = RoomMUpdate_CheckState;
RoomMUpdate()
</script> 
            <%

				Col = 5

				i = 0
				response.write "<table><tr>"
				while (i<Glb_MaxMemberNum)
					response.write "<td>"
					User_Screen RoomID,i,160,120+15	//(90/Col)*800/100 ,(90/Col)*600/100
%>
            <br> <a href="#" onclick="ZoomIn('Screen_n<%=i%>')">放大</a> <a href="#" onclick="ZoomOut('Screen_n<%=i%>')">缩小</a> 
            <%
					i = i + 1
					if i mod Col = 0 then
						response.write "</tr><tr>"
					end if
				wend
				response.write "</tr></table>"

		elseif nReturn="用户已在房间内" then
			response.write "您已在本房间内。" & "<br>"
%>
            <font id="VT_RoomM">&nbsp;</font><a id="VT_RoomMemberOut" href="#" onclick="OpenMemberOutWin()"></a> 
            <table>
              <tr>
                <td> <font size='2'> 
                  <form method="POST" action="talk.asp">
                    <input type="hidden" name="RoomPWD" value="<%=RoomPWD%>">
                    <input type="hidden" name="RoomID" value="<%=Glb_RoomID%>">
                    <input type="hidden" name="RoomName" value="<%=RoomName%>">
                    如果小屏幕显示“聊天请求已经过期”，则请
                    <input name="B1" type="submit" id="B1" value="重新进入房间">
                    <br>
                    <br>
                    如果小屏幕显示“请稍候”或“连接中”，则请耐心等待，直到连接结束或计时器变为0。(计时：<font id="VT_CNT_TIME" color=blue>60</font>) 
                    <script language=javascript>
var CNT_Time_Now;
CNT_Time_Now = 60;
function Change_CNT_Time()
{
	document.getElementById("VT_CNT_TIME").innerText = " " + CNT_Time_Now;
	CNT_Time_Now = CNT_Time_Now-1;
	if (CNT_Time_Now >= 0)
		setTimeout("Change_CNT_Time();",1000);
}
Change_CNT_Time();
</script>
                  </form>
                  </font> </td>
              </tr>
            </table>
            <script language=javascript>
var RoomMUpdate_xmlDoc;
RoomMUpdate_xmlDoc = new ActiveXObject("Microsoft.XMLDOM");

function RoomMUpdate()
{
	RoomMUpdate_xmlDoc.async = true;
	RoomMUpdate_xmlDoc.load("GetRoomM.asp?RoomID=<%=SafeRequest("RoomID")%>");
}

function RoomMUpdate_CheckState()
{
	if (RoomMUpdate_xmlDoc.readyState == 4)
	{
		if (RoomMUpdate_xmlDoc.parseError.errorCode==0)
		{
			document.getElementById("VT_RoomM").innerText = RoomMUpdate_xmlDoc.documentElement.childNodes[0].nodeValue;
			document.getElementById("VT_RoomMemberOut").innerText = RoomMUpdate_xmlDoc.documentElement.childNodes[1].nodeValue;
		}
		delete(RoomMUpdate_xmlDoc);
		RoomMUpdate_xmlDoc = new ActiveXObject("Microsoft.XMLDOM");
		RoomMUpdate_xmlDoc.onreadystatechange = RoomMUpdate_CheckState;
		setTimeout("RoomMUpdate();",10000);
	}
}

RoomMUpdate_xmlDoc.onreadystatechange = RoomMUpdate_CheckState;
RoomMUpdate()
</script> 
            <%

				Col =  5

				i = 0
				response.write "<table><tr>"
				while (i<Glb_MaxMemberNum)
					response.write "<td>"
					User_Screen RoomID,i,160,120+15	//(90/Col)*800/100 ,(90/Col)*600/100
%>
            <br> <a href="#" onclick="ZoomIn('Screen_n<%=i%>')">放大</a> <a href="#" onclick="ZoomOut('Screen_n<%=i%>')">缩小</a> 
            <%
					i = i + 1
					if i mod Col = 0 then
						response.write "</tr><tr>"
					end if
				wend
				response.write "</tr></table>"
		
		else
			response.write nReturn
		end if
	else
		response.write "<p align=center>" & "房间密码错误" & "</p>"
	end if	
else
	response.write "<p align=center>" & nReturn & "</p>"
end if

%>
            <%else%>
            您还没有登录，<a href="../../Register.asp">点击这里开始登录</a> 
            <%end if%>
          </td>
        </tr>
        <tr>
          <td>&nbsp;</td>
        </tr>
      </table></td>
  </tr>
</table>
<table width="99%" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td><hr size="1" color="#CCCCCC"></td>
  </tr>
  <tr>
    <td align="center"><%= Cls_WebName %> 版权所有</td>
  </tr>
</table>
</body>
</html>
