/// <reference path="../js/jquery-1.10.2.min.js" />

var img = $("#img");
var fuImg = $("#fuImg");
fuImg.change(function () {
    var file = this.files[0];
    if (file.type.indexOf("image") == -1) {
        alert("请选择图片文件！");
        return;
    }
    if (file.size > 1024 * 1024 * 3) {
        alert("图片过大，请选择小于3M的图片");
        return;
    }
    var reader = new FileReader();
    reader.readAsDataURL(file);
    reader.onload = function (fl) {
        var ImgCoding = reader.result;
        $.ajax({
            type: "Post",
            url: "./Admin_GameAdd.aspx/SaveImg",
            data: "{ImgCoding:'" + ImgCoding + "'}",
            contentType: "application/json; charset=utf-8",
            dataType: "json",
            timeout: '5000',
            success: function (data) {
                if (data.d != "") {
                    img.attr("src", data.d);
                } else {
                    alert("图片保存失败！");
                }
            },
            error: function (err) {
                alert("图片上传出错！")
            }
        });
    }
})



var imgSelf = $("#imgSelf");
var imgUpload = $("#imgUpload");
imgUpload.change(function () {
    var file = this.files[0];
    if (file.type.indexOf("image") == -1) {
        alert("请选择图片文件！");
        return;
    }
    if (file.size > 1024 * 1024 * 3) {
        alert("图片过大，请选择小于3M的图片");
        return;
    }
    var reader = new FileReader();
    reader.readAsDataURL(file);
    reader.onload = function (fl) {
        var ImgCodings = reader.result;
        $.ajax({
            type: "Post",
            url: "./Admin_GameAdd.aspx/SaveImgs",
            data: "{ImgCodings:'" + ImgCodings + "'}",
            contentType: "application/json; charset=utf-8",
            dataType: "json",
            timeout: '5000',
            success: function (data) {
                if (data.d != "") {
                    imgSelf.attr("src", data.d);
                } else {
                    alert("图片保存失败！");
                }
            },
            error: function (err) {
                alert("图片上传出错！")
            }
        });
    }
})


var imgSelfs = $("#imgSelfs");
var imgUploads = $("#imgUploads");
imgUploads.change(function () {
    var file = this.files[0];
    if (file.type.indexOf("image") == -1) {
        alert("请选择图片文件！");
        return;
    }
    if (file.size > 1024 * 1024 * 3) {
        alert("图片过大，请选择小于3M的图片");
        return;
    }
    var reader = new FileReader();
    reader.readAsDataURL(file);
    reader.onload = function (fl) {
        var ImgCodingn = reader.result;
        $.ajax({
            type: "Post",
            url: "./Admin_GameAdd.aspx/SaveImgn",
            data: "{ImgCodingn:'" + ImgCodingn + "'}",
            contentType: "application/json; charset=utf-8",
            dataType: "json",
            timeout: '5000',
            success: function (data) {
                if (data.d != "") {
                    imgSelfs.attr("src", data.d);
                } else {
                    alert("图片保存失败！");
                }
            },
            error: function (err) {
                alert("图片上传出错！")
            }
        });
    }
})



var imgSelfn = $("#imgSelfn");
var imgUploan = $("#imgUploan");
imgUploan.change(function () {
    var file = this.files[0];
    if (file.type.indexOf("image") == -1) {
        alert("请选择图片文件！");
        return;
    }
    if (file.size > 1024 * 1024 * 3) {
        alert("图片过大，请选择小于3M的图片");
        return;
    }
    var reader = new FileReader();
    reader.readAsDataURL(file);
    reader.onload = function (fl) {
        var ImgCodingp = reader.result;
        $.ajax({
            type: "Post",
            url: "./Admin_GameAdd.aspx/SaveImgp",
            data: "{ImgCodingp:'" + ImgCodingp + "'}",
            contentType: "application/json; charset=utf-8",
            dataType: "json",
            timeout: '5000',
            success: function (data) {
                if (data.d != "") {
                    imgSelfn.attr("src", data.d);
                } else {
                    alert("图片保存失败！");
                }
            },
            error: function (err) {
                alert("图片上传出错！")
            }
        });
    }
})


