﻿//媒体内容
var popupStatus = 0;
function CenterPopup() {
    var windowWidth = document.documentElement.clientWidth;
    var windowHeight = document.documentElement.clientHeight;
    var popuHeight = $("#MediaContentFloat").height();
    var popuWidth = $("#MediaContentFloat").width();
    $("#MediaContentFloat").css({
        "position": "absolute",
        "top": windowHeight / 2 - popuHeight / 2,
        "left": windowWidth / 2 - popuWidth / 2
    });
    //针对IE6.0进行设置
    $("#backGroundPopup").css({
        "height": windowHeight
    });
}
function LoadPopup() {
    if (popupStatus == 0) {
        $("#backGroundPopup").css({
            "opacity": "0.6"
        });
        $("#MediaContentFloat").fadeIn("slow");
        $("#backGroundPopup").fadeIn("slow");
        popupStatus = 1;
    }
}

function disablePopup() {
    if (popupStatus == 1) {
        $("#MediaContentFloat").fadeOut("slow")
        $("#backGroundPopup").fadeOut("slow")
        popupStatus = 0;
    }
}
$(document).ready(function() {
    $("#showMediaConetent").click(function() {
        CenterPopup();
        LoadPopup();
    });
    $("#closeImg").click(function() {
        disablePopup();
    });
    $("#MediaContentFloatSubmit").click(function() {
        disablePopup();
    });
    $("#backGroundPopup").click(function() {
        disablePopup();
    });
    $(document).keypress(function(e) {
        if (e.keyCode == 27 && popupStatus == 1) {
            disablePopup();
        }
    });
});
//媒体列表
var popupStatus1 = 0;
function CenterPopup1() {
    var windowWidth = document.documentElement.clientWidth;
    var windowHeight = document.documentElement.clientHeight;
    var popuHeight = $("#MediaContentFloat1").height();
    var popuWidth = $("#MediaContentFloat1").width();
    $("#MediaContentFloat1").css({
        "position": "absolute",
        "top": windowHeight / 2 - popuHeight / 2,
        "left": windowWidth / 2 - popuWidth / 2
    });
    //针对IE6.0进行设置
    $("#backGroundPopup").css({
        "height": windowHeight
    });
}
function LoadPopup1() {
    if (popupStatus1 == 0) {
        $("#backGroundPopup").css({
            "opacity": "0.6"
        });
        $("#MediaContentFloat1").fadeIn("slow");
        $("#backGroundPopup").fadeIn("slow");
        popupStatus1 = 1;
    }
}

function disablePopup1() {
    if (popupStatus1 == 1) {
        $("#MediaContentFloat1").fadeOut("slow")
        $("#backGroundPopup").fadeOut("slow")
        popupStatus1 = 0;
    }
}
$(document).ready(function() {
    $("#radioMediaName").click(function() {
        CenterPopup1();
        LoadPopup1();
    });
    $("#MediaContentFloat1Submit").click(function() {
        disablePopup1();
    });
    $("#closeImg1").click(function() {
        disablePopup1();
    });
    $("#backGroundPopup").click(function() {
        disablePopup1();
    });
    $(document).keypress(function(e) {
        if (e.keyCode == 27 && popupStatus == 1) {
            disablePopup1();
        }
    });
});

//媒体描述
var popupStatus2 = 0;
function CenterPopup2() {
    var windowWidth = document.documentElement.clientWidth;
    var windowHeight = document.documentElement.clientHeight;
    var popuHeight = $("#MediaContentFloat2").height();
    var popuWidth = $("#MediaContentFloat2").width();
    $("#MediaContentFloat2").css({
        "position": "absolute",
        "top": windowHeight / 2 - popuHeight / 2,
        "left": windowWidth / 2 - popuWidth / 2
    });
    //针对IE6.0进行设置
    $("#backGroundPopup").css({
        "height": windowHeight
    });
}
function LoadPopup2() {
    if (popupStatus2 == 0) {
        $("#backGroundPopup").css({
            "opacity": "0.6"
        });
        $("#MediaContentFloat2").fadeIn("slow");
        $("#backGroundPopup").fadeIn("slow");
        popupStatus2 = 1;
    }
}

function disablePopup2() {
    if (popupStatus2 == 1) {
        $("#MediaContentFloat2").fadeOut("slow")
        $("#backGroundPopup").fadeOut("slow")
        popupStatus2 = 0;
    }
}
$(document).ready(function() {
    $("#radioMediaName1").click(function() {
        CenterPopup2();
        LoadPopup2();
    });
    $("#closeImg2").click(function() {
        disablePopup2();
    });
    $("#MediaContentFloat2Submit").click(function() {
        disablePopup2();
    });
    $("#backGroundPopup").click(function() {
        disablePopup2();
    });
    $(document).keypress(function(e) {
        if (e.keyCode == 27 && popupStatus2 == 1) {
            disablePopup2();
        }
    });
});

