﻿ $(document).ready(function() {        
            $("#vote").html("正在加载信息,请等待！");
            $("#btnSendEmail").click(function() {
                var getEmailText = $("input[name=textfield]").val();
                var getEmailHtml = $("#msg").html();
                if (isEmail(getEmailText)) {
                    $.ajax({
                        type: "POST",
                        url: "Notice/SNEmail.ashx",
                        data: { vEmail: getEmailText },
                        beforeSend: function() { $("#msg").html("正在处理中。。。。。。。"); },
                        success: function(data) {
                            if ($.trim(data) != "False") {
                                $("#msg").html(getEmailHtml);
                                $("input[name=textfield]").val("");
                                alert("恭喜您订阅成功！");
                            }
                            else {
                                $("#msg").html(getEmailHtml);
                                alert("您订阅失败，请重新尝试！");
                            }
                        }
                    });
                }
            });

            $.ajax({  //请求Eamil
                type: "POST",
                url: "Notice/getVoteData.ashx",
                beforeSend: function() { $(".wwwvote").html("正在加载信息,请等待！"); },
                success: function(data) {
                    if ($.trim(data) != "False")
                        $(".wwwvote").html(data);
                }
            });
            $.ajax({  //请求网站公告信息
                type: "POST",
                url: "Notice/getSiteNoticeData.ashx",
                beforeSend: function() { $(".wwwnotes").html("正在加载信息,请等待！"); },
                success: function(data) {
                    if ($.trim(data) != "False")
                        $(".wwwnotes").html(data);
                }
            });

            $.ajax({  //请求网站新闻列表
                type: "POST",
                url: "Notice/getNewsData.ashx",
                beforeSend: function() { $(".wwwnews").html("正在加载信息,请等待！"); },
                success: function(data) {
                    if ($.trim(data) != "False")
                        $(".wwwnews").html(data);
                }
            });


            $("#VoteSave").click(function() {
                var getVoteRadio = document.getElementsByName("netVote");
                var getVoteLength = getVoteRadio.length;
                for (var i = 0; i < getVoteLength; i++) {
                    if (getVoteRadio[i].checked == true) {
                        var getVoteText = getVoteRadio[i].id;
                        $.ajax({
                            type: "POST",
                            url: "Notice/SNAddVote.aspx",
                            data: { vote: getVoteText },
                            success: function(data) {
                                if ($.trim(data) != "False") {
                                    alert("谢谢你的参与！");
                                    $("input[name=netVote]").each(function() { $(this).attr("checked", false) });
                                }
                                else {
                                    alert("谢谢你的参与，出现问题请重新提交！");
                                }
                            }
                        });
                    }
                }
            });
            
            $("#snfoot").html("<img src='gif/loading.gif' alt='正在加载有效数据' />正在加载数据.....");
            $.ajax({
                url: "Foot.htm",
                cache: false,
                success: function(html) {
                    $("#snfoot").html(html);
                }
            });
            
            jQuery('#holder').show();
            jQuery('#test').simple_slider({
                'leftID': 'leftNav',
                'rightID': 'rightNav',
                'display': 1
            })

        });
