Index: trunk/prototype/modules/mail/js/foldertree.js
===================================================================
--- trunk/prototype/modules/mail/js/foldertree.js	(revision 5732)
+++ trunk/prototype/modules/mail/js/foldertree.js	(revision 5754)
@@ -115,5 +115,5 @@
 		var target = $(this);	
 		
-		if($(".folders_loading").length)
+		if($(".folders-loading").length)
 			return;
 		
@@ -121,5 +121,5 @@
 			return;
 			
-		if( target.is('.collapsable-hitarea, .expandable-hitarea, .lastCollapsable-hitarea, .lastExpandable-hitarea, .treeview ,.folder_unseen,.ui-icon, .float-menu, .new_folder, .folders_loading, .head_folder, .shared-folders') )
+		if( target.is('.collapsable-hitarea, .expandable-hitarea, .lastCollapsable-hitarea, .lastExpandable-hitarea, .treeview ,.folder_unseen,.ui-icon, .float-menu, .new_folder, .folders-loading, .head_folder, .shared-folders') )
 			return;
 		
@@ -137,5 +137,5 @@
 			$(target).children('.folder').addClass('selected');
 		}
-		$(this).addClass("folders_loading");
+		$(this).addClass("folders-loading");
 		selected = target.attr('id');
 		change_folder(target.attr('id'), child.attr('title'));	
@@ -158,8 +158,10 @@
 			return $(DataLayer.render('../prototype/modules/mail/templates/draggin_box.ejs', {texto : (($(this).text().split("["))[0]), type: "folder"}));
 		},
+		delay: 150,
 		refreshPositions: true,
