<%@ Page Title="" Language="C#"  AutoEventWireup="true" CodeBehind="Room.aspx.cs" Inherits="Book.Wap.Room2" %>

<!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 id="Head1" runat="server">
    <title></title>
   <script src="../Javascript/jquery142.js" type="text/javascript"></script>
   <script src="../Book/date.js" type="text/javascript"></script>
  
 
<script>

     


    function contains(string, substr, isIgnoreCase) {
        if (isIgnoreCase) {
            string = string.toLowerCase();
            substr = substr.toLowerCase();
        }
        var startChar = substr.substring(0, 1);
        var strLen = substr.length;
        for (var j = 0; j < string.length - strLen + 1; j++) {
            if (string.charAt(j) == startChar)//如果匹配起始字符,开始查找
            {
                if (string.substring(j, j + strLen) == substr)//如果从j开始的字符与str匹配，那ok
                {
                    return true;
                }
            }
        }
        return false;
    }


    function setbook(o) {

        old = $("#part11").html();
       
        $("#currentroomname").html(o["currentroomname"]);


        if (o["begintime"] == 0) {

            //空闲中
            var f = o["flash"];
            if (f == "") {
            //给会议室一个默认值
                f = "book.swf";
            }
           
            $("#part11").show();
         
            $("#part12").hide();


            if (old == "") {
                $("#part11").html("<SPAN><OBJECT classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000'     width=730px height=450px ><param name='wmode' value='transparent' /><param name=movie value='" + f + "' /> </OBJECT></SPAN>");
                
            }
            else {

                if (!contains(old, o["flash"], true)) {
                    $("#part11").html("<SPAN><OBJECT classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000'     width=730px height=450px ><param name='wmode' value='transparent' /><param name=movie value='" + f + "' /> </OBJECT></SPAN>");
                     
                }
               
            }
         

            document.body.style.backgroundImage = "url(images/free.png)";
            document.getElementById("status").src = "images/roomfree.png";
        }
        else {

        //使用中
            $("#part11").hide();
            $("#part12").show();
            

             $("#subject").html(o["intro"]);
             $("#begintime").html(o["begintime"] + '-' + o["endtime"]);
             $("#dept").html(o["contactdept"]);
             document.body.style.backgroundImage = "url(images/busy.png)";
             document.getElementById("status").src = "images/roombusy.png";
        }

    }


    function GetBook() {
        
        GetCurrentBook();
        GetBookList();
        setTimeout("GetBook()", 30000);
    }


    $(document).ready(function () {
        GetBook();
    });




    
</script> 
 
  
</head>
<body >

      
  <div id="currentroomname" style=" position:absolute; font-family:微软雅黑; font-size:30px;
       text-align:center;   width:220px;
       left:150px;top:140px">
       
       </div>
    
       
   
 <div id="bgclock"
 
 style=" position:absolute; font-family:微软雅黑; font-size:30px;
       text-align:center;   width:220px;
       left:630px;top:140px"
 ></div>
   


   
    <form id="form1" runat="server">   
     
  
      <div style=" margin-top:275px; margin-left:20px;">
       <table >
       <tr valign="top">
       <td width="800px"  >
       <!-- FREE -->
         <div id="part11" style=" margin-top:-40px; z-index:-100"> 
          </div>
       <!-- /FREE -->
           
         <!-- Busy -->
          <div id="part12">
           <div id="subject" style=" position:absolute; font-weight:bold;  font-size:28px; color:#1C5781;    left:300px; top:310px;">人事部会议</div>
          <div id="begintime" style=" position:absolute; font-weight:bold;  font-size:28px; color:#1C5781;    left:300px; top:460px;">19:00</div>
              <div id="dept" style=" position:absolute; font-weight:bold;  font-size:28px; color:#1C5781;    left:300px; top:620px;">20:00</div>
          </div>
        <!-- /Busy -->
  
 
       </td>
       <td width="200px">
      
      <div id="partl11" style=" margin-top:260px;" >
     <img src="images/none.png" id="status" />

     </div>
      
       </td>
       </tr>
</table> 
     </div>
       
 
 
<div  style=" position:absolute;left:10px; top:690px;   height:35px; font-family:微软雅黑; width:700px">
	
   
  <div id="booklist" style=" margin-top:5px;   color:#ffffff; font-weight:bold; width:700px"></div>
  
	</div>	
 
 
     
    
     
     
     
      
     
     
      


 
    </form>
    
    
     
    
   
</body>




<script>

    function GetCurrentBook() {
   
        $.getJSON(
    "GetAjaxCurrentBook.aspx",
    { "roomid":<%=Request["roomid"] %>, random: Math.random() },

    function(d) {
        $.each(d, function(index, item) {
            setbook(item);
            return;
        });
    }
    ) 
    };
    
    
    
    function GetBookList() {
     
        $.getJSON(
    "GetAjaxBookList.aspx",
    { "roomid":<%=Request["roomid"] %>, random: Math.random() },
    function(data) {
      

         var html = '<marquee scrollamount=10 scrolldelay=200>';

        try
        {

                $.each(data, function(i, entry) {
                   html += entry['begintime'] +' - '+entry['endtime']+"&nbsp;&nbsp;"+entry['intro']+"&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;";         
                   
                });
        }
        catch(e)
        {
 
        }

        html += '</marquee>';




        $("#booklist").html(html);


    });


}
    
    </script>
    
    
    
      
<script>    clock();</script>


 

</html>