<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="index.aspx.cs" Inherits="JuSNS.Web.home.poke.index" %>
<%@ Import Namespace="System.Collections" %>
<%@ Import Namespace="System.Collections.Generic" %>

<!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>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title id="ptitle" runat="server">打招呼</title>
<script language="javascript" type="text/javascript" src="../../js/ajax.js"></script>
<script language="javascript" type="text/javascript" src="../../js/public.js"></script>
<script type="text/javascript" src="../../js/build/yahoo/yahoo-min.js"></script>
<script type="text/javascript" src="../../js/build/dom/dom-min.js"></script>
<script type="text/javascript" src="../../js/build/event/event-min.js"></script>
<script type="text/javascript" src="../../js/build/autocomplete/autocomplete-min.js"></script>
<link href="../../template/<% Response.Write(JuSNS.Config.UiConfig.SkinStyle); %>/css/base.css"   id="skinpath" type="text/css" rel="stylesheet" />

</head>
<body  id="yahoo-com" class="yui-skin-sam">
   <!--头部-->
   <%=this.GetHtmlShort()%> 
    <div id="divhead">
        <%=this.GetHtmlHead()%>
    </div>
    <div id="divbody">
        <div id="body_first">
            <div class="body_menu">
                <%=this.GetHtmlLeft()%>
            </div>
        </div>
        <div id="body_sec">
           
                <div id="body_mid">
                    <div class="body_frame">
                        <!--主题内容中-->
                        <div class="body_frame_otherinfo">
                            <div class="title">
                                <div class="l">
                                    <img src="../../template/<%Response.Write(JuSNS.Config.UiConfig.SkinStyle); %>/images/site/poke.gif" align="absmiddle" />
                                    <span class="bold shenlan font14 ocolor">打招呼</span>
                                </div>
                                <div class="r">
                                    <a href="javascript:history.back();">返回上一级</a>                                   
                                </div>
                                <div class="c">
                                </div>
                            </div>
                            <div class="nav-menu">
                                <ul>
                                    <li class="current" id="npoke" runat="server"><a href="../poke">打招呼</a></li>
                                    <li id="mpoke" runat="server"><a href="../poke?r=my">给我打的招呼</a></li>
                                </ul>
                            </div>
                        </div>
                        
                        
                        
                        <div class="body_sec_all">
                                <div id="defaultDiv" runat="server">
                                    <form id="form1" runat="server"> 
                                    <div class="content bold">1.请选择动作</div>
                                    <div class="content border-eee nl">
                                        <div class="poke">
                                            <asp:Repeater ID="pokestyle" runat="server">
                                                <HeaderTemplate>
                                                    <ul>
                                                </HeaderTemplate>
                                                <ItemTemplate>
                                                    <li>
                                                        <label for="pokeact_<%# DataBinder.Eval(Container.DataItem, "Number") %>">
                                                            <input type="radio" value="<%# DataBinder.Eval(Container.DataItem, "Number") %>" id="pokeact_<%# DataBinder.Eval(Container.DataItem, "Number") %>" name="action" />
                                                            <img align="absmiddle" alt="<%# DataBinder.Eval(Container.DataItem, "more") %>" src="../../template/<%# JuSNS.Config.UiConfig.SkinStyle%>/images/poke/pokeact_<%# DataBinder.Eval(Container.DataItem, "Number") %>.gif" />
                                                            <%# DataBinder.Eval(Container.DataItem, "Text") %></label>
                                                    </li>
                                                </ItemTemplate>
                                                <FooterTemplate>
                                                    </ul>
                                                </FooterTemplate>
                                            </asp:Repeater>                                            
                                        </div>
                                    </div>
                                    <div class="spline"></div>
                                    <div class="content bold">
                                        或者自定义动作：
                                    </div>
                                    <div class="content  border-eee" style="padding:10px;">
                                      <input type="radio" value="-1" name="action" id="pokeact_diy_input" />
                                      <img align="baseline" alt="打招呼" src="../../template/<% Response.Write(JuSNS.Config.UiConfig.SkinStyle); %>/images/poke/pokeact_1.gif"/>&nbsp;
                                      <input type="text" class="f-text s20" maxlength="50" id="pokefrom"/>
                                      &nbsp;她(他)&nbsp;
                                      <input type="text" class="f-text s20" maxlength="50" id="poketo"/>
                                    </div>
                                    <div class="spline"></div>
                                    <div class="content bold">发送给哪些好友</div>
                                    <div class="content">
                                        <span id="span_Receiver" runat="server"></span>
                                        <input id="giftUserID" style="width:300px;" class="f-text" runat="server"  value="您可以在此输入好友姓名..."  onclick="javascript:{if(value=='您可以在此输入好友姓名...'){value=''}}" maxlength="20" title="按BackSpace键(退格键)显示所有好友列表，支持模糊搜索！" />
                                        <input id="Hid_UserID" name="Hid_UserID"  type="hidden" runat="server"></input>
                                        <div id="statescontainer"></div>
                                    </div>
                                    
                                    <div class="spline"></div>
                                    <div class="spline"></div>
                                    <div class="spline"></div>
                                    <div class="content">
                                        <input type="checkbox" id="isPub" value="1" /> 偷偷地 <span class="tshow">（将不会出现在好友的动态中）</span>
                                    </div>
                                    
                                    <div class="content"><input type="button" onclick="sendpoke();" name="sendbutton" id="sendbutton" value="发送动作" class="f-button" /> <span style="display:none;" id="gift_slod" class="showSumbitflow">正在发送，请稍候……</span></div>
                                                                   
                                    <div class="spline"></div>
                                     </form>
                                 </div>
                                
                                 <div id="myPokeDiv" class="content nl s100"  runat="server" visible="false">
                                    <div  class="recordnumber nl" runat="server" id="nopoke1"> 没有动作表情<span class="pipe"> | </span><a href="../poke">给好友发动作表情</a></div>                                    
                                    <asp:Repeater ID="MyPokeList" runat="server">
                                        <HeaderTemplate>
                                         <div class="content nl s100">
                                        </HeaderTemplate>
                                        <ItemTemplate>
                                                <%# DataBinder.Eval(Container.DataItem, "d") %>
                                        </ItemTemplate>
                                        <FooterTemplate>
                                            </div> 
                                        </FooterTemplate>
                                    </asp:Repeater>                                    
                                     
                                     <div class="pagination" runat="server" id="DivPage"></div>
                                </div>
                        </div>
                        </div>
                        <!--底部-->
                        <div class="divbottom">
                            <%=this.GetHtmlFoot()%>
                        </div>                          
                        
                        </div>
                       
        </div>