-		scroll: true, 
-		scrollSensitivity: 100,
-		scrollSpeed: 100,
+		zIndex : 2700,
+		//scroll: true, 
+		//scrollSensitivity: 100,
+		//scrollSpeed: 100,
 		containment: "#divAppbox" 
 	}).end().droppable({
@@ -250,5 +252,5 @@
 				}
 				
-				$(this).addClass("folders_loading");
+				$(this).addClass("folders-loading");
 				
 				$.ajax({
@@ -278,175 +280,168 @@
 				}else
 					folder_name = "Root";
-				DataLayer.render("../prototype/modules/mail/templates/float_folder_menu.ejs", {name_folder : folder_name}, function(html){						
+				html = DataLayer.render("../prototype/modules/mail/templates/float_folder_menu.ejs", {name_folder : folder_name});					
 					//FUNÇÃO DO eventNU FLUTUANTE EDITAR < BEGIN
-					var esc = false;
-					$(folder_).append(html).find(".float-menu-edit").click(function(){
-						var folder_id = $(this).parents(".closed:first").attr('id');
-						var name = $.trim($(this).parents(".closed:first").find("span:first").text().split("[")[0]);
-						if($(this).parents(".closed:first").find("span:first").hasClass("selected"))
-							return write_msg(get_lang("It's not possible rename this folder, because it is being used in the moment!"));
-						if($(this).parents(".closed:first").find(".selected").length)
-							return write_msg(get_lang("It's not possible rename this folder, because its subfolder is being used in the moment!")); 
-						if(valid_tabs($(this).parents("li:first").find("li"), folder_id))
-							return;
-						$(this).parents(".closed:first").find("span:first").empty().append("<input class='new_folder folder' type='text' maxlength='100'></input>");
-						$(".new_folder").focus().keydown(function(event){
-							event.stopPropagation();
-							if(event.keyCode == 13){
-								if($(this).val() != ""){
-									if($(this).val().match(/[\/\\\!\@\#\$\%\&\*\+\(\)]/gi)){
-										return write_msg(get_lang("cannot create folder. try other folder name"));
-									}
-									var new_name = folder_id.replace(/[a-zA-Z0-9á-úÁ-Ú]+$/gi, $(this).val());
-									if($('[id="'+new_name+'"]').length){
-										$(".folders_loading").removeClass("folders_loading");
-										write_msg(get_lang("Mailbox already exists"));
-										return draw_new_tree_folder();
-									}
-									$(".new_folder").parent().addClass("folders_loading");
-									$.ajax({
-										url : "controller.php?action=$this.imap_functions.ren_mailbox",
-										type : "POST",
-										data : "current="+folder_id+"&rename="+new_name,
-										success : function(){
-											write_msg(get_lang("The folder was successfully rename"));
-											cExecute("$this.imap_functions.get_folders_list&onload=true", update_menu);
-										}
-									});
-								}
-							}else if( event.keyCode == 27){
-								draw_new_tree_folder();
-							}
-						}).focusout(function(){
-							draw_new_tree_folder();
-						}).val(name);
-					})
-					//FUNÇÃO DO eventNU FLUTUANTE EDITAR < END
-					//FUNÇÃO DO eventNU FLUTUANTE EXCLUIR < BEGIN
-					.end().find(".float-menu-remove").click(function(){
-						
-						var folder_id = $(this).parents(".closed:first").attr('id');
-						var folder_name = "<strong>"+$.trim($(this).parents(".closed:first").find(".folder").text().split("[")[0])+"</strong>";
-						
-						if(valid_tabs($(this).parents("li:first").find("li"), folder_id))
-							return;
-						$(this).parents(".closed:first").find(".folder").addClass("folders_loading"); 
-						
-						if($(this).parents(".closed:first").find("ul").length){
-							$(this).parents(".closed:first").find(".folder").removeClass("folders_loading");
-							return write_msg(get_lang("Delete/move subfolders first"));
-						}
-						if($(this).parents(".closed:first").find(".selected").length){
-							$(this).parents(".closed:first").find(".folder").removeClass("folders_loading");
-							return write_msg(get_lang("It's not possible delete this folder, because it is being used in the moment!")); 
-						}
-						var folder_span = $(this);
-						var confirm_text = get_lang("Do you wish to exclude the folder ");
-						$.Zebra_Dialog(confirm_text+folder_name, {
-							'type':     'question',
-							'title':    'Confirmação de Exclusão',
-							'buttons':  [get_lang('Yes'), get_lang('No')],
-							'onClose':  function(caption) {
-								if(caption == get_lang('Yes')){
-									$.ajax({
-										url : "controller.php?action=$this.imap_functions.delete_mailbox",
-										type: "POST",
-										data : "del_past="+folder_id,
-										success : function(data){
-											data = connector.unserialize(data);
-											if(data == "Mailbox does not exist"){
-												$(".folders_loading").removeClass("folders_loading");
-												return write_msg(get_lang("Mailbox does not exist"));
-											}
-											write_msg(get_lang("The folder %1 was successfully removed", folder_name));
-											cExecute("$this.imap_functions.get_folders_list&onload=true", update_menu);
-										}
-									});
-								}else{
-									folder_span.parents(".closed:first").find(".folder").removeClass("folders_loading");
-									return;
-								}
-							}
-						});
-						/* if(!confirm(confirm_text + folder_name)){
-							$(this).parents(".closed:first").find(".folder").removeClass("folders_loading");
-							return;
-						} */
-					})
-					//FUNÇÃO DO eventNU FLUTUANTE EXCLUIR < END
-					//FUNÇÃO DO eventNU FLUTUANTE NOVA PASTA < BEGIN
-					.end().find(".float-menu-new").click(function(){
-						$(this).parents(".float-menu").addClass("hidden");
-						var selected_li = $(this).parents(".closed:first");
-						if(selected_li.find("ul:first").length){
-							var new_folder = $("<li><input class='new_folder folder' type='text' maxlength='100'></input></li>").appendTo(selected_li.find("ul:first"));								
-							if(selected_li.find(".expandable-hitarea").length){
-								selected_li.find(".expandable-hitarea").trigger('click');
-							}
-							selected_li.find("ul:first").treeview({
-								add: new_folder
-							});
-						}else if(selected_li.length){
-							var new_folder = $("<ul><li><input class='new_folder folder' type='text' maxlength='100'></input></li></ul>").appendTo(selected_li);								
-							selected_li.treeview({
-								add: new_folder
-							});
-						}else{
-							selected_li = $(this).parents(".head_folder").parent();
-							if($(this).parents(".head_folder").parent().find(".expandable-hitarea").length){
-								$(this).parents(".head_folder").parent().find(".expandable-hitarea").trigger('click');
-							}
-							var new_folder = $("<ul><li><input class='new_folder folder' type='text' maxlength='100'></input></li></ul>").appendTo(selected_li);								
-							selected_li.treeview({
-								add: new_folder
-							});
-						}
-						
-						selected_li.find(".new_folder").Watermark("Nova Pasta").focus().keydown(function(event){
-							event.stopPropagation();
-							if(event.keyCode == 13){
-								if($(this).val().match(/[\\\!\@\#\$\%\&\*\+\(\)]/gi)){
+				var esc = false;
+				$(folder_).append(html).find(".float-menu-edit").click(function(){
+					var folder_id = $(this).parents(".closed:first").attr('id');
+					var name = $.trim($(this).parents(".closed:first").find("span:first").text().split("[")[0]);
+					if($(this).parents(".closed:first").find("span:first").hasClass("selected"))
+						return write_msg(get_lang("It's not possible rename this folder, because it is being used in the moment!"));
+					if($(this).parents(".closed:first").find(".selected").length)
+						return write_msg(get_lang("It's not possible rename this folder, because its subfolder is being used in the moment!")); 
+					if(valid_tabs($(this).parents("li:first").find("li"), folder_id))
+						return;
+					$(this).parents(".closed:first").find("span:first").empty().append("<input class='new_folder folder' type='text' maxlength='100'></input>");
+					$(".new_folder").focus().keydown(function(event){
+						event.stopPropagation();
+						if(event.keyCode == 13){
+							if($(this).val() != ""){
+								if($(this).val().match(/[\/\\\!\@\#\$\%\&\*\+\(\)]/gi)){
 									return write_msg(get_lang("cannot create folder. try other folder name"));
 								}
-								if($('[id="'+ (selected_li.attr('id')? selected_li.attr('id') : "INBOX") + cyrus_delimiter + $(this).val()+'"]').length){
-									$(".folders_loading").removeClass("folders_loading");
+								var new_name = folder_id.replace(/[a-zA-Z0-9á-úÁ-Ú]+$/gi, $(this).val());
+								if($('[id="'+new_name+'"]').length){
+									$(".folders-loading").removeClass("folders-loading");
 									write_msg(get_lang("Mailbox already exists"));
 									return draw_new_tree_folder();
 								}
-								$(".new_folder").parent().addClass("folders_loading");
+								$(".new_folder").parent().addClass("folders-loading");
 								$.ajax({
-									url : "controller.php?action=$this.imap_functions.create_mailbox",
+									url : "controller.php?action=$this.imap_functions.ren_mailbox",
 									type : "POST",
-									data : "newp="+($(this).val() != "" ? $(this).val() : get_lang("New Folder"))+"&base_path="+(selected_li.attr('id')? selected_li.attr('id') : "INBOX"),
-									success : function(data){
-										data = connector.unserialize(data);
-										if(data == "Mailbox already exists"){
-											write_msg(get_lang("Mailbox already exists"));
-										}
+									data : "current="+folder_id+"&rename="+new_name,
+									success : function(){
+										write_msg(get_lang("The folder was successfully rename"));
 										cExecute("$this.imap_functions.get_folders_list&onload=true", update_menu);
 									}
 								});
-							}else if( event.keyCode == 27){
-								draw_new_tree_folder();
 							}
-						}).focusout(function(){
+						}else if( event.keyCode == 27){
 							draw_new_tree_folder();
+						}
+					}).focusout(function(){
+						draw_new_tree_folder();
+					}).val(name);
+				})
+				//FUNÇÃO DO eventNU FLUTUANTE EDITAR < END
+				//FUNÇÃO DO eventNU FLUTUANTE EXCLUIR < BEGIN
+				.end().find(".float-menu-remove").click(function(){
+					
+					var folder_id = $(this).parents(".closed:first").attr('id');
+					var folder_name = "<strong>"+$.trim($(this).parents(".closed:first").find(".folder").text().split("[")[0])+"</strong>";
+					
+					if(valid_tabs($(this).parents("li:first").find("li"), folder_id))
+						return;
+					$(this).parents(".closed:first").find(".folder").addClass("folders-loading"); 
+					
+					if($(this).parents(".closed:first").find("ul").length){
+						$(this).parents(".closed:first").find(".folder").removeClass("folders-loading");
+						return write_msg(get_lang("Delete/move subfolders first"));
+					}
+					if($(this).parents(".closed:first").find(".selected").length){
+						$(this).parents(".closed:first").find(".folder").removeClass("folders-loading");
+						return write_msg(get_lang("It's not possible delete this folder, because it is being used in the moment!")); 
+					}
+					var folder_span = $(this);
+					var confirm_text = get_lang("Do you wish to exclude the folder ");
+					$.Zebra_Dialog(confirm_text+folder_name, {
+						'type':     'question',
+						'overlay_opacity': '0.5',
+						'buttons':  [get_lang('Yes'), get_lang('No')],
+						'onClose':  function(caption) {
+							if(caption == get_lang('Yes')){
+								$.ajax({
+									url : "controller.php?action=$this.imap_functions.delete_mailbox",
+									type: "POST",
+									data : "del_past="+folder_id,
+									success : function(data){
+										data = connector.unserialize(data);
+										if(data == "Mailbox does not exist"){
+											$(".folders-loading").removeClass("folders-loading");
+											return write_msg(get_lang("Mailbox does not exist"));
+										}
+										write_msg(get_lang("The folder %1 was successfully removed", folder_name));
+										cExecute("$this.imap_functions.get_folders_list&onload=true", update_menu);
+									}
+								});
+							}else{
+								folder_span.parents(".closed:first").find(".folder").removeClass("folders-loading");
+								return;
+							}
+						}
+					});
+					/* if(!confirm(confirm_text + folder_name)){
+						$(this).parents(".closed:first").find(".folder").removeClass("folders-loading");
+						return;
+					} */
+				})
+				//FUNÇÃO DO eventNU FLUTUANTE EXCLUIR < END
+				//FUNÇÃO DO eventNU FLUTUANTE NOVA PASTA < BEGIN
+				.end().find(".float-menu-new").click(function(){
+					$(this).parents(".float-menu").hide();
+					var selected_li = $(this).parents(".closed:first");
+					if(selected_li.find("ul:first").length){
+						var new_folder = $("<li><input class='new_folder folder' type='text' maxlength='100'></input></li>").appendTo(selected_li.find("ul:first"));								
+						if(selected_li.find(".expandable-hitarea").length){
+							selected_li.find(".expandable-hitarea").trigger('click');
+						}
+						selected_li.find("ul:first").treeview({
+							add: new_folder
 						});
+					}else if(selected_li.length){
+						var new_folder = $("<ul><li><input class='new_folder folder' type='text' maxlength='100'></input></li></ul>").appendTo(selected_li);								
+						selected_li.treeview({
+							add: new_folder
+						});
+					}else{
+						selected_li = $(this).parents(".head_folder").parent();
+						if($(this).parents(".head_folder").parent().find(".expandable-hitarea").length){
+							$(this).parents(".head_folder").parent().find(".expandable-hitarea").trigger('click');
+						}
+						var new_folder = $("<ul><li><input class='new_folder folder' type='text' maxlength='100'></input></li></ul>").appendTo(selected_li);								
+						selected_li.treeview({
+							add: new_folder
+						});
+					}
+					
+					selected_li.find(".new_folder").Watermark("Nova Pasta").focus().keydown(function(event){
+						event.stopPropagation();
+						if(event.keyCode == 13){
+							if($(this).val().match(/[\\\!\@\#\$\%\&\*\+\(\)]/gi)){
+								return write_msg(get_lang("cannot create folder. try other folder name"));
+							}
+							if($('[id="'+ (selected_li.attr('id')? selected_li.attr('id') : "INBOX") + cyrus_delimiter + $(this).val()+'"]').length){
+								$(".folders-loading").removeClass("folders-loading");
+								write_msg(get_lang("Mailbox already exists"));
+								return draw_new_tree_folder();
+							}
+							$(".new_folder").parent().addClass("folders-loading");
+							$.ajax({
+								url : "controller.php?action=$this.imap_functions.create_mailbox",
+								type : "POST",
+								data : "newp="+($(this).val() != "" ? $(this).val() : get_lang("New Folder"))+"&base_path="+(selected_li.attr('id')? selected_li.attr('id') : "INBOX"),
+								success : function(data){
+									data = connector.unserialize(data);
+									if(data == "Mailbox already exists"){
+										write_msg(get_lang("Mailbox already exists"));
+									}
+									cExecute("$this.imap_functions.get_folders_list&onload=true", update_menu);
+								}
+							});
+						}else if( event.keyCode == 27){
+							draw_new_tree_folder();
+						}
+					}).focusout(function(){
+						draw_new_tree_folder();
 					});
-					//FUNÇÃO DO eventNU FLUTUANTE NOVA PASTA < END
 				});
+				//FUNÇÃO DO eventNU FLUTUANTE NOVA PASTA < END
 			}
 			if(!$(".new_folder").length){
-				if(!is_ie)
-					$(this).find(".float-menu:first").removeClass("hidden");
-				else
-					$(this).find(".float-menu:first").show();
+				$(this).find(".float-menu:first").css("display", "");
 			}
 		},
 		function(){
-			if(!is_ie)
-				$(this).find(".float-menu:first").addClass("hidden");
-			else
-				$(this).find(".float-menu:first").hide();
+			$(this).find(".float-menu:first").hide();
 		}
 	);
