﻿// JScript 文件

function UserActivityFoodSubmit()
        {
            if($("#hduser").val() != "")
            {
                if($("#user_comment").val().length<100 )
                {
                    var datas= "userid="+$("#hduser").val()+"&user_comment="+$("#user_comment").val()+"&commenttitle="+$("#commenttitle").val();
                    $.ajax({
                    url:"AddComment.aspx?d="+new Date(),
                    data:datas,
                    type:"post",
                    success:function(msg){
                       if(msg==1)
                       {
                            alert("您的提问已经提交！请等待管理员审核");
                            $("#user_comment").val("");
                           // window.location.href="Index.htm";
                       }
                        else
                        {
                            alert("提问提交失败！");
                        }
                     }
                     });     
                }
                else
                {
                    alert("请正确填写您的提问内容！文字100字以内!");
                }
            }
            else
            {
                alert("请先登录！");
              // window.location.href="Login.aspx";
            }
        }
        
        //UserCommentFoodSubmit
        function UserCommentFoodSubmit()
        {
            if($("#hduser").val() != "")
            {
                if($("#user_comment").val().length<100 )
                {
                    var datas= "userid="+$("#hduser").val()+"&user_comment="+$("#user_comment").val()+"&commenttitle="+$("#commenttitle").val();
                    $.ajax({
                    url:"AddCommentFood.aspx?d="+new Date(),
                    data:datas,
                    type:"post",
                    success:function(msg){
                       if(msg==1)
                       {
                            alert("您的提问已经提交！请等待管理员审核");
                            $("#user_comment").val("");
                           // window.location.href="Index.htm";
                       }
                        else
                        {
                            alert("提问提交失败！");
                        }
                     }
                     });     
                }
                else
                {
                    alert("请正确填写您的提问内容！文字100字以内!");
                }
            }
            else
            {
                alert("请先登录！");
              // window.location.href="Login.aspx";
            }
        }
        
        function UserCommentClotheSubmit()
        {
            if($("#hduser").val() != "")
            {
                if($("#user_comment").val().length<100 )
                {
                    var datas= "userid="+$("#hduser").val()+"&user_comment="+$("#user_comment").val()+"&commenttitle="+$("#commenttitle").val();
                    $.ajax({
                    url:"AddClothe.aspx?d="+new Date(),
                    data:datas,
                    type:"post",
                    success:function(msg){
                       if(msg==1)
                       {
                            alert("您的提问已经提交！请等待管理员审核");
                            $("#user_comment").val("");
                           // window.location.href="Index.htm";
                       }
                        else
                        {
                            alert("提问提交失败！");
                        }
                     }
                     });     
                }
                else
                {
                    alert("请正确填写您的提问内容！文字100字以内!");
                }
            }
            else
            {
                alert("请先登录！");
              // window.location.href="Login.aspx";
            }
        }
        
        function UserActivityClotheSubmit()
        {
            if($("#hduser").val() != "")
            {
                if($("#user_comment").val().length<100 )
                {
                    var datas= "userid="+$("#hduser").val()+"&user_comment="+$("#user_comment").val()+"&commenttitle="+$("#commenttitle").val();
                    $.ajax({
                    url:"AddCommentClothe.aspx?d="+new Date(),
                    data:datas,
                    type:"post",
                    success:function(msg){
                       if(msg==1)
                       {
                            alert("您的提问已经提交！请等待管理员审核");
                            $("#user_comment").val("");
                           // window.location.href="Index.htm";
                       }
                        else
                        {
                            alert("提问提交失败！");
                        }
                     }
                     });     
                }
                else
                {
                    alert("请正确填写您的提问内容！文字100字以内!");
                }
            }
            else
            {
                alert("请先登录！");
              // window.location.href="Login.aspx";
            }
        }
        
        function JoinGame(gametype)
        {
            var datas = "gameType="+gametype;
             $.ajax({
                    url:"UpdateView.aspx?d="+new Date(),
                    data:datas,
                    type:"post",
                    success:function(msg){
                       if(msg==1)
                       {
                            if(gametype=="Food")
                            {
                                window.location.href="ActivityFood.aspx";
                            }
                            else
                            {
                                window.location.href="ActivityClothe.aspx";
                            }
                       }
                        else
                        {
//                            alert("提问提交失败！");
                        }
                     }
                     });     
        }