Index: trunk/expressoMail1_2/index.php
===================================================================
--- trunk/expressoMail1_2/index.php	(revision 6858)
+++ trunk/expressoMail1_2/index.php	(revision 6996)
@@ -23,7 +23,10 @@
 	echo "<script src='js/modal/modal.js'></script>";
 	//jquery and Editor 
-	echo ' 			
+	echo ' 
 		<link rel="stylesheet" type="text/css" href="templates/default/main.css"></link>
+		
 		<link rel="stylesheet" type="text/css" href="../phpgwapi/js/dftree/dftree.css"></link>
+		
+		<link rel="stylesheet" type="text/css" href="../prototype/plugins/jquery.spinner/jquery.spinner.css"></link>
 		<link rel="stylesheet" type="text/css" href="../prototype/plugins/fullcalendar/fullcalendar.css"></link>
 		<link rel="stylesheet" type="text/css" href="../prototype/plugins/fullcalendar/fullcalendar.print.css"></link>
@@ -32,4 +35,5 @@
 		<script type="text/javascript" src="../prototype/plugins/jquery/jquery.min.js"></script>
 		<link href="../prototype/modules/filters/filters.css" rel="stylesheet" type="text/css">
+		
 		<script type="text/javascript" src="../prototype/plugins/jquery/jquery-ui.min.js"></script>
 		<script src="../prototype/plugins/json2/json2.js" language="javascript"></script>
@@ -72,9 +76,11 @@
 		<script type="text/javascript" src="../prototype/plugins/contextmenu/jquery.contextMenu.js"></script>
 		<!-- <script type="text/javascript" src="../prototype/plugins/contextmenu/jquery.ui.position.js"></script> -->
-		
+
 		<script type="text/javascript" src="../prototype/modules/calendar/js/timezone.js"></script>
-        <script type="text/javascript" src="../prototype/plugins/dateFormat/dateFormat.js"></script>
+		<script type="text/javascript" src="../prototype/plugins/dateFormat/dateFormat.js"></script>
 		<script type="text/javascript" src="../prototype/modules/calendar/js/calendar.date.js"></script>
+		<script type="text/javascript" src="../prototype/modules/calendar/js/desktop.notification.js"></script>
 		<script type="text/javascript" src="../prototype/modules/calendar/js/calendar.codecs.js"></script>
+		<script type="text/javascript" src="../prototype/modules/calendar/js/calendar.alarms.js"></script>
 		<link rel="stylesheet" type="text/css" href="../prototype/plugins/freeow/style/freeow/freeow.css" >
 		<script type="text/javascript" src="../prototype/plugins/freeow/jquery.freeow.min.js"></script>
Index: trunk/expressoMail1_2/templates/default/index.tpl
===================================================================
--- trunk/expressoMail1_2/templates/default/index.tpl	(revision 6487)
+++ trunk/expressoMail1_2/templates/default/index.tpl	(revision 6996)
@@ -186,5 +186,5 @@
 	</fieldset>   
 </div>
-<div id="import-dialog" title="Importar Evento" style="display:none">
+<div id="import-dialog" title="Importar Evento/Tarefa" style="display:none">
 	<p>Seleciona uma Agenda para o Evento :</p>
 	<p>
Index: trunk/expressoMail1_2/templates/default/main.css
===================================================================
--- trunk/expressoMail1_2/templates/default/main.css	(revision 6930)
+++ trunk/expressoMail1_2/templates/default/main.css	(revision 6996)
@@ -898,5 +898,4 @@
 
 
-
 /*
  * Este arquivo limpa o estilo para a nova agenda, .new-event-win.active sobrescrevendo o código CSS
@@ -928,13 +927,13 @@
 /*	font-family: Arial,Helvetica,sans-serif;*/
 /*}*/
