<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="ChatRoom.aspx.cs" Inherits="InfoPath.Chat.ChatRoom" %>
<%@ Register assembly="FredCK.FCKeditorV2" namespace="FredCK.FCKeditorV2" tagprefix="FCKeditorV2" %>

<%@ Register src="../Include/Css.ascx" tagname="Css" tagprefix="uc1" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title></title>

    <script type="text/javascript" >
    
        window.setInterval(btn_click, 5000);
        
        
        function btn_click() {

//            GetHttpResult(20, 'http://220.194.62.215/WS/ChatService.asmx/GetMSG');
           GetHttpResult(20, 'http://localhost/WS/ChatService.asmx/GetMSG');
        }

        function GetRSSResult(url)
        {
            var oRequest;
            try { 
            oRequest = new ActiveXObject("Msxml2.XMLHTTP"); 
            }
            catch (e) 
            { 
            try 
            {
             oRequest = new ActiveXObject("Microsoft.XMLHTTP"); 
            }
            catch (e) {
                try { oRequest = new XMLHttpRequest(); }
                catch (e) { oRequest = false; } 
            } 
            }
            oRequest.open("post", url, false);
            oRequest.setRequestHeader("Content-Type", "text/html;charset=utf-8");
            oRequest.send(" ");
            if (window.document.getElementById('answer')!=null)
            window.document.getElementById('answer').innerHTML = oRequest.responseXML.childNodes[1].text;
        }

        function GetHttpResult(num, url) {
            var Params = "num=" + num;
            var oRequest;
            try { 
            oRequest = new ActiveXObject("Msxml2.XMLHTTP"); 
            }
            catch (e) 
            { 
                try {
                    if (window.XMLHttpRequest) {   //   Mozilla,   Safari,   ...
                        oRequest = new XMLHttpRequest();
                    }
                    else if (window.ActiveXObject) {   //   IE
                        oRequest = new ActiveXObject("Microsoft.XMLHTTP");
                    }
                }
                catch (e) {
                    try { oRequest = new XMLHttpRequest(); }
                    catch (e) { oRequest = false; } 
                } 
            }
            oRequest.open("post", url, false);
            oRequest.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
            oRequest.setRequestHeader("Content-Length", Params.length);
            oRequest.send(Params);
            //alert(oRequest.status + "--" + oRequest.statusText + "---" + oRequest.responseXML.childNodes[1].text);
            //alert(oRequest.responseXML.childNodes[1].text);
            if (window.document.getElementById('chatmsg') != null)
                window.document.getElementById('chatmsg').innerHTML = oRequest.responseXML.childNodes[1].text;

        }
       
       function jb() {
           var A = null;
           try {
               A = new ActiveXObject("Msxml2.XMLHTTP")
           } catch (e) {
               try {
                   A = new ActiveXObject("Microsoft.XMLHTTP")
               } catch (oc) {
                   A = null
               }
           }
           if (!A && typeof XMLHttpRequest != "undefined") {
               A = new XMLHttpRequest()
           }
           return A
       } 
       
        function addURLParam(URL, paramName, paramValue) {

            URL += URL.indexOf("?") == -1 ? "?" : "&";
            URL += encodeURIComponent(paramName) + "=" + encodeURIComponent(paramValue);
            return URL;
        }

        function GetSoapResult(city,url) {
            //xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
            //xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
            //xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
            //var xmlObj = new ActiveXObject("Msxml2.DOMDocument");
            var sXml = "<?xml version=\"1.0\" encoding=\"utf-8\"?>";
            sXml += "<soap:Envelope "
            sXml += "xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" ";
            sXml += "xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" ";
            sXml += "xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">";
            sXml += "<soap:Body>";
            sXml += "<GetTemp xmlns=\"http://tempuri.org/\">";
            sXml = sXml + "<City>" + city.toString() + "</City>";
            sXml += "</GetTemp></soap:Body></soap:Envelope>"
            //xmlObj.loadXML(sXml);
            alert(sXml);

            var oRequest;
            try {
                oRequest = new ActiveXObject("Msxml2.XMLHTTP");
            }
            catch (e) {
                try {
                    oRequest = new ActiveXObject("Microsoft.XMLHTTP");
                }
                catch (e) {
                    try { oRequest = new XMLHttpRequest(); }
                    catch (e) { oRequest = false; }
                }
            }
            oRequest.Open("POST", url, false);
            oRequest.setRequestHeader("Content-Type", "text/xml;charset=utf-8");
            oRequest.setRequestHeader("Content-Length", sXml.length);
            oRequest.setRequestHeader("SOAPAction", "http://tempuri.org/GetTemp");
            oRequest.send(sXml);
            if (window.document.getElementById('answer') != null)
                window.document.getElementById('answer').innerHTML = oRequest.responseText;

            //alert(xmlHTTP.responseXML.childNodes[1].text);
            //alert(xmlResponse.selectSingleNode("soap:Envelope/soap:Body/GetTempResponse/GetTempResult").text);

        }
    </script>
</head>
<body><uc1:Css ID="Css1" runat="server" /> 
    <form id="form1" runat="server">
        <TABLE width="100%">
  <TR  class="WsdnOrgTitle1">
	<TD>
	<asp:Label ID="Label2" runat="server" Text="讨论组"></asp:Label>&nbsp;&nbsp; 
	<asp:Label ID="Label1" runat="server" Text="推荐使用IE浏览器。"></asp:Label>
        </TD>
  </TR>  
  <TR  class="WsdnOrgInfo1">
	<TD>
	    <FCKeditorV2:FCKeditor Height=150  ID="msg" runat="server" BasePath="~/fckeditor/">
    </FCKeditorV2:FCKeditor>
    </TD>
  </TR>
    <TR  class="WsdnOrgInfo1">
	<TD>	
	<asp:Button class="buttons" ID="Button1" runat="server" Text="发  言"  onclick="Button1_Click" />
	<asp:CheckBox
        ID="DeptPublic" runat="server" Text="本部门公开" />
	<asp:CheckBox
        ID="BranchPublic" runat="server" Text="全公司公开" />
    </TD>
  </TR>
    <TR  class="WsdnOrgInfo" >
	<TD height=380 valign=top align=left >
	<div  id="chatmsg"></div></TD>
  </TR>


  </TABLE>

       </form>
</body>
</html>
