var AdQUA = {
    __postCloseFrameAction__: null,
    layerFrame: null,
    disabledZone: null,


    // ÆäÀÌÁö ·¹ÀÌ¾î ³»ºÎÀÇ ÇÁ·¹ÀÓ ¹ÝÈ¯
    getLayerFrame: function () {
        if (AdQUA.layerFrame == null) {
            AdQUA.layerFrame = $("<iframe frameborder='0' ALLOWTRANSPARENCY='true' scrolling=no />").appendTo("body").attr({
                id: "__searchFrame__",
                name: "__searchFrame__"

            }).css({
                width: 0,
                height: 0,
                top: 0,
                left: 0,
                position: "absolute",
                border: 0

            }).load(function () {
                if ($(this).attr("src").length > 0)
                    $(this).show();
            });



            $(window).bind("resize.layerFrame", function () {
                var _top = (($(window).height() - AdQUA.getLayerFrame().height()) / 2);
                var _left = (($(window).width() - AdQUA.getLayerFrame().width()) / 2);

                AdQUA.getLayerFrame().css({
                    top: _top,
                    left: _left
                });
            });
        }


        return AdQUA.layerFrame;
    },



    // ¹ÝÅõ¸í ·¹ÀÌ¾î ¹ÝÈ¯
    getDisabledZone: function () {
        if (AdQUA.disabledZone == null) {
            var scrollWidth = document.body.scrollWidth;
            var scrollHeight = document.body.scrollHeight;

            AdQUA.disabledZone = $("<div />").appendTo("body");
            AdQUA.disabledZone.css({
                width: scrollWidth,
                height: scrollHeight,
                top: 0,
                left: 0,
                position: "absolute",
                backgroundColor: "black",
                opacity: 0.9,
                zIndex: 9000

            }).hide();


            $(window).bind("resize.disabledZone", function () {
                var _width = (($(window).width() >= scrollWidth) ? $(window).width() : scrollWidth);
                var _height = (($(window).height() >= scrollHeight) ? $(window).height() : scrollHeight);

                AdQUA.disabledZone.css({
                    width: _width,
                    height: _height
                });
            });
        }


        return AdQUA.disabledZone;
    },


    // ·¹ÀÌ¾î ÆäÀÌÁö ·Îµå( °æ·Î, ³ÐÀÌ, ³ôÀÌ, ´Ý±â½Ã ¾×¼Ç, center°íÁ¤¿©ºÎ, posX, posY )
    loadPage: function (_src, _width, _height, fnPostClose, layerOptions) {
        if ($.browser.msie)
            $("select").hide();


        var _top = (($(window).height() - _height) / 2);
        var _left = (($(window).width() - _width) / 2);

        AdQUA.getLayerFrame().attr("src", _src).css({
            width: _width,
            height: _height,
            top: _top,
            left: _left,
            zIndex: (AdQUA.getDisabledZone().css("zIndex") + 1)
        });

        AdQUA.getDisabledZone().show();


		$(window).trigger("resize");
    },


    // ·¹ÀÌ¾î ÆäÀÌÁö ´Ý±â..
    closePage: function () {
        AdQUA.getLayerFrame().attr("src", "").hide();
        AdQUA.getDisabledZone().hide();

        if ($.browser.msie)
            $("select").show();
    },


	 // Æ®·¹Å·ÇÔ¼ö..
    Tracking: function (code) {
        $.post(
			"/tracking.aspx",
			{ code: code }			
		);
	}

};

