Index: /trunk/prototype/mapDisponibility.php
===================================================================
--- /trunk/prototype/mapDisponibility.php	(revision 5636)
+++ /trunk/prototype/mapDisponibility.php	(revision 5636)
@@ -0,0 +1,146 @@
+<?php
+
+	/**
+    * Recupera os eventos de um usuário para uso no mapa de disponibilidade
+    *
+    * @license    http://www.gnu.org/copyleft/gpl.html GPL
+    * @author     Consórcio Expresso Livre - 4Linux (www.4linux.com.br) e Prognus Software Livre (www.prognus.com.br)
+    * @sponsor    Caixa Econômica Federal
+    * @author     Adriano Coutinho da Silva
+    * @return     Array de objetos com os eventos mergedos indexados por id de usuário
+    * @access     public
+    */
+
+	//TODO -  Teste Remover comentario
+	$data = $_GET;
+
+	require_once "api/controller.php";
+
+	if(isset($data)){
+		
+		$users = $data['attendees'];
+		
+		$disponibility = array();
+		
+		foreach($users as $key => $value){
+		/*	
+
+			 SELECT * FROM  
+				calendar_object as co inner join
+				calendar_to_calendar_object as ctco on
+				ctco.calendar_object_id = co.id
+				WHERE (range_start >=  1331434800000 AND range_end <= 1332039600000) AND 
+				ctco.calendar_id IN(5)
+			
+			 SELECT * FROM  
+				calendar_object WHERE (range_start >=  1331434800000 AND range_end <= 1332039600000 AND id IN 
+				( SELECT calendar_object_id from calendar_to_calendar_object where calendar_id IN (5)  ))
+		*/
+			
+			
+			
+			$sql = 'SELECT calendar_object.range_start as "startTime" , calendar_object.range_end as "endTime", calendar_object.allday as "allDay" FROM calendar_object WHERE (range_start >=  '.$data['startTime']
+			.' AND range_end <= '.$data['endTime'].' AND transp = 0  AND id IN ( SELECT calendar_object_id from calendar_to_calendar_object where '
+			.'calendar_id IN (SELECT calendar_id FROM calendar_signature WHERE (user_uidnumber = '. $value['id'] .'  AND is_owner = 1 ))  ))';
+
+			$result = Controller::service('PostgreSQL')->execResultSql($sql);
+		
+			if(!count($result))
+				continue;		
+			
+			$disponibilyUser = array();
+		
+			foreach($result as $ke => $va){
+			
+			array_push($disponibilyUser, array('startTime' => $va['startTime'], 'endTime' => $va['endTime'], 'allDay' => $va['allDay']));
+
+			/* 
+			*
+			* A implementação abaixo une eventos que convergem os horários
+			*
+			
+				if(count($disponibilyUser) == 0){
+					array_push($disponibilyUser, array('startTime' => $va['startTime'], 'endTime' => $va['endTime']));
+					continue;
+				}
+
+				$action = 'new';
+				$position = '0';
+				
+				foreach($disponibilyUser as $k => $v){
+					
+					if($v['startTime'] >= $va['startTime']){
+						
+						if($v['startTime'] > $va['endTime'])
+							continue;
+						
+						else if(($v['endTime'] <= $va['endTime'])){
+							$action = 'delete';
+
+						}else if(($v['endTime'] > $va['endTime'])){
+
+							$action = 'afterUpdate';
+					
+
+						}
+					}else if($v['startTime'] <= $va['startTime']){
+						
+						if($v['endTime'] < $va['startTime'])
+							continue;
+						
+						else if($v['endTime'] >= $va['endTime']){
+						
+							$action = 'update';
+
+						
+						}else
+							$action = 'afterUpdate';
+					
+					}
+
+					$position = $k;
+				}
+			
+				switch($action){
+					case 'new':
+						array_push($disponibilyUser, array('startTime' => $va['startTime'], 'endTime' => $va['endTime']));
+					break;
+					
+					case 'update':
+
+						$disponibilyUser[$position]['startTime'] = $v['startTime'];
+						$disponibilyUser[$position]['endTime'] = $v['endTime'];
+					
+					break;
+					
+					case 'beforeUpdate':
+					
+						$disponibilyUser[$position]['startTime'] = $v['startTime'];
+					
+					break;
+					
+					case 'afterUpdate':
+					
+						$disponibilyUser[$position]['endTime'] = $v['endTime'];
+					
+					break;
+					
+					case 'delete':
+					break;
+				}
+	*/		
+			}
+
+		$disponibility[$value['id']] = $disponibilyUser;
+
+		 unset($disponibilyUser);
+	
+		}	
+		echo json_encode($disponibility);
+
+	}else{
+
+		return json_encode(array('false'));
+	}
+
+?>
Index: /trunk/prototype/modules/calendar/interceptors/DBMapping.php
===================================================================
--- /trunk/prototype/modules/calendar/interceptors/DBMapping.php	(revision 5615)
+++ /trunk/prototype/modules/calendar/interceptors/DBMapping.php	(revision 5636)
@@ -123,10 +123,22 @@
 
     public function encodeUpdateSchedulable( &$uri , &$params , &$criteria , $original ){	
-        if(isset($params['startTime']))
-	       	$params['rangeStart'] = $params['startTime'] ;
-	if(isset($params['endTime']))
-   		$params['rangeEnd'] = $params['endTime'] ;       
-        	
-                
+	
+		$event = Controller::find( array( 'concept' => 'schedulable' , array('timezone') ,'id' => $params['id'] ) );	
+		
+		if(isset($params['startTime'])){
+			
+			if(!is_numeric($params['startTime']) )
+				$params['startTime'] =  strtotime( $params['startTime'] . ' ' .$event['timezone']).'000';
+			else
+				$params['rangeStart'] = $params['startTime'] ;
+		   
+		}if(isset($params['endTime'])){
+			
+			if (!is_numeric($params['endTime']))
+				$params['endTime'] =   strtotime( $params['endTime'] . ' ' .$event['timezone']).'000';
+			else
+				$params['rangeEnd'] = $params['endTime'] ;       
+				
+		}    
      }        
      