var imgSelfj = $("#imgSelfj");
var imgUploaj = $("#imgUploaj");
imgUploaj.change(function () {
    var file = this.files[0];
    if (file.type.indexOf("image") == -1) {
        alert("请选择图片文件！");
        return;
    }
    if (file.size > 1024 * 1024 * 3) {
        alert("图片过大，请选择小于3M的图片");
        return;
    }
    var reader = new FileReader();
    reader.readAsDataURL(file);
    reader.onload = function (fl) {
        var ImgCodingj = reader.result;
        $.ajax({
            type: "Post",
            url: "./Admin_GameAdd.aspx/SaveImgj",
            data: "{ImgCodingj:'" + ImgCodingj + "'}",
            contentType: "application/json; charset=utf-8",
            dataType: "json",
            timeout: '5000',
            success: function (data) {
                if (data.d != "") {
                    imgSelfj.attr("src", data.d);
                } else {
                    alert("图片保存失败！");
                }
            },
            error: function (err) {
                alert("图片上传出错！")
            }
        });
    }
})



var imgSelfz = $("#imgSelfz");
var imgUploaz = $("#imgUploaz");
imgUploaz.change(function () {
    var file = this.files[0];
    if (file.type.indexOf("image") == -1) {
        alert("请选择图片文件！");
        return;
    }
    if (file.size > 1024 * 1024 * 3) {
        alert("图片过大，请选择小于3M的图片");
        return;
    }
    var reader = new FileReader();
    reader.readAsDataURL(file);
    reader.onload = function (fl) {
        var ImgCodingz = reader.result;
        $.ajax({
            type: "Post",
            url: "./Admin_GameAdd.aspx/SaveImgz",
            data: "{ImgCodingz:'" + ImgCodingz + "'}",
            contentType: "application/json; charset=utf-8",
            dataType: "json",
            timeout: '5000',
            success: function (data) {
                if (data.d != "") {
                    imgSelfz.attr("src", data.d);
                } else {
                    alert("图片保存失败！");
                }
            },
            error: function (err) {
                alert("图片上传出错！")
            }
        });
    }
})



var Rotionimg = $("#Rotionimg");
var Rotionfu = $("#Rotionfu");
Rotionfu.change(function () {
    var file = this.files[0];
    if (file.type.indexOf("image") == -1) {
        alert("请选择图片文件！");
        return;
    }
    if (file.size > 1024 * 1024 * 3) {
        alert("图片过大，请选择小于3M的图片");
        return;
    }
    var reader = new FileReader();
    reader.readAsDataURL(file);
    reader.onload = function (fl) {
        var ImgCodingm = reader.result;
        $.ajax({
            type: "Post",
            url: "./Admin_GameAdd.aspx/SaveImgm",
            data: "{ImgCodingm:'" + ImgCodingm + "'}",
            contentType: "application/json; charset=utf-8",
            dataType: "json",
            timeout: '5000',
            success: function (data) {
                if (data.d != "") {
                    Rotionimg.attr("src", data.d);
                } else {
                    alert("图片保存失败！");
                }
            },
            error: function (err) {
                alert("图片上传出错！")
            }
        });
    }
})



var imgs = $("#imgs");
var Upload = $("#Upload");
Upload.change(function () {
    var file = this.files[0];
    if (file.type.indexOf("image") == -1) {
        alert("请选择图片文件！");
        return;
    }
    if (file.size > 1024 * 1024 * 3) {
        alert("图片过大，请选择小于3M的图片");
        return;
    }
    var reader = new FileReader();
    reader.readAsDataURL(file);
    reader.onload = function (fl) {
        var ImgCodingb = reader.result;
        $.ajax({
            type: "Post",
            url: "./Admin_GameAdd.aspx/SaveImgb",
            data: "{ImgCodingb:'" + ImgCodingb + "'}",
            contentType: "application/json; charset=utf-8",
            dataType: "json",
            timeout: '5000',
            success: function (data) {
                if (data.d != "") {
                    imgs.attr("src", data.d);
                } else {
                    alert("图片保存失败！");
                }
            },
            error: function (err) {
                alert("图片上传出错！")
            }
        });
    }
})


var imgd = $("#imgd");
var Uploads = $("#Uploads");
Uploads.change(function () {
    var file = this.files[0];
    if (file.type.indexOf("image") == -1) {
        alert("请选择图片文件！");
        return;
    }
    if (file.size > 1024 * 1024 * 3) {
        alert("图片过大，请选择小于3M的图片");
        return;
    }
    var reader = new FileReader();
    reader.readAsDataURL(file);
    reader.onload = function (fl) {
        var ImgCodingc = reader.result;
        $.ajax({
            type: "Post",
            url: "./Admin_GameAdd.aspx/SaveImgc",
            data: "{ImgCodingc:'" + ImgCodingc + "'}",
            contentType: "application/json; charset=utf-8",
            dataType: "json",
            timeout: '5000',
            success: function (data) {
                if (data.d != "") {
                    imgd.attr("src", data.d);
                } else {
                    alert("图片保存失败！");
                }
            },
            error: function (err) {
                alert("图片上传出错！")
            }
        });
    }
})