var Popup = new Class({
    initialize: function( strUrl, intWidth, intHeight, intLeft, intTop ) {
        Utility.createOverlay();
        document.$overlay.setStyle("display", "block");

        this.content = new Element("div", {styles: {
            position: 'absolute',
            width   : intWidth,
            height  : intHeight,
            left    : intLeft,
            top     : intTop,
            zIndex  : 10000
        }}).inject( document.body );

        this.img = new Element("img", {src: "cancel.png", alt: "X", styles: {
            position: 'absolute',
            left    : intLeft+intWidth-7,
            top     : intTop-7,
            zIndex  : 10001
        }, events: {
            click: this.close.bind(this)
        }}).inject( document.body );

        this.iframe = new Element("iframe", {border: 0, frameBorder: 0, src: strUrl, styles: {width: "100%", height:"100%"}}).inject( this.content );
    },

    close: function() {
        this.iframe.remove();
        this.content.remove();
        this.img.remove();
        document.$overlay.setStyle("display", "none");
    }
});

function popup( strUrl, intWidth, intHeight, intLeft, intTop ) {
    new Popup( strUrl, intWidth, intHeight, intLeft, intTop );
}