Index: /trunk/prototype/modules/calendar/interceptors/Helpers.php
===================================================================
--- /trunk/prototype/modules/calendar/interceptors/Helpers.php	(revision 5615)
+++ /trunk/prototype/modules/calendar/interceptors/Helpers.php	(revision 5636)
@@ -4,5 +4,5 @@
 
     public static function futureEvent( $startTime , $rangeEnd )
-    {
+    {	
         //Verifica data  
 		$range = new DateTime( '@'.(int)($rangeEnd / 1000) , new DateTimeZone('UTC') );
Index: /trunk/prototype/modules/calendar/css/style.css
===================================================================
--- /trunk/prototype/modules/calendar/css/style.css	(revision 5592)
+++ /trunk/prototype/modules/calendar/css/style.css	(revision 5636)
@@ -437,3 +437,14 @@
 
 
-
+.map-event{
+	border-style: dashed;
+	border-width: 2px;
+	border-color: #36C;
+	background-color: transparent;
+	color: black;
+}
+
+
+#new_event_map .fc-event-head.fc-event-skin,.fc-event-inner.fc-event-skin{
+	border-color: transparent;
+}
Index: /trunk/prototype/modules/calendar/js/calendar.codecs.js
===================================================================
--- /trunk/prototype/modules/calendar/js/calendar.codecs.js	(revision 5617)
+++ /trunk/prototype/modules/calendar/js/calendar.codecs.js	(revision 5636)
@@ -434,6 +434,6 @@
 			return {
 				participant : meAttendee(form.attendee), 
-				startTime: Date.parseExact(form.startDate + (!!form.allDay ? " 00:00": " "+$.trim(form.startHour)) , formatString ).toString('yyyy-MM-dd hh:mm:00'),
-				endTime:  Date.parseExact(form.endDate + ( !!form.allDay ? " 00:00": " "+$.trim(form.endHour)), formatString ).toString('yyyy-MM-dd hh:mm:00'),
+				startTime: Date.parseExact(form.startDate + (!!form.allDay ? " 00:00": " "+$.trim(form.startHour)) , formatString ).toString('yyyy-MM-dd HH:mm:00'),
+				endTime:  Date.parseExact(form.endDate + ( !!form.allDay ? " 00:00": " "+$.trim(form.endHour)), formatString ).toString('yyyy-MM-dd HH:mm:00'),
 				allDay: ( !!form.allDay ? 1 : 0 ),
 				schedulable: form.idEvent
@@ -521,6 +521,6 @@
 									participant: me.id,
 									type: 'suggestion',
-									startTime: Date.parseExact(form.startDate + (!!form.allDay ? " 00:00": " "+$.trim(form.startHour)) , formatString ).toString('yyyy-MM-dd hh:mm:00'),
-									endTime:  Date.parseExact(form.endDate + ( !!form.allDay ? " 00:00": " "+$.trim(form.endHour)), formatString ).toString('yyyy-MM-dd hh:mm:00'),
+									startTime: Date.parseExact(form.startDate + (!!form.allDay ? " 00:00": " "+$.trim(form.startHour)) , formatString ).toString('yyyy-MM-dd HH:mm:00'),
+									endTime:  Date.parseExact(form.endDate + ( !!form.allDay ? " 00:00": " "+$.trim(form.endHour)), formatString ).toString('yyyy-MM-dd HH:mm:00'),
 									allDay: ( !!form.allDay ? 1 : 0 ),
 									schedulable: form.idEvent
@@ -673,6 +673,6 @@
 		    return {
 			      "class": form["class"],
-				  startTime: Date.parseExact(form.startDate + (!!form.allDay ? " 00:00": " "+$.trim(form.startHour)) , formatString ).toString('yyyy-MM-dd hh:mm:00'),
-				  endTime:  Date.parseExact(form.endDate + ( !!form.allDay ? " 00:00": " "+$.trim(form.endHour)), formatString ).toString('yyyy-MM-dd hh:mm:00'),  //+ (!!form.allDay ? 86400000 : 0) ,
+				  startTime: Date.parseExact(form.startDate + (!!form.allDay ? " 00:00": " "+$.trim(form.startHour)) , formatString ).toString('yyyy-MM-dd HH:mm:00'),
+				  endTime:  Date.parseExact(form.endDate + ( !!form.allDay ? " 00:00": " "+$.trim(form.endHour)), formatString ).toString('yyyy-MM-dd HH:mm:00'),  //+ (!!form.allDay ? 86400000 : 0) ,
 				  allDay: ( !!form.allDay ? 1 : 0 ),
 			      id: form.idEvent,
Index: /trunk/prototype/modules/calendar/js/map.disponibility.js
===================================================================
--- /trunk/prototype/modules/calendar/js/map.disponibility.js	(revision 5636)
+++ /trunk/prototype/modules/calendar/js/map.disponibility.js	(revision 5636)
@@ -0,0 +1,180 @@
+function getColorAttendee(keyColor){
+	
+	var colors = ['#3b7847', '#98993d' , '#130aff' , '#d95a0d', '#d9990d', '#8cd90d', '#0dd9b9', '#123456', '#000000', '#5f04c3', '#c3043a', '#faa26b', '#cee4d1',  '#adadad', '#707070'];
+	
+	return  colors[keyColor % 15] ;
+	
+}
+
+
+function updateMap(data){
+	var start_date = $(".new-event-win.active .start-date").val();
+	var end_date   = $(".new-event-win.active .end-date").val();
+	var start_time = $(".new-event-win.active .start-time").val();
+	var end_time   = $(".new-event-win.active .end-time").val();
+	var isAllDay   = $('.new-event-win.active input[name="allDay"]').is(':checked');
+	
+	var formatString = (isAllDay)? User.preferences.dateFormat+" HH:mm" : User.preferences.dateFormat + " " + User.preferences.hourFormat;
+	
+	var startDate = Date.parseExact( isAllDay ? start_date+ " 00:00": start_date + " " + $.trim(start_time) , formatString );
+	var endDate = Date.parseExact( isAllDay ? end_date+ " 00:00": end_date + " " + $.trim(end_time) , formatString );
+	
+	
+	var event = $("#new_event_map").fullCalendar('clientEvents', 'map')[0];
+	
+	
+		if(!!event){	
+			event.start = startDate;
+			event.end = endDate;
+			event.allDay = isAllDay;
+			$("#new_event_map").fullCalendar( 'updateEvent', event )
+		}
+		
+		
+}
+
+
+function disponibily(objEvent, path, attendees){
+	var formatString = (objEvent.allDay)? User.preferences.dateFormat+" HH:mm" : User.preferences.dateFormat + " " + User.preferences.hourFormat;
+	var startDate = Date.parseExact( objEvent.allDay ? objEvent.startDate+ " 00:00": objEvent.startDate + " " + $.trim(objEvent.startHour) , formatString );
+	var endDate = Date.parseExact( objEvent.allDay ? objEvent.endDate+ " 00:00": objEvent.endDate + " " + $.trim(objEvent.endHour) , formatString );
+	 
+	var mapHtml = DataLayer.render( path+'templates/availability_map.ejs', {});
+	$("#calendar_addevent_details7").html(mapHtml);
+	$("#new_event_map").fullCalendar(DataLayer.merge({
+		height : 300,
+		timeFormat: {
+			agenda: 'HH:mm{ - HH:mm}',
+			'': 'HH:mm{ - HH:mm} }'
+		},
+		axisFormat: User.preferences.hourFormat,
+		firstDay: dateCalendar.dayOfWeek[User.preferences.weekStart],
+		editable: false,
+		selectable: true,
+		selectHelper: false,
+		droppable: false,
+		allDayText: 'Dia todo',
+		buttonText: {
+			today: 'hoje'
+		},
+		titleFormat: {
+			month: 'MMMM yyyy',                             
+			week: "dd[ yyyy] { 'a'[ MMM] dd 'de' MMMM '-' yyyy}", 
+			day: 'dddd,  dd MMM , yyyy'
+		},
+		columnFormat:{
+			month: 'ddd',    
+			week: 'ddd dd/MM', 
+			day: 'dddd dd/MM'  
+		},
+		select: function( start, end, allDay, event, view ){
+		
+			var event2 = $("#new_event_map").fullCalendar('clientEvents', 'map')[0];
+			event2.start = start;
+			event2.end = end;
+			event2.allDay = allDay;
+			$("#new_event_map").fullCalendar( 'updateEvent', event2 );
+			
+			$('[name="startDate"]').val(start.toString("dd/MM/yyyy"));
+			$('[name="endDate"]').val(end.toString("dd/MM/yyyy"));
+			if(!allDay){
+				$('[name="allDay"]').attr("checked", false); 
+				UI.dialogs.addEvent.find('.start-time, .end-time').removeClass('hidden');
+				
+				$('[name="startHour"]').val(start.toString("HH:mm"));
+				if(end){
+					$('[name="endHour"]').val(end.toString("HH:mm"));
+				}
+			}else{
+				$('[name="allDay"]').attr("checked", true); 
+				UI.dialogs.addEvent.find('.start-time, .end-time').addClass('hidden');
+			}
+		},
+		events: [
+			{
+				id : 'map',
+				title: 'Disponibilidade',
+				start: startDate,
+				end: endDate,
+				editable : true,
+				allDay : (objEvent.allDay ? true : false),
+				className : "map-event",
+				backgroundColor : "transparent !important"
+			}
+		],
+		eventDrop : function(event,dayDelta,minuteDelta,allDay,revertFunc){
+			if(event.allDay){
+				$('[name="allDay"]').attr("checked", true); 
+				UI.dialogs.addEvent.find('.start-time, .end-time').addClass('hidden');
+				$('[name="startDate"]').val(event.start.toString("dd/MM/yyyy"));
+				if(event.end)
+					$('[name="endDate"]').val(event.end.toString("dd/MM/yyyy"));
+				else
+					$('[name="endDate"]').val(event.start.toString("dd/MM/yyyy"));
+				return;
+			}else{
+				$('[name="allDay"]').attr("checked", false); 
+				UI.dialogs.addEvent.find('.start-time, .end-time').removeClass('hidden');
+			}
+			$('[name="startHour"]').val(event.start.toString("HH:mm"));
+			$('[name="startDate"]').val(event.start.toString("dd/MM/yyyy"));
+			if(event.end){
+				$('[name="endHour"]').val(event.end.toString("HH:mm"));
+				$('[name="endDate"]').val(event.end.toString("dd/MM/yyyy"));
+			}else
+				$('[name="endDate"]').val(event.start.toString("dd/MM/yyyy"));
+		},
+		eventResize: function(event,dayDelta,minuteDelta,revertFunc) {
+			if(event.end){
+				$('[name="endHour"]').val(event.end.toString("HH:mm"));
+				$('[name="endDate"]').val(event.end.toString("dd/MM/yyyy"));
+			}else
+				$('[name="endDate"]').val(event.start.toString("dd/MM/yyyy"));
+				
+		},
+		defaultView : "agendaWeek"
+	}, dateCalendar));
+	var eventSource = new Array();
+	var updateMapView = function(){
+		updateMap();
+		var view = $("#new_event_map").fullCalendar('getView');
+		var map = {};
+		$("#new_event_map").fullCalendar( 'removeEventSource', eventSource );
+		eventSource = new Array();	
+		map = {startTime : view.start.getTime(), endTime : view.end.getTime(), attendees: {}, timezone: (objEvent.timezone || User.preferences.timezone)};
+		map.attendees[User.me.id] = {id : User.me.id, name : User.me.name};
+		var count = 0;
+		for (var idAttendee in attendees){
+			if(attendees[idAttendee]){
+				map.attendees[idAttendee] = {id : idAttendee, name : attendees[idAttendee], color: getColorAttendee(count)};
+				count++;
+			}
+		}
+		map_events = DataLayer.dispatch("mapDisponibility", map, false, false);
+		for(var map_attende in map_events){
+			for(var event_by_attende in map_events[map_attende]){
+				eventSource.push(
+				{
+					id : "map_busy_events", 
+					title : map.attendees[map_attende].name,
+					start: new Date(parseInt(map_events[map_attende][event_by_attende].startTime)),
+					end: new Date(parseInt(map_events[map_attende][event_by_attende].endTime)),
+					editable : false,
+					allDay : !!parseInt(map_events[map_attende][event_by_attende].allDay),
+					backgroundColor : map.attendees[map_attende].color + " !important",
+					borderColor : map.attendees[map_attende].color + " !important"
+				});
+			}
+		}
+		if(eventSource.length)
+			$("#new_event_map").fullCalendar( 'addEventSource', eventSource );
+	}; 
+	$('[href="#calendar_addevent_details7"]').click(function(eventData, eventObject){
+		$("#new_event_map").fullCalendar( 'gotoDate', Date.parseExact($('[name="startDate"]').val() + " " + $.trim($('[name="startHour"]').val()), formatString) , formatString);
+		//if(eventObject == undefined)
+			updateMapView();
+	});	
+	$("#new_event_map").find(".fc-button-prev, .fc-button-next, .fc-button-today").click(function(){
+		updateMapView();
+	});
+}
Index: /trunk/prototype/modules/calendar/js/helpers.js
===================================================================
--- /trunk/prototype/modules/calendar/js/helpers.js	(revision 5615)
+++ /trunk/prototype/modules/calendar/js/helpers.js	(revision 5636)
@@ -61,4 +61,6 @@
 function eventDetails( objEvent, decoded, path, isMail)
 {
+	attendees = {};
+
 	if(path == undefined)
 		path = "";
@@ -93,7 +95,5 @@
 		'p': 'acl-participation-required'
 	};
-	/**
-	* callback de participantes generico
-	*/
+	
 	var callbackAttendee = function(){
 		//Cria qtip de permissões pelo click do checkbox
@@ -298,4 +298,6 @@
 					if ($('dd.attendee-list li:last').data('qtip'))
 						$('dd.attendee-list li:last').qtip('destroy');
+						
+					attendees  = {};
 
 				},
@@ -418,4 +420,5 @@
 				UI.dialogs.addEvent.find('.start-time, .end-time').addClass('hidden') :
 			    UI.dialogs.addEvent.find('.start-time, .end-time').removeClass('hidden'); 
+			updateMap(true);
 	    });
 
@@ -430,5 +433,9 @@
 	    UI.dialogs.addEvent.find(".input-group .h1").Watermark("Evento sem título");
 		if(User.preferences.hourFormat.length == 5) {
-			UI.dialogs.addEvent.find(".end-time, .start-time").mask("99:99");
+			UI.dialogs.addEvent.find(".end-time, .start-time").mask("99:99", {
+				completed: function(){
+					updateMap();
+				}
+			});
 		} else {
 			$.mask.definitions['{']='[ap]';
@@ -439,4 +446,5 @@
 					$(this).timepicker("refresh");
 					$(this).val($(this).val().replace(/[\.]/gi, ""));
+					updateMap();
 				}
 			});
