﻿$(document).ready(function () {
    ChangePrizeHeight();
});
function ChangePrizeHeight() {
    $("#divPrize").css({
        'width': document.body.clientWidth,
        'height': document.body.clientHeight
    });
    $("#divPrizeInfo").css({
        'width': document.body.clientWidth,
        'height': document.body.clientHeight
    });
    $("#tblDIV").css({
        'left': (document.body.clientWidth / 2 - 250) + "px",
        'top': (document.documentElement.scrollTop + 200) + 'px'
    });
}
function PrizeShow() {
    $("#divPrize").show();
}
function PrizeHide() {
    $("#divPrize").hide();
}
function getDate() {
    var d = new Date();
    return (d.getFullYear() + 1) + "-" + (d.getMonth() + 1) + "-" + d.getDate();
}
function Msg(message) { alert(message); }
window.onresize = ChangePrizeHeight;
window.onscroll = ChangePrizeHeight;
function SubmitPrize() {
    var ContactName = $("#txtContactName").attr("value");
    var ContactTel = $("#txtTel").attr("value");
    var ContactSex = $(':radio[name="rblSex"]:checked').val();
    var ContactQQ = $("#txtQQ").attr("value");
    var ContactMQ = $("#txtMQ").attr("value");
    var ContactAddress = $("#txtAddress").attr("value");
    var IPN = $("#hidPrizeNumber").attr("value");
    var ESC = $("#hidEsc").attr("value");
    if (ContactName == "") {
        $("#txtContactName").focus();
        Msg("请填写联系人!");
        return;
    } else { ContactName = escape(ContactName); }
    if (ContactTel == "") {
        $("#txtTel").focus();
        Msg("请填写联系电话!");
        return;
    } else { ContactTel = escape(ContactTel); }
    if (ContactSex != "") {
        ContactSex = escape(ContactSex);
    }
    if (ContactQQ != "") {
        ContactQQ = escape(ContactQQ);
    }
    if (ContactMQ != "") {
        ContactMQ = escape(ContactMQ);
    }
    if (ContactAddress != "") {
        ContactAddress = escape(ContactAddress);
    }
    if (IPN == "") {
        Msg("中奖序数为空!");
        PrizeHide();
        return;
    }
    if (ESC == "") {
        Msg("中奖序数验证失败!");
        PrizeHide();
        return;
    }
    $.ajax({
        type: "GET",
        cache: false,
        url: "/ashx/VotePrize.ashx",
        data: "IPN=" + IPN + "&ESC=" + ESC + "&ContactName=" + ContactName + "&ContactTel=" + ContactTel + "&ContactSex=" + ContactSex + "&ContactQQ=" + ContactQQ + "&ContactMQ=" + ContactMQ + "&ContactAddress=" + ContactAddress,
        dataType: "json",
        success: function (msg) {
            alert(msg.msg);
            PrizeHide();
        }
    });
}