</div>
</body>
</html>

<script type="text/javascript">
   
    function sendpoke(obj)
   {
        document.getElementById("sendbutton").disabled=true;
        document.getElementById("gift_slod").style.display="";
        if(document.getElementById("Hid_UserID")!=null)
        {
            var hidid=document.getElementById("Hid_UserID").value;
        }
        var ptype=getValue("action");   
        var pokefrom =document.getElementById("pokefrom").value;
        var poketo =document.getElementById("poketo").value;
        var isPub="1";
        if(document.getElementById("isPub").checked)
        {
            isPub="0";
        }
    	var  options={  
				   method:'get',  
				   parameters:"&a=save&rID="+hidid+"&ptype="+ptype+"&pokefrom="+escape(pokefrom)+"&poketo="+escape(poketo)+"&isPub="+isPub,
				   onComplete:function(transport)
					{  
						var returnvalue=transport.responseText;
						if (returnvalue.indexOf("??")>-1)
						{
                                document.getElementById("gift_slod").innerHTML = "Error!";
                                document.getElementById("sendbutton").disabled=false;
                         }
						else
						{
						    if(returnvalue=="succ")
						    { 
							    document.getElementById("gift_slod").innerHTML="<span class=\"green\">动作已发送成功！他(她)下次登录可以收到！</span>";
							 }
							 else
							 {
							    document.getElementById("gift_slod").innerHTML=returnvalue;
							 }
                            document.getElementById("sendbutton").disabled=false;
						}
					}  
			   }; 
	    new  Ajax.Request('index.aspx?no-cache='+Math.random(),options);    
   } 
<%
    JuSNS.Home.Friend friend = new JuSNS.Home.Friend();
    Dictionary<int, string> dct = friend.GetFriends(UserID,"");
    string s_List = "";
    foreach (KeyValuePair<int, string> kvp in dct)
    {
        s_List += "\"" + kvp.Value + "<span style='display:none;'>" + kvp.Key.ToString() + "</span>\",";
    }
    s_List = s_List.TrimEnd(',');
%>
YAHOO.example.statesArray = [<% Response.Write(s_List); %>];

YAHOO.example.ACJSArray = new function() {
    this.oACDS = new YAHOO.widget.DS_JSArray(YAHOO.example.statesArray);

    this.oAutoComp = new YAHOO.widget.AutoComplete('giftUserID','statescontainer', this.oACDS);
    //this.oAutoComp.prehighlightClassName = "yui-ac-prehighlight";
    this.oAutoComp.typeAhead = true;
    this.oAutoComp.useShadow = true;
    this.oAutoComp.minQueryLength = 0;
};
</script>