function cWFolders()
{
this.arrayWin = new Array();
this.el;
this.alert = false;
}
cWFolders.prototype.makeWindowNew = function(border_id, type,from_search)
{ //Javascript doesn't seems to have polimorfism
_this = this;
var el = document.createElement("DIV");
el.style.visibility = "hidden";
el.style.position = "absolute";
el.style.left = "0px";
el.style.top = "0px";
el.style.width = "0px";
el.style.height = "0px";
el.id = 'dJSWin_wfolders';
document.body.appendChild(el);
el.innerHTML = "
";
var space = document.createElement('SPAN');
space.innerHTML = "
";
el.appendChild(space);
var butt = Element('dJSWin_wfolders_bok')
if (!butt){
butt = document.createElement('INPUT');
butt.id = 'dJSWin_wfolders_bok';
butt.type = 'button';
el.appendChild(butt);
}
if (type == 'save')
butt.value = get_lang('Save');
else if (type == 'send_and_file')
butt.value = get_lang('Send and file');
else if (type == 'move_to')
butt.value = get_lang('Move');
else if (type == 'change_folder')
butt.value = get_lang('Change folder');
else //default value
butt.value = get_lang(type);
butt.onclick = function () {
wfolders.arrayWin[el.id].close();
if (type == 'save'){
save_as_msg(border_id, wfolders_tree._selected.id, wfolders_tree._selected.caption,true);
}
else if (type == 'send_and_file'){
send_message(border_id, wfolders_tree._selected.id, wfolders_tree._selected.caption);
wfolders.alert = true;
}
else if (type == 'move_to') {
var msg_number = (border_id ? border_id.replace('_r','') : 'selected');
if (border_id.match('search'))
move_search_msgs(border_id, wfolders_tree._selected.id, wfolders_tree._selected.caption);
else{
proxy_mensagens.proxy_move_messages('null',msg_number, border_id, wfolders_tree._selected.id, wfolders_tree._selected.caption);
wfolders.alert = true;
}
}
else if (type == 'change_folder'){
change_folder(wfolders_tree._selected.id, wfolders_tree._selected.caption);
wfolders.alert = true;
}
else if (type == 'import'){
import_msgs(wfolders_tree);
}
};
if (type == 'save')
butt.value = get_lang('Save');
else if (type == 'send_and_file')
butt.value = get_lang('Send and file');
var space = document.createElement('SPAN');
space.innerHTML = " ";
el.appendChild(space);
var butt = document.createElement('BUTTON');
var buttext = document.createTextNode(get_lang('Close'));
butt.appendChild(buttext);
butt.onclick = function () {wfolders.arrayWin[el.id].close();};
el.appendChild(butt);
wfolders_tree = new dFTree({name: 'wfolders_tree'});
var n_root = new dNode({id:'root', caption:get_lang("My Folders")});
wfolders_tree.add(n_root,'anything'); //Places the root; second argument can be anything.
var folders = tree_folders.getNodesList(cyrus_delimiter);
for (var i=1; i