﻿$(document).ready(function() {
    $("a[rel=popper]").each(function() {
        $($(this).attr("href")).hide();
    }).click(function() {
        var cover = document.createElement("div");
        var tempID = $(this).attr("href");
        $(cover)
                .css("position", "absolute")
                .css("width", "100%")
                .css("height", "100%")
                .css("background", "black")
                .css("z-index", "100")
                .css("top", 0)
                .css("left", 0)
                .css("filter", "alpha(opacity=50)")
                .css("opacity", "0.5");
        $(cover).click(function() {
            $(cover).remove();
            $(tempID).hide();
        });
        $("body").append(cover);
        $(tempID).css("position", "absolute").css("width", 600); //.css("height", 400);
        var x = ($(cover).width() / 2) - ($(tempID).width() / 2);
        var y = ($(cover).height() / 2) - ($(tempID).height() / 2);
        var width = $(tempID).width();
        var height = $(tempID).height();
        $(tempID).css("top", y + "px").css("left", x + "px").css("z-index", "101").css("width", 0).css("height", 0);
        $(tempID).css("width", width).css("height", height).fadeIn("normal");// animate({ width: width, height: height }, "slow", "swing");
        return false;
    });
});