-.new-event-win.active:focus {
+.new-event-win.active:focus, .new-task-win.active:focus {
 	outline: 0;
 }
-.new-event-win.active body {
+.new-event-win.active body , .new-task-win.active body {
 	line-height: 1;
 	color: black;
 	background: white;
 }
-.new-event-win.active ol, .new-event-win.active ul {
+.new-event-win.active ol, .new-event-win.active ul , .new-task-win.active ol, .new-task-win.active ul {
 	list-style: none;
 	list-style-image : none;
@@ -942,40 +941,50 @@
 }
 
-.new-event-win.active table {
+.new-event-win.active table , .new-task-win.active table {
 	border-collapse: separate;
 	border-spacing: 0;
 }
-.new-event-win.active caption, .new-event-win.active th, .new-event-win.active td {
+.new-event-win.active caption, .new-event-win.active th, .new-event-win.active td, .new-task-win.active caption, .new-task-win.active th, .new-task-win.active td {
 	/*text-align: left;*/
 	font-weight: normal;
 }
 .new-event-win.active blockquote:before, .new-event-win.active blockquote:after,
-.new-event-win.active q:before, .new-event-win.active q:after {
+.new-event-win.active q:before, .new-event-win.active q:after,
+.new-task-win.active blockquote:before, .new-task-win.active blockquote:after,
+.new-task-win.active q:before, .new-task-win.active q:after {
 	content: "";
 }
-.new-event-win.active blockquote, .new-event-win.active q {
+.new-event-win.active blockquote, .new-event-win.active q ,
+.new-task-win.active blockquote, .new-task-win.active q 
+{
 	quotes: "" "";
 }
-.new-event-win.active .mail.name-special, .new-event-win.active .name.name-special{
+.new-event-win.active .mail.name-special, .new-event-win.active .name.name-special,
+.new-task-win.active .mail.name-special, .new-task-win.active .name.name-special
+{
   padding: 0 0 0 35px;
 }
 
-.new-event-win.active .add-attendee-search.search-field {
+.new-event-win.active .add-attendee-search.search-field ,
+.new-task-win.active .add-attendee-search.search-field 
+{
   width: 249px;
  }
  
- .new-event-win.active #calendar_addevent_details4 {
+ .new-event-win.active #calendar_addevent_details4, .new-task-win.active #calendar_addtask _details4 {
   margin: 10px 0 0 0;
  } 
  
- .new-event-win.active input{
+ .new-event-win.active input, .new-task-win.active input{
   color: #000;
  } 
  
- .new-event-win.active #calendar_addevent_details5 {
+ .new-event-win.active #calendar_addevent_details5 , .new-task-win.active #calendar_addtask_details5 {
   margin: 10px 0 11px 0;
  }
 
-.new-event-win.active select {
+ .new-event-win fieldset.tab-level2, .new-task-win fieldset.tab-level2 { padding: 0px 5px; min-height: 110px; max-height: 310px; overflow: hidden;}
+ 
+.new-event-win.active select , .new-task-win.active select {
     border: 1px solid #CFCFCF;
     border-color: #CFCFCF;
@@ -983,9 +992,14 @@
     background-color: #FFF;
 }
-.new-event-win.active a:link, .new-event-win.active a:visited {
+.new-event-win.active a:link, .new-event-win.active a:visited 
+.new-task-win.active a:link, .new-task-win.active a:visited
+{
+
     color: #2E6E9E;
 }
 
-.new-event-win.active  dd, .new-event-win.active  dl, .new-event-win.active  dt{
+.new-event-win.active  dd, .new-event-win.active  dl, .new-event-win.active  dt, 
+.new-task-win.active  dd, .new-task-win.active  dl, .new-task-win.active  dt
+{
 	margin: 0;
 }
@@ -1001,5 +1015,7 @@
 { color: #ff9933; }*/
 
-.new-event-win.active #divAppbox{
+.new-event-win.active #divAppbox
+.new-task-win.active #divAppbox
+{
 	overflow-x: auto;
 	overflow-y: scroll;
@@ -1007,4 +1023,5 @@
 
 .new-event-win.active select
+.new-task-win.active select
 { border-color: #CFCFCF; color: #555; padding-left:0px;}
 
@@ -1045,4 +1062,6 @@
 }
 
+div.new-event-win.active div.button-files-upload {margin: 15px 0 0 0;}
+
 fieldset.alarm{  
     border: none !important;
@@ -1051,10 +1070,13 @@
 }
 
-div.new-event-win.active div.button-files-upload{
-    margin: 15px 0 0 0;
-}
-
-div.new-event-win.active div.files-list{
-    margin: 45px 0 0 0;
+.new-task-win dl.block-add-attendee{
+	width: 350px;
+}
+.new-task-win.active .add-attendee-search.search-field{
+	width: 322px;
+}
+
+.new-task-win .menu-container.footer-container{
+	width: 774px;
 }
 
@@ -1170,5 +1192,4 @@
 	border-top: 0px;
 }*/
-
 
 
@@ -1423,9 +1444,9 @@
 
 .fileupload_msg_tooltip{
-	width: 99.7%;
-	text-align: center;
-	background: #DFEFFC;
-	font-weight: bold;
-	border-radius: 5px;
+    width: 99.7%;
+    text-align: center;
+    background: #DFEFFC;
+    font-weight: bold;
+    border-radius: 5px;
     height: 115px;
     line-height: 115px;
@@ -1457,2 +1478,97 @@
     background-color: #5194d2;
 }
+
+/*freeow*/
+div.gray.alarmDeadline .button.delete
+{
+/*
+	display: block;
+	position: absolute;
+	right: 19px;
+	top: 50px;
+	*/
+}
+
+/*div.gray.alarmDeadline ul.message-list{overflow: hidden;}*/
+
+/*div.gray.alarmDeadline ul.message-list li{ margin: 5px 0;}*/
+
+div.gray li{float: left; width: 253px;}
+
+div.gray li a.button.delete{float: right;}
+
+
+.div-addtask #calendar_addtask_details1 .h1{
+  width: 100%;
+}
+
+.div-addtask #calendar_addtask_details2 textarea {
+  width: 675px;
+}
+
+.div-addtask .button-files-upload{width: 100%;}
+.div-addtask fieldset.block-add-attendee .search-result-list, fieldset.block-add-activity .search-result-list{width: 330px;}
+
+.new-event-win div.div-addevent, .new-task-win div.div-addtask{width: 775px;}
+
+.calendar-addevent-details-txt-timezone, .calendar-addtask-details-txt-timezone{width: 212px;} 
+
+.div-addtask #calendar_addtask_details1 .time-previsao { width: 40px; }
+
+.div-addtask #calendar_addtask_details1 .date-previsao{ width: 80px; }
+
+.div-addtask #calendar_addtask_details6{ width: 756px; }
+.div-addtask #calendar_addtask_details1 .start-time{ width: 40px; }
+.div-addtask #calendar_addtask_details1 .start-date{ width: 80px; }
+.div-addtask #calendar_addtask_details1 .end-time{ width: 40px; }
+.div-addtask #calendar_addtask_details1 .end-date{ width: 80px; }
+.div-addtask #calendar_addtask_details1 .previsao-termino { margin: 0 0 0 20px; }
+.div-addtask #calendar_addtask_details1 .subitem { margin: 5px; display: block;}
+.div-addtask #calendar_addtask_details1 .subitem .span_done{ margin: 0 30px;}
+.div-addtask #calendar_addtask_details1 .subitem .span_done img{position: relative; top:4px; width:16px; height:16px;}
+.div-addtask #calendar_addtask_details1 .calendar_addevent_details_lnk_timezone { margin: 0 0 0 20px;}
+.div-addtask #calendar_addtask_details1 .subitem .done { width: 45px;}
+.div-addtask #calendar_addtask_details1 .ui-spinner-buttons{ top: -2px !important;}
+.div-addtask #calendar_addtask_details1 .ui-spinner-buttons .ui-spinner-up{height: 7px !important;}
+.div-addtask #calendar_addtask_details1 .ui-spinner-buttons .ui-spinner-down{height: 8px !important;}
+
+.div-addtask #calendar_addtask_details1 .subitem .span_done.noAction{background-image: url("../../../prototype/modules/calendar/img/gray.png"); background-repeat: no-repeat; }
+.div-addtask #calendar_addtask_details1 .subitem .span_done.inProcess{background-image: url("../../../prototype/modules/calendar/img/yellow.png"); background-repeat: no-repeat;}
+.div-addtask #calendar_addtask_details1 .subitem .span_done.finished{background-image: url("../../../prototype/modules/calendar/img/green.png"); background-repeat: no-repeat;}
+.div-addtask #calendar_addtask_details1 .subitem .span_done.canceled{background-image: url("../../../prototype/modules/calendar/img/red.png"); background-repeat: no-repeat;}
+
+#calendar_addtask_details4{margin: 0;}
+#calendar_addtask_details5{margin: -2px 0 0 0;}
+#calendar_addtask_details7{margin: 3px 0 0 0;}
+.div-addtask #calendar_addtask_details1 .subitem .span_done label{position: relative; left: 28px;}
+
+.div-addtask fieldset#calendar_addtask_details5.tab-level2{ margin: 0 }
+
+.div-addtask  #calendar_addtask_details8 .parent {width: 746px; min-height: 208px; float: left;}
+/*.div-addtask  #calendar_addtask_details8 .parent .child-top {width: 745px; height: 20px; background: #E8F4FD; border-left: 1px solid #CCC; border-right: 1px solid #CCC; border-bottom: 1px solid #CCC;}*/
+.div-addtask  #calendar_addtask_details8 .parent .child-top {width: 745px; height: 25px; background: #E8F4FD; border-left: 1px solid #CCC; border-right: 1px solid #CCC; border-bottom: 1px solid #CCC; border-top: 1px solid #CCC;}
+.div-addtask  #calendar_addtask_details8 .parent .child-bottom {width: 745px; height: 208px; overflow: auto;  float: left; border-left: 1px solid #CCC; border-right: 1px solid #CCC; border-bottom: 1px solid #CCC;}
+.div-addtask  #calendar_addtask_details8 .parent .child-bottom .child-bottom-each { height: 20px; }
+.div-addtask  #calendar_addtask_details8 .parent .child-bottom .child-bottom-each:hover { background: #FFF2F2; cursor: pointer;}
+
+.div-addtask  #calendar_addtask_details8 .parent .child-bottom .child-bottom-each .date-hour {overflow: hidden; width: 140px; float: left; height: 20px}
+.div-addtask  #calendar_addtask_details8 .parent .child-bottom .child-bottom-each .date-hour span { margin: 8px; float: left; }
+.div-addtask  #calendar_addtask_details8 .parent .child-bottom .child-bottom-each .user{overflow: hidden; width: 150px; float: left;  height: 20px; border-left: 1px solid #CCC; }
+.div-addtask  #calendar_addtask_details8 .parent .child-bottom .child-bottom-each .user span{ margin: 8px; float: left; }
+.div-addtask  #calendar_addtask_details8 .parent .child-bottom .child-bottom-each .attribute{overflow: hidden; width: 130px; float: left;  height: 20px; border-left: 1px solid #CCC; }
+.div-addtask  #calendar_addtask_details8 .parent .child-bottom .child-bottom-each .attribute span{ margin: 8px; float: left; }
+.div-addtask  #calendar_addtask_details8 .parent .child-bottom .child-bottom-each .beforeValue{overflow: hidden; width: 150px; float: left;  height: 20px; border-left: 1px solid #CCC; }
+.div-addtask  #calendar_addtask_details8 .parent .child-bottom .child-bottom-each .beforeValue span{ margin: 8px; float: left; }
+.div-addtask  #calendar_addtask_details8 .parent .child-bottom .child-bottom-each .afterValue{overflow: hidden; width: 150px; float: left;  height: 20px; border-left: 1px solid #CCC; }
+.div-addtask  #calendar_addtask_details8 .parent .child-bottom .child-bottom-each .afterValue span{ margin: 8px; float: left; }
+
+.div-addtask  #calendar_addtask_details8 .parent .child-top .date-hour { width: 140px; float: left; background: #E8F4FD; height: 20px; text-align: center; }
+.div-addtask  #calendar_addtask_details8 .parent .child-top .date-hour span{ display: block; padding: 6px; font-weight: bold; color: #2E6E9E; }
+.div-addtask  #calendar_addtask_details8 .parent .child-top .user { width: 150px; float: left; background: #E8F4FD; height: 20px; font-weight: bold; color: #2E6E9E; text-align: center;}
+.div-addtask  #calendar_addtask_details8 .parent .child-top .user span{display: block; padding: 6px;}
+.div-addtask  #calendar_addtask_details8 .parent .child-top .attribute { width: 130px; float: left; background: #E8F4FD; height: 20px; font-weight: bold; color: #2E6E9E;  text-align: center;}
+.div-addtask  #calendar_addtask_details8 .parent .child-top .attribute span{display: block; padding: 6px;}
+.div-addtask  #calendar_addtask_details8 .parent .child-top .beforeValue { width: 150px; float: left; background: #E8F4FD; height: 20px; font-weight: bold; color: #2E6E9E;  text-align: center;}
+.div-addtask  #calendar_addtask_details8 .parent .child-top .beforeValue span{display: block; padding: 6px; }
+.div-addtask  #calendar_addtask_details8 .parent .child-top .afterValue { width: 150px; float: left; background: #E8F4FD; height: 20px; font-weight: bold; color: #2E6E9E;  text-align: center;}
+.div-addtask  #calendar_addtask_details8 .parent .child-top .afterValue span{display: block; padding: 6px; }
Index: trunk/expressoMail1_2/setup/phpgw_pt-br.lang
===================================================================
--- trunk/expressoMail1_2/setup/phpgw_pt-br.lang	(revision 6952)
+++ trunk/expressoMail1_2/setup/phpgw_pt-br.lang	(revision 6996)
@@ -135,4 +135,5 @@
 Do you really want to empty your trash folder?	expressoMail1_2	pt-br	Você tem certeza que deseja limpar sua lixeira?
 Do you wanna receive an alert for new messages?	expressoMail1_2	pt-br	Você quer receber um alerta para mensagens novas?
+Wish you receive notifications for: "New messages", "Filter criteria", "Event alerts"?	expressoMail1_2	pt-br	Exibir notificações de: "Nova mensagem", "Criterio atendido", "Alerta de evento"?
 Do you want to automatically display the message header?	expressoMail1_2	pt-br	Você deseja exibir automaticamente o cabecalho da mensagem?
 Do you want to block this e-mail?	expressoMail1_2	pt-br	Você gostaria de bloquear este e-mail?
@@ -393,4 +394,6 @@
 Number of dynamic contacts	admin	pt-br	Número de contatos dinâmicos
 Number of messages to send:	expressoMail1_2	pt-br	Número de mensagens à enviar:
+Notification	expressoMail1_2	pt-br	Notificação
+Filter criteria	expressoMail1_2	pt-br	Critério de filtro
 Offline Pass	expressoMail1_2	pt-br	Senha do Offline
 Offline success installed	expressoMail1_2	pt-br	Offline instalado com sucesso
@@ -929,2 +932,3 @@
 Permission denied to folder "%1".	expressoMail1_2	pt-br	Permissão negada para pasta "%1".
 Success	expressoMail1_2	pt-br	Concluído
+The contact was moved from recent contacts to personal contacts successful.	expressoMail1_2	pt-br	O Contato foi movido dos contatos recentes para os contatos pessoais com sucesso.
Index: trunk/expressoMail1_2/setup/tables_current.inc.php
===================================================================
--- trunk/expressoMail1_2/setup/tables_current.inc.php	(revision 6528)
+++ trunk/expressoMail1_2/setup/tables_current.inc.php	(revision 6996)
@@ -78,5 +78,6 @@
 				'alarm_deadline' => array('type' => 'timestamp', 'nullable' => true),
 				'done_deadline' => array('type' => 'timestamp', 'nullable' => true),
-				'is_done' => array('type' => 'int', 'precision' => '8','nullable' => true)
+				'is_done' => array('type' => 'int', 'precision' => '2','nullable' => true),
+				'sent' => array('type' => 'int', 'precision' => '2','nullable' => false, 'default' => 0)
 			),
 			'pk' => array('id'),
@@ -96,5 +97,6 @@
 				'size' => array('type' => 'int','precision' => '16','nullable' => False),
                 'dtstamp' => array('type' => 'int','precision' => '16','nullable' => False),
-				'owner' => array('type' => 'int', 'precision' => '8','nullable' => True)
+				'owner' => array('type' => 'int', 'precision' => '8','nullable' => True),
+				
 			),
 			'pk' => array('id'),
Index: trunk/expressoMail1_2/setup/tables_update.inc.php
===================================================================
--- trunk/expressoMail1_2/setup/tables_update.inc.php	(revision 6543)
+++ trunk/expressoMail1_2/setup/tables_update.inc.php	(revision 6996)
@@ -312,3 +312,13 @@
 	    return $GLOBALS['setup_info']['expressoMail1_2']['currentver'];
 	}
+	
+	$test[] = '2.4.8';
+	function expressoMail1_2_upgrade2_4_8() {
+		$oProc = $GLOBALS['phpgw_setup']->oProc;
+
+		$oProc->query("ALTER TABLE expressomail_message_followupflag ADD COLUMN sent smallint not null default 0");
+
+		$GLOBALS['setup_info']['expressoMail1_2']['currentver'] = '2.4.8.1';
+	    return $GLOBALS['setup_info']['expressoMail1_2']['currentver'];
+	}
 ?>
Index: trunk/expressoMail1_2/setup/setup.inc.php
===================================================================
--- trunk/expressoMail1_2/setup/setup.inc.php	(revision 6528)
+++ trunk/expressoMail1_2/setup/setup.inc.php	(revision 6996)
@@ -13,5 +13,5 @@
 $setup_info['expressoMail1_2']['name'] = 'expressoMail1_2';
 $setup_info['expressoMail1_2']['title'] = 'Expresso Mail';
-$setup_info['expressoMail1_2']['version'] = '2.4.8';
+$setup_info['expressoMail1_2']['version'] = '2.4.8.1';
 $setup_info['expressoMail1_2']['app_order'] = 2;
 $setup_info['expressoMail1_2']['tables'][] = 'phpgw_certificados';
Index: trunk/expressoMail1_2/inc/hook_settings.inc.php
===================================================================
--- trunk/expressoMail1_2/inc/hook_settings.inc.php	(revision 6858)
+++ trunk/expressoMail1_2/inc/hook_settings.inc.php	(revision 6996)
@@ -345,4 +345,10 @@
 create_check_box('Show previous message, after delete actual message?','delete_and_show_previous_message','Enable this option if you want to read the next message everytime you delete a message');
 create_check_box('Do you wanna receive an alert for new messages?','alert_new_msg','Everytime you receive new messages you will be informed');
+
+
+create_check_box('Wish you receive notifications for: "New messages", "Filter criteria", "Event alerts"?','notifications','Everytime you receive new messages you will be informed');
+
+
+
 create_check_box('Show default view on main screen?','mainscreen_showmail','Show unread messages in your home page');
 create_check_box('Do you want to use remove attachments function?','remove_attachments_function','It allow you to remove attachments from messages');
Index: trunk/expressoMail1_2/js/common_functions.js
===================================================================
--- trunk/expressoMail1_2/js/common_functions.js	(revision 6930)
+++ trunk/expressoMail1_2/js/common_functions.js	(revision 6996)
@@ -1286,2 +1286,6 @@
     return folderName;
 }
+
+function useDesktopNotification(){
+    return !!parseInt(preferences.notifications);
+}
Index: trunk/expressoMail1_2/js/main.js
===================================================================
--- trunk/expressoMail1_2/js/main.js	(revision 6980)
+++ trunk/expressoMail1_2/js/main.js	(revision 6996)
@@ -1,4 +1,5 @@
 // Tempo do auto refresh (em milisegundos)
 var time_refresh = 300000;
+
 // tempo do auto save (em milisegundos)
 // 20000 = 20 segundos
@@ -6,6 +7,10 @@
 var results_search_messages = ""; 
 var cabecalho = '<h4>ExpressoLivre - ExpressoMail</h4>'; 
-// Variavel para controle de atualização das mensagens listadas na modal de alerta de filtro por remetente
-var checkAlarmsFilter = false;
+
+var auxNotificationCriteriaVetor = [];
+var auxNotification;
+
+var countNewMessage = 0;
+var notifyNewMessageFilter = [];
 
 var dynamicPersonalContacts = new Array();
@@ -20,5 +25,5 @@
 	} 
 }
-	
+
 function mount_url_folder(folders){
 	return folders.join(cyrus_delimiter);
@@ -75,5 +80,5 @@
 		
  	                if(preferences.show_name_print_messages == "1") { 
-							var getUserName = document.getElementById("user_info"); 
+				var getUserName = document.getElementById("user_info"); 
  	                        var userName = getUserName.innerHTML; 
  	                        var position = userName.indexOf("-"); 
@@ -572,5 +577,5 @@
 
 function auto_refresh(){
-	refresh(preferences.alert_new_msg);
+	refresh(preferences.alert_new_msg, preferences.notifications);
 	setTimeout('auto_refresh()', time_refresh);
 }
@@ -581,15 +586,35 @@
 }
 
-function refresh(alert_new_msg){
+function notificationFilter(data, notifyCriteria){
+	
+	if(parseInt(notifyCriteria)  && data.length > 0 && !activePage ){
+	
+		var howManyCriteria = $('div.gray.filtersDeadline .message-list li').length;
+		var differenceOfNewCriteria = data.length - howManyCriteria;
+		
+		if(differenceOfNewCriteria > 0){
+			for(var i=data.length - differenceOfNewCriteria; i < data.length; i++){
+	
+				desktopNotification.sentNotification("",get_lang("Filter criteria"),  truncate(new Date(data[i].udate).toString('dd/MM HH:mm') + ' - ' + data[i].from+' - '+data[i].subject, 75));
+				desktopNotification.showNotification(false, function(){
+					window.focus();
+					this.cancel();
+				});
+			}
+		}
+	}
+}
+
+function refresh(alert_new_msg, notifyPermission){
+
 	getFromAlertRules();
 	var handler_refresh = function(data){
-		if(checkAlarmsFilter){
-			handlerMessageFilter = function (data) {
-				alarmFollowupflagged('filtersAlarms', data);
-			}
-			/* Busca  nas pastas indexadas para ver se há novas mensagens com a flag $FilteredMessage */
-			cExecute ("$this.imap_functions.getFlaggedAlertMessages&folders="+fromRules, handlerMessageFilter);
-		}
-		checkAlarmsFilter = true;
+		handlerMessageFilter = function (data) {			
+			alarmFollowupflagged('filtersAlarms', data);
+			notificationFilter(data, notifyPermission);
+		}
+		/* Busca  nas pastas indexadas para ver se há novas mensagens com a flag $FilteredMessage */
+		cExecute ("$this.imap_functions.getFlaggedAlertMessages&folders="+fromRules, handlerMessageFilter);
+
 		if(data['msg_range_end'])
 			if(data['msg_range_end'] > 0)
@@ -603,5 +628,5 @@
 			showEmptyBoxMsg(box);
 
-		if (data.length > 0){
+		if (data.length > 0 || countNewMessage > 0){
 			for(var i=0;i< data.length;i++){
 				if (!onceOpenedHeadersMessages[current_folder])
@@ -742,7 +767,28 @@
 			if(parseInt(preferences.use_shortcuts))
 				select_msg("null","reload_msg","null");
-
-			if(parseInt(alert_new_msg) && data.new_msgs > 0)
+		
+			if(parseInt(alert_new_msg) && data.new_msgs > 0 && activePage)
 				alert(data['new_msgs'] > 1 ? get_lang("You have %1 new messages", data['new_msgs']) + "!" : get_lang("You have 1 new message") +"!");
+			
+			
+			if(parseInt(notifyPermission)  && (data.new_msgs > 0 || !!countNewMessage) && !activePage ){
+			
+				countNewMessage += data.length;
+				
+				desktopNotificationAux = desktopNotification.sentNotification("",get_lang("Notification"), countNewMessage > 1 ? get_lang("You have %1 new messages", countNewMessage) + "!" : get_lang("You have 1 new message") + "!");
+				
+				if(auxNotification !== 'undefined')
+					desktopNotification.cancelByReference(auxNotification);
+				
+				desktopNotification.showNotification(function(){
+					countNewMessage = 0;
+				}, function(){
+					window.focus();
+					this.cancel();
+					countNewMessage = 0;
+				});
+				
+				auxNotification = desktopNotificationAux;
+			}
 			build_quota(data['quota']);
 		}
@@ -4018,4 +4064,116 @@
 }
 
+//Normalização dos dados evita ter que reemplementar toda as funcionalidades do calendar
+function decodeCreateSchedulable(type, ID){
+	var startEvent = new Date();  
+	if(startEvent.toString('mm') < 30) 
+		startEvent.add({minutes: (30 - parseInt(startEvent.toString('mm')))}); 
+	else 
+		startEvent.add({hours: 1, minutes: '-'+startEvent.toString('mm')}); 
+	var endEvent = function(date){ 
+	if(!!User.preferences.defaultCalendar){ 
+		return  new Date(parseInt(date.getTime()) + 
+			(!!Calendar.signatureOf[User.preferences.defaultCalendar].calendar.defaultDuration ?  
+			(Calendar.signatureOf[User.preferences.defaultCalendar].calendar.defaultDuration * 60000) :
+			(User.preferences.defaultDuration * 60000)
+		));
+	}else 
+		return new Date(parseInt(date.getTime()) + (User.preferences.defaultDuration * 60000)); 
+	};       
+
+	var emails = $("#to_values_"+ID).val().split(',');
+	
+	var schedulable = {};
+	
+	schedulable = { 
+		acl: {inviteGuests: true, organization: true ,participationRequired: false, read: true, write: true},
+		alarms: [],
+		allDay: false,
+		attachments: [],
+		isAttendee: true,
+		attendee: '',//TODOOOOOO,
+		category: '',
+		'class': '1',
+		delegatedFrom: {},
+		endDate: startEvent.toString(User.preferences.dateFormat),
+		startDate: endEvent(startEvent).toString(User.preferences.dateFormat),
+		startHour: startEvent.toString(User.preferences.hourFormat),
+		endHour: endEvent(startEvent).toString(User.preferences.hourFormat),
+		timezone: User.preferences.defaultCalendar ? Calendar.signatureOf[User.preferences.defaultCalendar].calendar.timezone : User.preferences.timezone,
+		summary : $("#subject_"+ID).text(),
+		description : $("#body_" + ID).text(),
+		startTime: startEvent.getTime(),
+		endTime: endEvent(startEvent),
+		timezones: Timezone.timezones,
+		me: {name: User.me.name, mail: User.me.mail, acl: 'rowi', status: '1', delegatedFrom: '0', id: User.me.id},
+		organizer: {name: User.me.name, mail: User.me.mail, acl: 'rowi', status: '1', delegatedFrom: '0' , id: User.me.id},
+		statusParticipants: {accepted: 0, cancelled: 0, tentative: 0, unanswered:emails.length},
+		location: '',
+		attendee: $.map(emails, function( mail ){			
+			var contact = false;
+			var decoded =  Encoder.htmlDecode(mail);
+			var newAttendeeName = "";
+
+			var name = decoded.match(/"([^"]*)"/) ? decoded.match(/"([^"]*)"/)[1] : '';
+			var mail = decoded.match(/<([^<]*)>[\s]*$/) ? decoded.match(/<([^<]*)>[\s]*$/)[1].toLowerCase() : decoded; 
+
+
+			var user = DataLayer.get('user', ["=", "mail", mail], true);
+			
+			if( $.type(user) == "array" )
+				user = user[0];
+
+			if(user != ''){
+				//user = {name : name , mail : mail};
+				if(User.me.mail == user.mail)
+					return(null);
+				user.isExternal = (!!user && !(!!user.isExternal)) ? 0 : 1;
+
+				return  DataLayer.merge({
+					name: user.name,
+					mail: user.mail,
+					acl:  'r',
+					delegatedFrom: '0',
+					status: '4',
+					isExternal: user.isExternal
+				}, !!user.id ? {id : DataLayer.put('participant', {user: user.id, isExternal: user.isExternal})} : {id: DataLayer.put('participant', {user: user})}); 
+			}else if(mail.match(/[\w-]+(\.[\w-]+)*@(([A-Za-z\d][A-Za-z\d-]{0,61}[A-Za-z\d]\.)+[A-Za-z]{2,6}|\[\d{1,3}(\.\d{1,3}){3}\])/)){
+				
+				var userId = DataLayer.put('user', {
+				name: name, 
+				mail: mail, 
+				isExternal: '1'
+				});
+				var newAttendeeId = DataLayer.put('participant', {
+				user: userId, 
+				isExternal: '1'
+				});
+
+				return  {
+					id: newAttendeeId,
+					name: name,
+					mail: mail,
+					acl:  'r',
+					delegatedFrom: '0',
+					status: '4',
+					isExternal: '1'
+				};
+				
+			}else
+				return (null);
+		})
+	};
+
+	schedulable  = DataLayer.merge(schedulable, 
+		type == 'event' ? 
+		{calendar: User.preferences.defaultCalendar ? User.preferences.defaultCalendar : Calendar.calendars[0], calendars: Calendar.calendars}
+		: {group: Calendar.groups[0].id, groups: Calendar.groups, percentage: 0}
+	);
+	
+	return schedulable;
+	    
+
+}
+
 function import_implements_calendar(){
 
@@ -4031,7 +4189,9 @@
 		$.ajax({url: "../prototype/modules/calendar/js/map.disponibility.js", async: false, beforeSend: function( xhr ) {xhr.overrideMimeType('text/javascript; charset=ISO-8859-1')}});
 		$.ajax({url: "../prototype/modules/calendar/js/helpers.js", async: false, beforeSend: function( xhr ) {xhr.overrideMimeType('text/javascript; charset=ISO-8859-1')}});
+		$.ajax({url: "../prototype/modules/calendar/js/task.helpers.js", async: false, beforeSend: function( xhr ) {xhr.overrideMimeType('text/javascript; charset=ISO-8859-1')}});
 		//$.ajax({ url: "../prototype/modules/calendar/js/timezone.js", async: false});
 		//$.ajax({ url: "../prototype/modules/calendar/js/calendar.codecs.js", async: false});
 		$.ajax({url: "../prototype/plugins/encoder/encoder.js", async: false, beforeSend: function( xhr ) {xhr.overrideMimeType('text/javascript; charset=ISO-8859-1')}});
+		$.ajax({url: "../prototype/plugins/jquery.spinner/jquery.spinner.min.js", async: false, beforeSend: function( xhr ) {xhr.overrideMimeType('text/javascript; charset=ISO-8859-1')}});
 		//$.ajax({url: "../prototype/plugins/dateFormat/dateFormat.js", async: false, beforeSend: function( xhr ) { xhr.overrideMimeType('text/javascript; charset=ISO-8859-1')}});
 
@@ -4073,6 +4233,6 @@
 		wfolders.makeWindow('null','import');
 }
-
-function decodeOwner(){
+    //Verifica o contexto de importação
+    function decodeOwner(){
 	owner = User.me.id;
 	var imapBox = openTab.imapBox[currentTab].split(cyrus_delimiter);
@@ -4082,195 +4242,189 @@
 	}	
 	return owner;
-}
-function import_calendar(data){
-    var import_url = '$this.db_functions.import_vcard&msg_folder='+data;
-    var logUser;
-    var up;
-    var owner;   
-    function handler_import_calendar(data){
-            if(data === true){
-                    write_msg(get_lang("The event was imported successfully."));
-            }
-            else if( data['url'] )
-            {
-                var form = document.createElement( "form" );
-
-                form.setAttribute( "action", DEFAULT_URL + data['url'] + '&isPost=true' );
-                form.setAttribute( "method", "POST" );
-
-                document.body.appendChild( form );
-
-                form.submit();
-            }
-            else
-                write_msg(get_lang(data));
-    }	
+    }
+
+   function import_calendar(data){
+        var import_url = '$this.db_functions.import_vcard&msg_folder='+data;
+        var logUser;
+        var up;
+        var owner;
+
+        function handler_import_calendar(data){
+	    if(data === true){
+		write_msg(get_lang("The event was imported successfully."));
+	    }
+	    else if( data['url'] )
+	    {
+		var form = document.createElement( "form" );
+
+		form.setAttribute( "action", DEFAULT_URL + data['url'] + '&isPost=true' );
+		form.setAttribute( "method", "POST" );
+
+		document.body.appendChild( form );
+
+		form.submit();
+	    }
+	    else
+		write_msg(get_lang(data));
+        }   
 	if(defaultCalendar == "expressoCalendar" && $("#expressoCalendarid")[0]){
-		import_implements_calendar();
+	    import_implements_calendar();
 		$( "#import-dialog" ).dialog({
-			autoOpen: false,
-			height: 220,
-			modal: true,
-			resizable : false,
-            open: function(event, ui) 
-            {
-                if(typeof(shortcut) != 'undefined') shortcut.disabled = true; 
-            },
-            close: function(event, ui) 
-            {
-                event.stopPropagation();
-                if(typeof(shortcut) != 'undefined') shortcut.disabled = false; 
-            },
-			closeOnEscape: true
+		    autoOpen: false,
+		    height: 220,
+		    modal: true,
+		    resizable : false,
+		    open: function(event, ui) {
+			if(typeof(shortcut) != 'undefined') shortcut.disabled = true; 
+		    },
+		    close: function(event, ui){
+			event.stopPropagation();
+			if(typeof(shortcut) != 'undefined') shortcut.disabled = false; 
+		    },
+		    closeOnEscape: true
 		});
-		
+                   
 		$.ajax({
-			url: "controller.php?action="+import_url+'&from_ajax=true&id_user='+User.me.id+'&readable=true&cirus_delimiter='+cyrus_delimiter+'&analize=true&uidAccount='+decodeOwner(),
-			async: false,
-			success: function(data){
-					data = connector.unserialize(data);
-
-
-					var createDialog = function(typeImport, propaget){
-					    
-						if(typeof(typeImport) == "object"){
-						    var calendarPermission = typeImport.calendar;
-						    typeImport = typeImport.action;
+		    url: "controller.php?action="+import_url+'&from_ajax=true&id_user='+User.me.id+'&readable=true&cirus_delimiter='+cyrus_delimiter+'&analize=true&uidAccount='+decodeOwner(),
+		    async: false,
+		    success: function(data){
+			data = connector.unserialize(data);
+			var createDialog = function(typeImport, propaget){
+                                               
+			    if(typeof(typeImport) == "object"){
+				var calendarIds = !!typeImport.calendar ? typeImport.calendar : Calendar[typeImport.type];
+				typeImport = typeImport.action;
+			    }
+                                                   
+			    switch(parseInt(typeImport)){
+				case 1:
+				case 7:
+				case 10:
+				    $("#select-agenda").html('');
+
+				    var options = '';
+
+				    if(calendarIds){
+					for(var i = 0; i < calendarIds.length; i++)
+					    options += '<option value="'+calendarIds[i]+'">'+Calendar.signatureOf[calendarIds[i]].calendar.name+'</option>'
+				    }
+
+				    $("#select-agenda").append(options);
+				    $("#select-agenda").css("display", "block");
+
+				    $("#import-dialog" ).dialog({
+					buttons: {
+					    Cancel: function() {
+						$( this ).dialog( "close" );
+					    },
+					    "Importar" : function(){
+						    $.ajax({
+							url: "controller.php?action="+import_url+'&from_ajax=true&selected='+$("#select-agenda option:selected").val()+'&status='+$("#select-status option:selected").val()+'&uidAccount='+decodeOwner(),
+							success: function(msg){
+							    var alt = ( (msg = connector.unserialize(msg)) == "ok") ? "Importado com sucesso para " : "Ocorreu um erro ao importar o evento/tarefa para a agenda ";
+							    alert( alt + $("#select-agenda option:selected").text() );
+							}
+						    });
+						    $( this ).dialog( "close" );
+					    }
+					}
+				    });
+    
+				    if(typeImport == 7){
+					$("#import-dialog").find('#select-status option[value=1]').attr('selected','selected').trigger('change');
+					$("#import-dialog").find('#select-status').attr('disabled','disabled');
+				    }
+				    break;
+				case 3:
+				    $.ajax({
+					url: "controller.php?action="+import_url+'&from_ajax=true&selected=true',
+					success: function(msg){
+					    alert( ( ( connector.unserialize(msg)) == "ok") ? "Seu evento/tarefa foi removido " : "Ocorreu um erro ao remover o evento/tarefa" );
+					}
+				    });
+				    return;
+				    break; 
+				case 5:
+				    $.ajax({
+					url: "controller.php?action="+import_url+'&from_ajax=true&selected=true',
+					success: function(msg){
+					    alert( ( ( connector.unserialize(msg)) == "ok") ? "Seu evento/tarefa foi Atualizado com sucesso" : "Ocorreu um erro ao atualizar evento/tarefa" );
+					}
+				    });
+				    return;
+				    break; 
+				case 6:
+					var acceptedSuggestion = confirm("Deseja atualizar o evento/tarefa de acordo com a sugestão ?");
+					$.ajax({
+					    url: "controller.php?action="+import_url+'&from_ajax=true&id_user='+User.me.id+'&selected=true&cirus_delimiter='+cyrus_delimiter+'&acceptedSuggestion='+acceptedSuggestion+"&from="+document.getElementById('from_values_'+currentTab).value+'&uidAccount='+decodeOwner(),
+					    success: function(msg){
+						if(acceptedSuggestion)
+						    alert( ( ( connector.unserialize(msg)) == "ok") ? "Evento/tarefa atualizado com sucesso " : "Ocorreu um erro ao atualizar o evento" );
 						}
-						
-						switch(parseInt(typeImport)){
-						case 1:
-						case 7:
-						case 10:
-						    $("#select-agenda").html('');
-
-						    var options = '';
-
-						    if(typeImport == 10){
-							for(var i = 0; i < calendarPermission.length; i++)
-							    options += '<option value="'+calendarPermission[i]+'">'+Calendar.signatureOf[calendarPermission[i]].calendar.name+'</option>'
-						    }else{
-							for(var id in Calendar.signatures)
-							   options += parseInt(Calendar.signatures[id].isOwner) ? '<option value="'+Calendar.signatures[id].calendar.id+'">'+Calendar.signatures[id].calendar.name+'</option>' : '';							
+					});
+					return;
+					break;
+					case 9:
+					    alert('Seu evento/tarefa não possui alterações!');
+					    return;
+					    break;
+					case 11:
+					    alert('Este evento/tarefa já fora importando por algum dos particpantes e já se encontra disponível em sua agenda compartilhada!');
+					    return;
+					    break;
+					default:
+					    up = true;
+					    $("#select-agenda").css("display", "none");
+					    $("#import-dialog" ).children("p:first-child").css("display", "none");
+					    $("#import-dialog" ).dialog({
+						height: 160,
+						title: 'Atualizar Evento/Tarefa',
+						buttons: {
+						    Cancel: function() {
+							$( this ).dialog( "close" );
+						    },
+						    "Atualizar": function() {
+							$.ajax({
+							    url: "controller.php?action="+import_url+'&from_ajax=true&cirus_delimiter='+cyrus_delimiter+'&selected='+ (parseInt(typeImport) == 2 || parseInt(typeImport) == 4 ? 'true' : $("#select-agenda option:selected").val()) +'&status='+$("#select-status option:selected").val()+'&uidAccount='+decodeOwner(),
+							    success: function(msg){
+								alert( ( (msg = connector.unserialize(msg)) == "ok") ? "Atualizado com sucesso" : "Ocorreu um erro ao atualizar o evento" );
+							    }
+							});
+							$( this ).dialog( "close" );
 						    }
-						    
-						    $("#select-agenda").append(options);
-						    $("#select-agenda").css("display", "block");
-						    
-						    $("#import-dialog" ).dialog({
-							buttons: {
-							    Cancel: function() {
-								$( this ).dialog( "close" );
-							    },
-							    "Importar" : function(){
-								    $.ajax({
-									url: "controller.php?action="+import_url+'&from_ajax=true&selected='+$("#select-agenda option:selected").val()+'&status='+$("#select-status option:selected").val()+'&uidAccount='+decodeOwner(),
-									success: function(msg){
-									    var alt = ( (msg = connector.unserialize(msg)) == "ok") ? "Importado com sucesso para " : "Ocorreu um erro ao importar o evento para a agenda ";
-									    alert( alt + $("#select-agenda option:selected").text() );
-									}
-								    });
-								    $( this ).dialog( "close" );
-							    }
-							}
-							});
-
-							if(typeImport == 7){
-							    $("#import-dialog").find('#select-status option[value=1]').attr('selected','selected').trigger('change');
-							    $("#import-dialog").find('#select-status').attr('disabled','disabled');
-							}
-						    break;
-						case 3:
-							$.ajax({
-								url: "controller.php?action="+import_url+'&from_ajax=true&selected=true',
-								success: function(msg){
-									alert( ( ( connector.unserialize(msg)) == "ok") ? "Seu evento foi removido " : "Ocorreu um erro ao remover o evento" );
-								}
-							});
-							return;
-							break;	
-						case 5:
-							$.ajax({
-								url: "controller.php?action="+import_url+'&from_ajax=true&selected=true',
-								success: function(msg){
-									alert( ( ( connector.unserialize(msg)) == "ok") ? "Seu evento foi Atualizado com sucesso" : "Ocorreu um erro ao atualizar evento" );
-								}
-							});
-							return;
-							break;	
-						case 6:
-							var acceptedSuggestion = confirm("Deseja atualizar o evento de acordo com a sugestão ?");
-							$.ajax({
-								url: "controller.php?action="+import_url+'&from_ajax=true&id_user='+User.me.id+'&selected=true&cirus_delimiter='+cyrus_delimiter+'&acceptedSuggestion='+acceptedSuggestion+"&from="+document.getElementById('from_values_'+currentTab).value+'&uidAccount='+decodeOwner(),
-								success: function(msg){
-									if(acceptedSuggestion)
-										alert( ( ( connector.unserialize(msg)) == "ok") ? "Evento atualizado com sucesso " : "Ocorreu um erro ao atualizar o evento" );
-								}
-							});
-							return;
-							break;
-						case 9:
-							alert('Seu evento não possui alterações!');
-							return;
-							break;
-						case 11:
-							alert('Este evento já fora importando por algum dos particpantes e já se encontra disponível em sua agenda compartilhada!');
-							return;
-							break;
-						default:
-							up = true;
-							$("#select-agenda").css("display", "none");
-							$("#import-dialog" ).children("p:first-child").css("display", "none");
-							$("#import-dialog" ).dialog({
-								height: 160,
-								title: 'Atualizar Evento',
-								buttons: {
-									Cancel: function() {
-										$( this ).dialog( "close" );
-									},
-								   "Atualizar": function() {
-										
-										$.ajax({
-											 url: "controller.php?action="+import_url+'&from_ajax=true&cirus_delimiter='+cyrus_delimiter+'&selected='+ (parseInt(typeImport) == 2 || parseInt(typeImport) == 4 ? 'true' : $("#select-agenda option:selected").val()) +'&status='+$("#select-status option:selected").val()+'&uidAccount='+decodeOwner(),
-											 success: function(msg){
-													alert( ( (msg = connector.unserialize(msg)) == "ok") ? "Atualizado com sucesso" : "Ocorreu um erro ao atualizar o evento" );
-											}
-										});
-										$( this ).dialog( "close" );
-									}
-								},
-                                close:function(event, ui) 
-                                {
-                                    if(typeof(shortcut) != 'undefined') shortcut.disabled = false; 
-                                },
-                                open: function(event, ui) 
-                                {
-                                    if(typeof(shortcut) != 'undefined') shortcut.disabled = true; 
-                                }
-							});
-							$(".ui-dialog-buttonpane").find(".ui-button:last").children().html("Atualizar");
+						},
+						close:function(event, ui) 
+						{
+						    if(typeof(shortcut) != 'undefined') shortcut.disabled = false; 
+						},
+						open: function(event, ui) 
+						{
+						    if(typeof(shortcut) != 'undefined') shortcut.disabled = true; 
 						}
-						$( "#import-dialog" ).dialog( "open" );	
-																
-					};
-					createDialog(data, true);
-                                
-                },
-                beforeSend: function( jqXHR, settings ){
-				  	connector.showProgressBar();
-				},
-				complete: function( jqXHR, settings ){
-				  	connector.hideProgressBar();
-				}
-            });
-			
-		}
-		else
-		{
-		    if(confirm(get_lang("Do you confirm this import to your Calendar?"))){
-			cExecute( import_url + "&from_ajax=true", handler_import_calendar);
-		    }
-		}
-}
+					    });
+					    $(".ui-dialog-buttonpane").find(".ui-button:last").children().html("Atualizar");
+				    }
+				    $( "#import-dialog" ).dialog( "open" );
+                                                                                                                                   
+				};
+				createDialog(data, true);
+                                   
+			    },
+			    beforeSend: function( jqXHR, settings ){
+				connector.showProgressBar();
+			    },
+			    complete: function( jqXHR, settings ){
+				connector.hideProgressBar();
+			    }
+			});    
+                    }
+                    else
+                    {
+                        if(confirm(get_lang("Do you confirm this import to your Calendar?"))){
+                            cExecute( import_url + "&from_ajax=true", handler_import_calendar);
+                        }
+                    }
+    }
+    
 function open_msg_part(data){
 	var handler_open_msg_part = function (data)
Index: trunk/expressoMail1_2/js/draw_api.js
===================================================================
--- trunk/expressoMail1_2/js/draw_api.js	(revision 6975)
+++ trunk/expressoMail1_2/js/draw_api.js	(revision 6996)
@@ -3220,8 +3220,24 @@
 	subject.className = "header_message_field";
 	if(defaultCalendar == "expressoCalendar" && $("#expressoCalendarid")[0]){
+		var new_task_logo = document.createElement("IMG");
+		new_task_logo.title = "Criar uma nova tarefa a partir deste email.";
+		new_task_logo.alt = "Criar uma nova tarefa a partir deste email.";
+		new_task_logo.src = "./templates/default/images/big-task.png";
+		new_task_logo.style.cursor = "pointer";
+		new_task_logo.style.marginLeft = "5px";
+		new_task_logo.onclick = function(){
+		import_implements_calendar();
+		
+		
+			DataLayer.dispatchPath = "../prototype/";
+			var path = "../prototype/modules/calendar/";
+			taskDetails(decodeCreateSchedulable('task', ID), true, path, true);
+		}
+		
 		var new_event_logo = document.createElement("IMG");
 		new_event_logo.title = "Criar evento a partir deste email";
 		new_event_logo.alt = "Criar evento a partir deste email";
-		new_event_logo.src = "./templates/default/images/calendar_add.png";
+		//new_event_logo.src = "./templates/default/images/calendar_add.png";
+		new_event_logo.src = "./templates/default/images/big-event.png";
 		new_event_logo.style.cursor = "pointer";
 		new_event_logo.style.marginLeft = "5px";
@@ -3232,109 +3248,9 @@
 			DataLayer.dispatchPath = "../prototype/";
 			var path = "../prototype/modules/calendar/";
-			
-			var startEvent = new Date();  
-			if(startEvent.toString('mm') < 30) 
-				startEvent.add({minutes: (30 - parseInt(startEvent.toString('mm')))}); 
-			else 
-				startEvent.add({hours: 1, minutes: '-'+startEvent.toString('mm')}); 
-			var endEvent = function(date){ 
-				if(!!User.preferences.defaultCalendar){ 
-					return  new Date(parseInt(date.getTime()) + 
-						    (!!Calendar.signatureOf[User.preferences.defaultCalendar].calendar.defaultDuration ?  
-							(Calendar.signatureOf[User.preferences.defaultCalendar].calendar.defaultDuration * 60000) :
-							(User.preferences.defaultDuration * 60000)
-						));
-				}else 
-					return new Date(parseInt(date.getTime()) + (User.preferences.defaultDuration * 60000)); 
-			};       
-
-			var emails = $("#to_values_"+ID).val().split(',');
-			
-			
-			//Normalização dos dados evita ter que reemplementar toda as funcionalidades do calendar
-			eventDetails({ 
-					
-					acl: {inviteGuests: true, organization: true ,participationRequired: false, read: true, write: true},
-					alarms: [],
-					allDay: false,
-					attachments: [],
-					isAttendee: true,
-					attendee: '',//TODOOOOOO,
-					calendar: User.preferences.defaultCalendar ? User.preferences.defaultCalendar : Calendar.calendars[0],
-					calendars: Calendar.calendars,
-					category: '',
-					'class': '1',
-					delegatedFrom: {},
-					endDate: startEvent.toString(User.preferences.dateFormat),
-					startDate: endEvent(startEvent).toString(User.preferences.dateFormat),
-					startHour: startEvent.toString(User.preferences.hourFormat),
-					endHour: endEvent(startEvent).toString(User.preferences.hourFormat),
-					timezone: User.preferences.defaultCalendar ? Calendar.signatureOf[User.preferences.defaultCalendar].calendar.timezone : User.preferences.timezone,
-					summary : $("#subject_"+ID).text(),
-					description : $("#body_" + ID).text(),
-					startTime: startEvent.getTime(),
-					endTime: endEvent(startEvent),
-					timezones: Timezone.timezones,
-					me: {name: User.me.name, mail: User.me.mail, acl: 'rowi', status: '1', delegatedFrom: '0', id: User.me.id},
-					organizer: {name: User.me.name, mail: User.me.mail, acl: 'rowi', status: '1', delegatedFrom: '0' , id: User.me.id},
-					statusParticipants: {accepted: 0, cancelled: 0, tentative: 0, unanswered:emails.length},
-					location: '',
-					attendee: $.map(emails, function( mail ){			
-						var contact = false;
-						var decoded =  Encoder.htmlDecode(mail);
-						var newAttendeeName = "";
-
-						var name = decoded.match(/"([^"]*)"/) ? decoded.match(/"([^"]*)"/)[1] : '';
-						var mail = decoded.match(/<([^<]*)>[\s]*$/) ? decoded.match(/<([^<]*)>[\s]*$/)[1].toLowerCase() : decoded; 
-
-
-						var user = DataLayer.get('user', ["=", "mail", mail], true);
-						
-						if( $.type(user) == "array")
-						    user = user[0];
-
-						if(user != ''){
-						    //user = {name : name , mail : mail};
-						    if(User.me.mail == user.mail)
-							    return(null);
-						    user.isExternal = (!!user && !(!!user.isExternal)) ? 0 : 1;
-
-						    return  DataLayer.merge({
-							    name: user.name,
-							    mail: user.mail,
-							    acl:  'r',
-							    delegatedFrom: '0',
-							    status: '4',
-							    isExternal: user.isExternal
-						    }, !!user.id ? {id : DataLayer.put('participant', {user: user.id, isExternal: user.isExternal})} : {id: DataLayer.put('participant', {user: user})}); 
-						}else if(mail.match(/[\w-]+(\.[\w-]+)*@(([A-Za-z\d][A-Za-z\d-]{0,61}[A-Za-z\d]\.)+[A-Za-z]{2,6}|\[\d{1,3}(\.\d{1,3}){3}\])/)){
-						    
-						    var userId = DataLayer.put('user', {
-							name: name, 
-							mail: mail, 
-							isExternal: '1'
-						    });
-						    var newAttendeeId = DataLayer.put('participant', {
-							user: userId, 
-							isExternal: '1'
-						    });
-
-						    return  {
-							    id: newAttendeeId,
-							    name: name,
-							    mail: mail,
-							    acl:  'r',
-							    delegatedFrom: '0',
-							    status: '4',
-							    isExternal: '1'
-						    };
-						    
-						}else
-						    return (null);
-					})	
-					
-			}, true, path, true);
+
+			eventDetails(decodeCreateSchedulable('event', ID), true, path, true);
 		}
 		subject.appendChild(new_event_logo);
+		subject.appendChild(new_task_logo);
 	}
 	tr5.appendChild(td5);