@@ -444,6 +452,14 @@
 		UI.dialogs.addEvent.find(".number").numeric();
 		User.preferences.dateFormat.indexOf('-') > 0 ? 
-			UI.dialogs.addEvent.find(".date").mask("99-99-9999") :
-			UI.dialogs.addEvent.find(".date").mask("99/99/9999");
+			UI.dialogs.addEvent.find(".date").mask("99-99-9999", {
+				completed:function(){
+					updateMap();
+				}
+			}) : 
+			UI.dialogs.addEvent.find(".date").mask("99/99/9999", {
+				completed:function(){
+					updateMap();
+				}
+			});
 
 	    UI.dialogs.addEvent.find(".menu-addevent")
@@ -485,22 +501,28 @@
 	    });
 
-	    UI.dialogs.addEvent.find('input.date').datepicker({dateFormat: 'dd/mm/yy'});
-		if(path == ""){
-			UI.dialogs.addEvent.find('input.time').timepicker({ 
-				closeText: 'Ok',
-				hourGrid: 4,
-				minuteGrid: 10,
-				ampm : ((User.preferences.hourFormat.length > 5) ? true: false),
-				timeFormat: "hh:mm tt",
-				onSelect: function (selectedDateTime){
-					if(!(User.preferences.hourFormat.length == 5))
-						$(this).val(selectedDateTime.replace(/[\.]/gi, ""));								
-				},
-				onClose : function (selectedDateTime){
-					if(!(User.preferences.hourFormat.length == 5))
-						$(this).val(selectedDateTime.replace(/[\.]/gi, ""));
-				}
-			});
-		}
+		var dates = UI.dialogs.addEvent.find('input.date').datepicker({
+			dateFormat: 'dd/mm/yy',
+			onSelect : function( selectedDate ){
+				updateMap();
+			}
+		});
+		//if(path == ""){
+		UI.dialogs.addEvent.find('input.time').timepicker({ 
+			closeText: 'Ok',
+			hourGrid: 4,
+			minuteGrid: 10,
+			ampm : ((User.preferences.hourFormat.length > 5) ? true: false),
+			timeFormat: "hh:mm tt",
+			onSelect: function (selectedDateTime){
+				if(!(User.preferences.hourFormat.length == 5))
+					$(this).val(selectedDateTime.replace(/[\.]/gi, ""));								
+				updateMap();
+			},
+			onClose : function (selectedDateTime){
+				if(!(User.preferences.hourFormat.length == 5))
+					$(this).val(selectedDateTime.replace(/[\.]/gi, ""));
+			}
+		});
+		//}
 
 	    UI.dialogs.addEvent.find('.button-add-alarms').click(function(){
@@ -598,6 +620,7 @@
 					 */
 
-					var user = DataLayer.get('user', ["=", "mail", $(this).val()], true);
-					
+					var user = DataLayer.get('user', ["=", "mail", $(this).val()]);
+					if(user[0].id)
+						attendees[user[0].id].name  = user[0].name;
 					
 					/**
@@ -824,4 +847,7 @@
 							old_item = $(event.target).parents('li');
 							newAttendeeId = DataLayer.put('participant', {user: old_item.find('.id').html(), isExternal: 0});
+							
+							attendees[old_item.find('.id').html()] = old_item.find('.name').html();
+							
 							blkAddAtendee.find('dd.attendee-list ul.attendee-list')
 							.append(DataLayer.render(path+'templates/participants_add_itemlist.ejs', [{id: newAttendeeId, name: old_item.find('.name').html(), mail: old_item.find('.mail').html(), isExternal: 0, acl: objEvent.acl}]))
@@ -1034,5 +1060,24 @@
 		progressTimer = window.setInterval(intervalHandler, interval);
 	});
-		
+	
+	if(objEvent.isShared){
+		
+		var acls = Calendar.signatureOf[objEvent.calendar].permission.acl;
+		
+		if(!acls.write){
+			UI.dialogs.addEvent.find(':input').attr('disabled', 'disabled');
+			UI.dialogs.addEvent.find('.button').hide();
+		}
+		
+		if(acls.remove)
+			UI.dialogs.addEvent.find('.button.remove').show();
+		
+		UI.dialogs.addEvent.find('.button.cancel').show();
+		
+	
+	}
+
+	disponibily(objEvent, path, attendees);
+	 
 	UI.dialogs.addEvent.find(':input').change(function(event){
 		if (event.keyCode != '27' && event.keyCode != '13')
@@ -1042,24 +1087,8 @@
 			canDiscardEventDialog = false;
 	});	
-	
-	if(objEvent.isShared){
-		
-		var acls = Calendar.signatureOf[objEvent.calendar].permission.acl;
-		
-		if(!acls.write){
-			UI.dialogs.addEvent.find(':input').attr('disabled', 'disabled');
-			UI.dialogs.addEvent.find('.button').hide();
-		}
-		
-		if(acls.remove)
-			UI.dialogs.addEvent.find('.button.remove').show();
-		
-		UI.dialogs.addEvent.find('.button.cancel').show();
-		
-	
-	}
-	
-		
+
 	UI.dialogs.addEvent.dialog('open');
+	//$('[href="#calendar_addevent_details7"]').trigger('click');
+	//$('[href="#calendar_addevent_details2"]').trigger('click');
 }
 
@@ -1332,5 +1361,4 @@
 					refresh_calendars();
 				});
-				
 			}).end().filter('.cancel').click(function(evt){
 				$tabs.tabs( "remove", "#configure_tab");
@@ -1428,6 +1456,5 @@
 				if(idCalendar == User.preferences.defaultCalendar)
 					DataLayer.remove( 'modulePreference', User.preferenceIds['defaultCalendar']);
-					
-					
+			
 				DataLayer.commit( false, false, function( received ){
 					delete Calendar.currentViewKey;
@@ -1540,5 +1567,4 @@
 					borderColor: colorsSuggestions[selected]['border'].substring(1)
 				});
-				
 				DataLayer.commit( false, false, function( received ){
 					delete Calendar.currentViewKey;
@@ -1546,5 +1572,4 @@
 					refresh_calendars();
 				});
-				
 				meu_container.find(".button.new").qtip('destroy');
 			});
@@ -1979,4 +2004,5 @@
 		delete schedulable.repeat;
 	
+
 		schedulable.calendar = DataLayer.copy(calendar);	
 	
@@ -1985,5 +2011,4 @@
 		
 		var participants = DataLayer.copy(schedulable.participants);
-		
 		delete schedulable.participants;
 		
@@ -1996,11 +2021,12 @@
 	
 			delete participant.id;
-			delete participant.schedulable;
-			delete participant.delegatedFrom;
 			
 			return participant ;
         });
 	
-		DataLayer.put('schedulable', newSchedulable);		
+	
+	
+		DataLayer.put('schedulable', newSchedulable);
+
 	}
 	
Index: /trunk/prototype/modules/calendar/templates/availability_map.ejs
===================================================================
--- /trunk/prototype/modules/calendar/templates/availability_map.ejs	(revision 5636)
+++ /trunk/prototype/modules/calendar/templates/availability_map.ejs	(revision 5636)
@@ -0,0 +1,4 @@
+<fieldset id="availability_map" class="tab-level2">
+	<div id="new_event_map" class="map" style="width : 100%;">
+	</div>
+</fieldset>
Index: /trunk/prototype/modules/calendar/templates/index.ejs
===================================================================
--- /trunk/prototype/modules/calendar/templates/index.ejs	(revision 5592)
+++ /trunk/prototype/modules/calendar/templates/index.ejs	(revision 5636)
@@ -84,4 +84,5 @@
 <script type='text/javascript' src='<?= MODULESURL ?>/js/calendar.date.js'></script>
 
+<script type='text/javascript' src='<?= MODULESURL ?>/js/map.disponibility.js'></script>
 <script type='text/javascript' src='<?= MODULESURL ?>/js/helpers.js'></script>
 <script type='text/javascript' src='<?= MODULESURL ?>/js/calendar.shared.js'></script>
Index: /trunk/prototype/modules/calendar/templates/event_add.ejs
===================================================================
--- /trunk/prototype/modules/calendar/templates/event_add.ejs	(revision 5592)
+++ /trunk/prototype/modules/calendar/templates/event_add.ejs	(revision 5636)
@@ -53,4 +53,5 @@
 		<li><a href="#calendar_addevent_details5">Anexos</a></li>
 		<li><a href="#calendar_addevent_details6">Participantes</a></li>
+		<li><a href="#calendar_addevent_details7">Disponibilidade</a></li>
 	</ul>
 	<fieldset id="calendar_addevent_details2" class="tab-level2">
@@ -146,6 +147,8 @@
 	</fieldset>
 	<fieldset id="calendar_addevent_details6" class="tab-level2" title="Participantes">
-	</fieldset>
-	
+	</fieldset>	
+	
+	<fieldset id="calendar_addevent_details7" class="tab-level2" title="Disponibilidade">
+	</fieldset>
 	
 	<fieldset class="attachment-list hidden">
Index: /trunk/expressoMail1_2/index.php
===================================================================
--- /trunk/expressoMail1_2/index.php	(revision 5622)
+++ /trunk/expressoMail1_2/index.php	(revision 5636)
@@ -28,4 +28,9 @@
 	//jquery and Editor 
  	        echo '  			
+				<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>
+				<link rel="stylesheet" type="text/css" href="../prototype/plugins/icalendar/jquery.icalendar.css"></link>
+			
+			
 					<link rel="Stylesheet" type="text/css" href="templates/default/expressoMail_reset.css" />
 					<script type="text/javascript" src="../prototype/plugins/jquery/jquery.min.js"></script>
@@ -56,4 +61,5 @@
 					<link rel="stylesheet" type="text/css" href="../prototype/plugins/zebradialog/css/zebra_dialog.css"></link>
 					<link rel="stylesheet" type="text/css" href="../prototype/plugins/fileupload/jquery.fileupload-ui.css"></link>
+					
 					<link rel="stylesheet" href="../prototype/plugins/farbtastic/farbtastic.css" type="text/css" >
 					<script type="text/javascript" src="../prototype/plugins/zebradialog/javascript/zebra_dialog.js"></script>
Index: /trunk/expressoMail1_2/templates/default/expressoMail_reset.css
===================================================================
--- /trunk/expressoMail1_2/templates/default/expressoMail_reset.css	(revision 5592)
+++ /trunk/expressoMail1_2/templates/default/expressoMail_reset.css	(revision 5636)
@@ -8,5 +8,5 @@
  * http://meyerweb.com/eric/thoughts/2007/05/01/reset-reloaded/
  */
-
+/*
 .new-event-win.active applet, .new-event-win.active object, .new-event-win.active iframe, .new-event-win.active fieldset, .new-event-win.active div
 .new-event-win.active h1, .new-event-win.active h2, .new-event-win.active h3, .new-event-win.active h4, .new-event-win.active h5, .new-event-win.active h6, .new-event-win.active p, .new-event-win.active blockquote, .new-event-win.active pre,
@@ -27,6 +27,5 @@
 	/*vertical-align: baseline;*/
 /*	font-family: Arial,Helvetica,sans-serif;*/
-}
-
+/*}*/
 .new-event-win.active:focus {
 	outline: 0;
@@ -114,4 +113,32 @@
 	border: 0;
 }
+
+.new-event-win.active .fc-event-skin {
+	border-color: #36C !important;
+	background-color: #36C !important; 
+	color: white !important;
+}
+
+.fc-event-vert .fc-event-bg {
+	display: block !important;
+}
+
+.map-event{
+
+}
+
+#new_event_map .map-event .fc-event-inner.fc-event-skin{
+	border-style: dashed !important;
+	border-width: 2px !important;
+	border-color: #36C !important;
+	background-color: transparent !important;
+}
+
+ #new_event_map .map-event .fc-event-inner.fc-event-skin .fc-event-head{
+	background-color: transparent !important;
+	color: transparent !important;
+}
+
+
 /*#divAppbox
 { background: #fff url( ../images/bgBlockContent.jpg ) repeat-x; border-color: #9c9c9c; }
Index: /trunk/expressoMail1_2/js/main.js
===================================================================
--- /trunk/expressoMail1_2/js/main.js	(revision 5626)
+++ /trunk/expressoMail1_2/js/main.js	(revision 5636)
@@ -3230,11 +3230,14 @@
 		
 		//$.ajax({ url: "../expressoCalendar/index.php", async: false});
-		$.ajax({url: "../prototype/modules/calendar/js/calendar.date.js", async: false});
-		$.ajax({url: "../prototype/modules/calendar/js/helpers.js", async: false});
+		$.ajax({url: "../prototype/modules/calendar/js/calendar.date.js", async: false, beforeSend: function( xhr ) { xhr.overrideMimeType('text/javascript; charset=ISO-8859-1')}});
+		$.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/timezone.js", async: false});
 		//$.ajax({ url: "../prototype/modules/calendar/js/calendar.codecs.js", async: false});
-		$.ajax({url: "../prototype/plugins/encoder/encoder.js", async: false});
-		$.ajax({url: "../prototype/plugins/dateFormat/dateFormat.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/dateFormat/dateFormat.js", async: false, beforeSend: function( xhr ) { xhr.overrideMimeType('text/javascript; charset=ISO-8859-1')}});
+
+		$.ajax({ url: "../prototype/plugins/fullcalendar/fullcalendar.js", async: false , beforeSend: function( xhr ) { xhr.overrideMimeType('text/javascript; charset=ISO-8859-1')}});
+		
 		
 		DataLayer.dispatchPath = "../prototype/";	
