/**
 * Map price box
 */
var MapPrice = Class.create();

MapPrice.prototype = {
    initialize: function () {
        this.items = new Array();
    },

    print: function(item_id, request_url, object) {
        if( !item_id || item_id <= 0 ) {
            return false;
        }

        var content = '<div id="map-price-popup" class="popup-container"><div class="popup-container-header">Loading, please wait...</div><div class="popup-container-body loading"><br /></div><div class="button-set"><span class="link btn-close-a" onclick="$(\'updater-wrapper\').innerHTML = \'\'; return false;"/></span><br /></div></div>';
        $('updater-wrapper').innerHTML = content;

        if( this.items[item_id] ) {
            content = this.items[item_id];
        } else {
            content = this.load(request_url);
            this.items[item_id] = content;
        }

        $('updater-wrapper').innerHTML = content;

        if (navigator.appVersion.indexOf("MSIE") != -1) var version = parseFloat(navigator.appVersion.split("MSIE")[1]);    
        if ((version < 7) && (document.body.filters)) {
            var html = '<iframe class="iframe" src="javascript:false;document.write(\'\');" tabindex="-1" />';
            $('map-price-popup').appendChild(document.createElement(html));
        }

        return false;
    },

    load : function(request_url) {
        var data = new Ajax.Request(request_url, {
                method: 'post',
                asynchronous: false
            }
        );

        if( data && data.transport && data.transport.responseText ) {
            return data.transport.responseText;
        } else {
            return '';
        }
    },

    hide: function() {
        $('updater-wrapper').innerHTML = '';
    }

};

mapPrice = new MapPrice();