var _ID_DHTML_PROFILE="dhtml_profile";
function DHTML_Profile(cntr_url, width, height)
{
    this._cntr_url = cntr_url;
    this._width = width;
    this._height = height,
    this.init_ui();

}

DHTML_Profile.prototype.init_ui = function()
{
    clear_dhtml_profile();
    var div_profile = document.getElementById(_ID_DHTML_PROFILE);
    div_profile.style.visibility="visible";
    var div_toolbar = document.createElement("div");
    div_toolbar.style.width=this._width;
    div_profile.appendChild(div_toolbar);
    div_toolbar.id="dhtml_profile_toolbar";
    
    var tab = document.createElement("table");
    tab.style.width=this._width;
    div_toolbar.appendChild(tab);
    var row = tab.insertRow(0);
    var cell = row.insertCell(0);
    cell.appendChild(document.createTextNode("TI-"+_PATHS));
    cell = row.insertCell(1);
    var but = document.createElement("input");
    but.type="button";
    but.value="X";
    but.className="button";
    but.onclick=restore_layers;
    cell.appendChild(but);
    cell.align="right";
    
    var iframe =document.createElement("IFRAME");
    iframe.id="frame_profile"
    iframe.style.width=this._width;
    iframe.style.height=this._height; 
    iframe.style.position="relative";
    
    iframe.src=this._cntr_url;
    div_profile.appendChild(iframe);
};

function clear_dhtml_profile()
{
    var div_profile = document.getElementById(_ID_DHTML_PROFILE);
    if(document.getElementById("frame_profile")){
        document.getElementById("frame_profile").src = '';
    }

    div_profile.style.visibility="hidden";
    clear_node(div_profile );
}
function restore_layers() {
    //if(_LINE_PATH != null){
        try{
            var params="type=report&action=restore_map_layers";
            process_ajax_call( params,_CNTR_REPORT,
                function(error){
                    if(!error)
                    {
                        clear_dhtml_profile();
                        return true;
                    }
                    else
                    {
                        return false;
                    }
                } );

        }catch(e)
        {
            alert("TI_Sentieri_Events_Manager.evt_but_print(): "+e);
            loading_message(false);
            return false;
        }

   // }

}