Index: trunk/expressoCalendar/setup/phpgw_pt-br.lang
===================================================================
--- trunk/expressoCalendar/setup/phpgw_pt-br.lang	(revision 632)
+++ trunk/expressoCalendar/setup/phpgw_pt-br.lang	(revision 665)
@@ -1,3 +1,4 @@
 %1 %2 in %3	calendar	pt-br	%1 %2 em %3
+%1 of %2	calendar	pt-br	%1 de %2
 %1 matches found	calendar	pt-br	%1 ocorrências encontradas
 1 match found	calendar	pt-br	1 ocorrência encontrada
@@ -138,4 +139,5 @@
 firstname of person to notify	calendar	pt-br	Primeiro nome da pessoa a ser notificada
 format of event updates	calendar	pt-br	Formato de atualizção de eventos
+event updated successfully	calendar	pt-br	Evento autualizado com sucesso
 (for weekly)	calendar	pt-br	(por semana)
 Fr	calendar	pt-br	Se
@@ -339,4 +341,5 @@
 text	calendar	pt-br	Texto
 th	calendar	pt-br	Qu
+cancel	calendar	pt-br	Cancelar
 The commitment was accepted successfully!	calendar	pt-br	O compromisso foi aceito com sucesso!
 The commitment was rejected successfully!	calendar	pt-br	O compromisso foi rejeitado com sucesso!
Index: trunk/expressoCalendar/xsl/viewMonth.xsl
===================================================================
--- trunk/expressoCalendar/xsl/viewMonth.xsl	(revision 632)
+++ trunk/expressoCalendar/xsl/viewMonth.xsl	(revision 665)
@@ -30,18 +30,4 @@
 	</table>
 </div>
-<div id="returnEvents">
-	<xsl:for-each select="calEvent">
-		<xsl:variable name="event_id" select="id" />
-		<xsl:variable name="datetime" select="datetime" />
-		<xsl:variable name="edatetime" select="edatetime" />
-		<xsl:if test="id > 0">
-			<div id="event_{$event_id}">
-				<div id="{$datetime}"></div>
-				<div id="{$edatetime}"></div>
-				<xsl:value-of select='title' />
-			</div>
-		</xsl:if>
-	</xsl:for-each>
-</div>
 </xsl:template>
 </xsl:stylesheet>
Index: trunk/expressoCalendar/xsl/viewWeek.xsl
===================================================================
--- trunk/expressoCalendar/xsl/viewWeek.xsl	(revision 632)
+++ trunk/expressoCalendar/xsl/viewWeek.xsl	(revision 665)
@@ -39,20 +39,4 @@
 </table>	
 </div>
-<div id="returnEvents">
-	<xsl:for-each select="calEvent">
-		<xsl:variable name="event_id" select="id" />
-		<xsl:variable name="datetime" select="datetime" />
-		<xsl:variable name="edatetime" select="edatetime" />
-		<xsl:if test="id > 0">
-			<div id="event_{$event_id}">
-				<div id="{$datetime}"></div>
-				<div id="{$edatetime}"></div>
-				<xsl:value-of select='title' />
-				<br/>
-				<xsl:value-of select='description' />
-			</div>
-		</xsl:if>
-	</xsl:for-each>
-</div>
 </xsl:template>
 </xsl:stylesheet>
Index: trunk/expressoCalendar/xsl/viewDay.xsl
===================================================================
--- trunk/expressoCalendar/xsl/viewDay.xsl	(revision 656)
+++ trunk/expressoCalendar/xsl/viewDay.xsl	(revision 665)
@@ -21,20 +21,4 @@
 </table>
 </div>
-<div id="returnEvents">
-<xsl:for-each select="calEvent">
-	<xsl:variable name="event_id" select="id" />
-	<xsl:variable name="datetime" select="datetime" />
-	<xsl:variable name="edatetime" select="edatetime" />
-		<xsl:if test="id > 0">
-			<div id="event_{$event_id}">
-				<div id="{$datetime}"></div>
-				<div id="{$edatetime}"></div>
-				<xsl:value-of select='title' />
-				<br/>
-				<xsl:value-of select='description' />
-			</div>
-		</xsl:if>
-</xsl:for-each>
-</div>
 </xsl:template>
 </xsl:stylesheet>
Index: trunk/expressoCalendar/inc/class.uicalendar.inc.php
===================================================================
--- trunk/expressoCalendar/inc/class.uicalendar.inc.php	(revision 656)
+++ trunk/expressoCalendar/inc/class.uicalendar.inc.php	(revision 665)
@@ -98,6 +98,4 @@
 
 		$retorno = "<today>".date('Ydm',$dayViewTime)."</today>";
-
-		$fromBo = $this->db_obj->requestDayCal($dayViewTime);
 		// Printing results in XML
 		for($i = $this->workdaystarts; $i <= $this->workdayends; $i = $i + 0.5)
@@ -109,18 +107,26 @@
 		
 		$retorno .= "</workday>";
-		}
-			if (is_array($fromBo))
-				foreach ($fromBo as $line){
-					$retorno .= "<calEvent>";
-					$retorno .= "<id>".$line['cal_id']."</id>";
-					$retorno .= "<title>".htmlspecialchars($line['title'])."</title>";
-					$retorno .= "<description>".htmlspecialchars($line['description'])."</description>";
-					$retorno .= "<edatetime>".($line['edatetime']*1000)."</edatetime>";
-					$retorno .= "<datetime>".($line['datetime']*1000)."</datetime>";       
-					$retorno .= "</calEvent>";
-			}
-		
-		return $retorno;
-	}
+		}	
+		return $retorno;
+	}
+	function getEventsDay () {
+		$dayTime = isset ($_REQUEST["time"]) ?  strtotime(substr($_REQUEST["time"],0,4)."-".substr($_REQUEST["time"],6,2)."-".substr($_REQUEST["time"],4,2)) : strtotime(date('Y-m-d', time()));
+		if (isset ($_REQUEST["uid"]))
+			$this->db_obj->user_id = $_REQUEST["uid"];
+		$fromBo = $this->db_obj->requestDayCal($dayTime);
+
+		if (is_array($fromBo))
+			foreach ($fromBo as $line){
+				$retorno .= "<calevent>";
+				$retorno .= "<id>".$line['cal_id']."</id>";
+				$retorno .= "<title>".htmlspecialchars($line['title'])."</title>";
+				$retorno .= "<description>".htmlspecialchars($line['description'])."</description>";
+				$retorno .= "<edatetime>".($line['edatetime']*1000)."</edatetime>";
+				$retorno .= "<datetime>".($line['datetime']*1000)."</datetime>";
+				$retorno .= "</calevent>";
+			}
+		return $retorno;
+	}
+
 	function getViewWeek () {
 		$dayViewTime = isset ($_REQUEST["time"]) ?  strtotime(substr($_REQUEST["time"],0,4)."-".substr($_REQUEST["time"],6,2)."-".substr($_REQUEST["time"],4,2)) : strtotime(date('Y-m-d', time()));
@@ -129,7 +135,4 @@
 		if (isset ($_REQUEST["uid"]))
 			$this->db_obj->user_id = $_REQUEST["uid"];
-
-
-		$fromBo = $this->db_obj->requestWeekCal($dayViewTime);
 
 		for($i = $this->workdaystarts; $i <= $this->workdayends; $i = $i + 0.5){
@@ -146,4 +149,19 @@
 		}
 
+		return $retorno;
+	}
+	function getEventsWeek () {
+		$dayViewTime = isset ($_REQUEST["time"]) ?  strtotime(substr($_REQUEST["time"],0,4)."-".substr($_REQUEST["time"],6,2)."-".substr($_REQUEST["time"],4,2)) : strtotime(date('Y-m-d', time()));
+		if (isset($_REQUEST["uid"]))
+			$this->db_obj->user_id = $_REQUEST["uid"];
+
+		$dayViewTime -= (date('N', $dayViewTime)%7)*86400;
+		$retorno = "<today>".date('Ydm', $dayViewTime)."</today>";
+		if (isset ($_REQUEST["uid"]))
+			$this->db_obj->user_id = $_REQUEST["uid"];
+
+
+		$fromBo = $this->db_obj->requestWeekCal($dayViewTime);
+
 
 		// Printing results in XML
@@ -151,5 +169,5 @@
 			foreach ($fromBo as $line) {
 				if ($line['datetime'] > 0){
-					$retorno .= "<calEvent>";
+					$retorno .= "<calevent>";
 					$retorno .= "<id>".$line['cal_id']."</id>";
 					$retorno .= "<title>".htmlspecialchars($line['title'])."</title>";
@@ -157,9 +175,10 @@
 					$retorno .= "<edatetime>".($line['edatetime']*1000)."</edatetime>";
 					$retorno .= "<datetime>".($line['datetime']*1000)."</datetime>";
-					$retorno .= "</calEvent>";
+					$retorno .= "</calevent>";
 				}
 			}
 		return $retorno;
 	}
+
 
 	function getDetails (){
@@ -171,5 +190,27 @@
 		return $buff;
 	}
-
+	function getEventsMonth () {
+		$monthViewTime = isset ($_REQUEST["time"]) ?  strtotime(substr($_REQUEST["time"],0,4)."-".substr($_REQUEST["time"],6,2)."-".substr($_REQUEST["time"],4,2)) : strtotime(date('Y-m-d', time()));
+		$todayTime = strtotime(date('Y-m', $monthViewTime)."-01");
+		if (isset($_REQUEST["uid"]))
+			$this->db_obj->user_id = $_REQUEST["uid"];
+
+		$fromBo = $this->db_obj->requestMonthCal($todayTime);
+
+		// Printing results in XML
+		if (is_array($fromBo))
+			foreach ($fromBo as $line) {
+				if ($line['datetime'] > 0){
+					$retorno .= "<calevent>";
+					$retorno .= "<id>".$line['cal_id']."</id>";
+					$retorno .= "<title>".htmlspecialchars($line['title'])."</title>";
+					$retorno .= "<edatetime>".($line['edatetime']*1000)."</edatetime>";
+					$retorno .= "<datetime>".($line['datetime']*1000)."</datetime>";
+					$retorno .= "</calevent>";
+				}
+			}
+		return $retorno;
+	}
+	
 	function getViewMonth () {
 		$monthViewTime = isset ($_REQUEST["time"]) ?  strtotime(substr($_REQUEST["time"],0,4)."-".substr($_REQUEST["time"],6,2)."-".substr($_REQUEST["time"],4,2)) : strtotime(date('Y-m-d', time()));
@@ -179,5 +220,4 @@
 		$todayTime = strtotime(date('Y-m', $monthViewTime)."-01");
 		$retorno = "<today>".date('Ydm', $monthViewTime)."</today>";
-		$fromBo = $this->db_obj->requestMonthCal($todayTime);
 
 		for ($i=1;$i<=date('t',$monthViewTime);$i++){
@@ -199,34 +239,21 @@
 		 }
 
-
+		return $retorno;
+	}
+	function getViewYear () {
+		$monthViewTime = isset ($_REQUEST["time"]) ?  strtotime(substr($_REQUEST["time"],0,4)."-".substr($_REQUEST["time"],6,2)."-".substr($_REQUEST["time"],4,2)) : strtotime(date('Y-m-d', time()));
+
+		$todayTime = strtotime(date('Y-m', $monthViewTime)."-01");
+		$retorno = "<today>".date('Ydm', $monthViewTime)."</today>";
+
+		$fromBo = $this->db_obj->requestYearCal($todayTime);
 		// Printing results in XML
 		if (is_array($fromBo))
 		foreach ($fromBo as $line) {
 			if ($line['datetime'] > 0){
-				$retorno .= "<calEvent>";
-				$retorno .= "<id>".$line['cal_id']."</id>";
-				$retorno .= "<title>".htmlspecialchars($line['title'])."</title>";
-				$retorno .= "<edatetime>".($line['edatetime']*1000)."</edatetime>";
-				$retorno .= "<datetime>".($line['datetime']*1000)."</datetime>";
-				$retorno .= "</calEvent>";
-			}
-		}
-		return $retorno;
-	}
-	function getViewYear () {
-		$monthViewTime = isset ($_REQUEST["time"]) ?  strtotime(substr($_REQUEST["time"],0,4)."-".substr($_REQUEST["time"],6,2)."-".substr($_REQUEST["time"],4,2)) : strtotime(date('Y-m-d', time()));
-
-		$todayTime = strtotime(date('Y-m', $monthViewTime)."-01");
-		$retorno = "<today>".date('Ydm', $monthViewTime)."</today>";
-
-		$fromBo = $this->db_obj->requestYearCal($todayTime);
-		// Printing results in XML
-		if (is_array($fromBo))
-		foreach ($fromBo as $line) {
-			if ($line['datetime'] > 0){
-				$retorno .= "<calEvent>";
+				$retorno .= "<calevent>";
 				$retorno .= "<id>".$line['cal_id']."</id>";
 				$retorno .= "<datetime>".($line['datetime']*1000)."</datetime>";
-				$retorno .= "</calEvent>";
+				$retorno .= "</calevent>";
 			}
 		}
Index: trunk/expressoCalendar/js/connector.js
===================================================================
--- trunk/expressoCalendar/js/connector.js	(revision 632)
+++ trunk/expressoCalendar/js/connector.js	(revision 665)
@@ -95,5 +95,15 @@
 	}
 var connector = new cConnector();
-
+	function _xml()
+	{
+		var a = false;
+		if ( document.implementation.createDocument )
+			a = document.implementation.createDocument("", "", null);
+		else if ( ActiveXObject )
+			a = new ActiveXObject("Msxml2.DOMDocument");
+		if ( arguments.length == 1 && typeof arguments[0] == 'string' )
+			a.appendChild(a.createElement(arguments[0]));
+		return a;
+	}
 	XMLTools.prototype = {
 		"__DEBUG__" : false,
@@ -282,4 +292,58 @@
 	};
 
+function cExecuteForm(url, form, handler){
+	connector.showProgressBar();
+	var iframe_el = document.getElementById('nullFrame');
+	if (!iframe_el)
+	{
+		iframe_el = document.createElement('IFRAME');
+		iframe_el.id = "nullFrame";
+	}
+	iframe_el.style.width = "0px";
+	iframe_el.style.height = "0px";
+	iframe_el.style.border = '0px';
+	iframe_el.name = "nullFrame";
+	iframe = document.body.appendChild(iframe_el);
+	iframe_el.setAttribute('onload', 'javascript:'+handler+'()');
+	form.target = "nullFrame";
+	form.submit();
+}
+
+function cExecute(requestURL,handler,methmd){
+	var AjaxRequest = function () {
+		Ajax = false;
+		if (window.XMLHttpRequest) //Gecko
+			Ajax = new XMLHttpRequest();
+		else
+			if (window.ActiveXObject) //Other nav.
+				try
+				{
+					Ajax = new ActiveXObject("Msxml12.XMLHTTP");
+				} catch (e)
+		{
+			Ajax = new ActiveXObject("Microsoft.XMLHTTP");
+		}
+	}
+	var responseRequest = function (){
+		if (Ajax.readyState == 4)
+			if (Ajax.status == 200)
+				handler(Ajax.responseText);
+			else
+				alert("Erro temporario de conexÃ£o");
+	}
+
+
+	AjaxRequest();
+	if (!Ajax){
+		alert("Erro ao conectar-se");
+		return;
+	}
+
+	Ajax.onreadystatechange = responseRequest;
+	if (typeof(method) == 'undefined')
+		method = 'GET';
+	Ajax.open(method, requestURL, true);
+	Ajax.send(null);
+}
 	var XMLTools = new XMLTools();
         var xtools = new XTools;
Index: trunk/expressoCalendar/js/common_functions.js
===================================================================
--- trunk/expressoCalendar/js/common_functions.js	(revision 632)
+++ trunk/expressoCalendar/js/common_functions.js	(revision 665)
@@ -12,85 +12,14 @@
 }
 
-// This array stores the events in table to avoid conflict in screen
-var screenTable = new Array();
-var today = new Date();
-var weekDay = today.getDay();
-function createEventDiv(eventDiv){
-	eventDiv.className = "event_div";
-	eventDiv.style.height = parseInt(eventDiv.childNodes[1].id-eventDiv.childNodes[0].id)/120000+"px";
-	var end_ = timeStamp2id(eventDiv.childNodes[1].id).substr(8);
-	var start_ = parseInt(timeStamp2id(eventDiv.childNodes[0].id).substr(8),10);
-	if (viewType == "Day"){
-		if (!screenTable[weekDay])
-			screenTable[weekDay] = new Array();
-		eventDiv.style.width = "190px";
-
-		currentPos = 1;
-		for (var hour = parseInt(start_,10); hour < parseInt(end_,10);(hour%100 == 30)?hour+=70:hour+=30){
-			if (!screenTable[weekDay][hour])
-				screenTable[weekDay][hour] = 0;
-
-			if (currentPos <= screenTable[weekDay][hour])
-				currentPos = screenTable[weekDay][hour]+1;
-		}
-		for (var hour = parseInt(start_,10); hour < parseInt(end_,10);(hour%100 == 30)?hour+=70:hour+=30)
-			screenTable[weekDay][hour] = currentPos;
-		eventDiv.style.left  = 90+(205*(currentPos-1)) + "px" ;
-		eventDiv.onmouseover = function(){ createButtons(eventDiv); };
-		eventDiv.onmouseout = function(){ removeButtons(eventDiv); };
-		var resizeDiv = document.createElement('DIV');
-		resizeDiv.id = "resize_" + eventDiv.id;
-		resizeDiv.className = 'resize_div';
-		resizeDiv.onmousedown = function() { resizeEvent(eventDiv); };
-		eventDiv.appendChild(resizeDiv);
-	}
-	if (viewType == "Week"){
-		var tempDate = new Date;
-		tempDate.setTime(eventDiv.childNodes[1].id);
-		if (!screenTable[tempDate.getDay()])
-			screenTable[tempDate.getDay()] = new Array();
-		currentPos = 1;
-		if (!screenTable[tempDate.getDay()][start_])
-			screenTable[tempDate.getDay()][start_] = 0;
-
-		if (currentPos <= screenTable[tempDate.getDay()][start_])
-			currentPos = screenTable[tempDate.getDay()][start_]+1;
-		screenTable[tempDate.getDay()][start_] = currentPos;
-
-		var widthValue = 100;
-		eventDiv.style.width = widthValue+"px";
-
-		var headerElement = document.getElementById('weekHeader_'+timeStamp2id(eventDiv.childNodes[1].id).substr(0,8));
-		if (currentPos > 1)
-			eventDiv.style.left = (10+(tempDate.getDay()*122)+(widthValue*currentPos))+"px";
-		headerElement.style.width = (widthValue*currentPos)+"px";
-		eventDiv.style.height = "20px";
-		eventDiv.style.cursor = "pointer";
-		eventDiv.onmouseover = function () { this.style.height = "auto"; this.style.zIndex = 2;};
-		eventDiv.onmouseout = function () { this.style.height = "20px"; this.style.zIndex = 1; };
-		eventDiv.onclick = function () { calendar.getView('div_main','Day','&time='+timeStamp2id(eventDiv.childNodes[1].id).substr(0,8)); };
-	}
-
-	var tdElement = document.getElementById(timeStamp2id(eventDiv.childNodes[0].id));
-
-	if (viewType == "Month"){
-		var tdElement = document.getElementById(timeStamp2id(eventDiv.childNodes[0].id).substr(0,8)+'0000');
-		eventDiv.style.width = "60px";
-		eventDiv.style.height = "15px";
-		eventDiv.onmouseover = function () { if (this.childNodes[2].length > 9) this.style.width = "auto"; this.style.zIndex = 2; };
-		eventDiv.onmouseout = function () { this.style.width = "60px"; this.style.zIndex = 1; };
-		eventDiv.onclick = function () { calendar.getView('div_main','Day','&time='+timeStamp2id(eventDiv.childNodes[1].id).substr(0,8)); };
-		eventDiv.style.cursor = "pointer";
-
-		tdElement.style.height = (tdElement.childNodes.length * 10) + "px";
-
-		if (tdElement.childNodes.length > 3)
-			eventDiv.style.margin = "20 0 0 "+(20+(tdElement.childNodes.length-4)*25);
-		else
-			eventDiv.style.margin = "0 0 0 "+(20+(tdElement.childNodes.length-1)*25);
-	}
-
-	eventDiv.style.top  =  (tdElement.offsetTop + 145) + "px";
-	tdElement.appendChild(eventDiv);
+function write_error (message){
+	if (headerMsgLock){
+		setTimeout('write_error("'+message+'");', 300);
+		return;
+	}
+	headerMsgLock = true;
+	headerDiv = document.getElementById("divAppboxHeader");
+	var labelBefore = headerDiv.innerHTML;
+	headerDiv.innerHTML = '<table width=100% cellspacing="0" cellpadding="0" border="0"><tbody><tr><th width="40%"></th><th noWrap class="action_error_th">'+message+'</th><th width="40%"></th></tr></tbody></table>';
+	setTimeout('headerMsgLock = false; document.getElementById("divAppboxHeader").innerHTML = \"'+labelBefore+'\";', 2000);
 }
 
@@ -128,43 +57,71 @@
 	}
 }
-
-function addDetails(title,description,datetime,edatetime){
-	if (!edatetime)
-		edatetime = "";
-	if (!datetime || datetime.length == 0)
-		datetime = edatetime;
-	data="<retorno>"+
-	"<title>"+title+"</title>"+
-	"<description>"+description+"</description>"+
-	"<datetime>"+datetime.substr(4,2)+"/"+datetime.substr(6,2)+"/"+datetime.substr(0,4)+"</datetime>"+
-	"<datehour>"+datetime.substr(8,2)+"</datehour>"+
-	"<dateminute>"+datetime.substr(10,2)+"</dateminute>"+
-	"<edatetime>"+edatetime.substr(4,2)+"/"+edatetime.substr(6,2)+"/"+edatetime.substr(0,4)+"</edatetime>"+
-	"<edatehour>"+edatetime.substr(8,2)+"</edatehour>"+
-	"<edateminute>"+edatetime.substr(10,2)+"</edateminute>"+
-	"</retorno>";
-
-	var divAddDialog = document.getElementById("divAddDialog");
-	var xsl = XMLTools.load('xsl/detailsDialog.xsl?'+ Date.parse(new Date));
-	if(!divAddDialog) {
-		divAddDialog = document.createElement("DIV");
-		divAddDialog.id = 'divAddDialog';
-		divAddDialog.style.zIndex = "10";
-		divAddDialog.style.position = "absolute";
-		divAddDialog.style.display = "none";
-		document.body.appendChild(divAddDialog);
-	}
-	divAddDialog.style.left = "300px";
-	divAddDialog.style.top  = "200px";
-	divAddDialog.innerHTML = xtools.parse(data, xsl);
-	divAddDialog.style.display = "block";
-}
+function submitDetailsHandler () {
+	var iframe = document.getElementById('nullFrame');
+	var Fdoc = iframe.contentDocument || iframe.contentWindow;
+	statusSpan = Fdoc.getElementById('formStatus');
+	if (statusSpan)
+	{
+		var ErMessage = statusSpan.innerHTML.replace(/<[^>]*>/,'');
+		write_error(ErMessage);
+		divAddDialog = document.getElementById("divAddDialog");
+		divAddDialog.appendChild(Fdoc.getElementsByName('app_form')[0]);
+	 	divAddDialog.style.display = "block";
+	}
+	else
+	{
+		if (Fdoc.getElementById('calendar_overlap_table')){
+			write_error(get_lang('scheduling conflict'));
+			divAddDialog = document.getElementById("divAddDialog");
+			document.getElementsByName('app_form')[0].innerHTML = Fdoc.getElementById('divAppbox').innerHTML;
+			document.getElementById('ignore_button').style.display = "none";
+			document.getElementById('redit_button').style.display = "none"; // TODO: Update the action to submit in background
+			divAddDialog.style.display = "block";
+		}
+		else
+			write_msg(get_lang('Event updated successfully'));
+	}
+	connector.hideProgressBar();
+}
+
+	function addDetails(title,description,datetime,edatetime){
+		if (!edatetime)
+			edatetime = "";
+		if (!datetime || datetime.length == 0)
+			datetime = edatetime;
+		var handler_embeddedHTML = function (data) {
+			var divAddDialog = document.getElementById("divAddDialog");
+			if(!divAddDialog)
+			{
+				divAddDialog = document.createElement("DIV");
+				divAddDialog.id = 'divAddDialog';
+				divAddDialog.style.zIndex = "10";
+				divAddDialog.style.position = "absolute";
+				divAddDialog.style.display = "none";
+				document.body.appendChild(divAddDialog);
+			}
+			divAddDialog.style.left = "100px";
+			divAddDialog.style.top  = "100px";
+			var xsl = XMLTools.load('xsl/windowDialog.xsl');
+			xml = "<return></return>";
+			divAddDialog.innerHTML = xtools.parse(xml, xsl);
+			document.getElementById('form_content').innerHTML = data;
+			submitButton = document.getElementById('submit_button');
+			submitButton.onclick = function () { cExecuteForm('/index.php?menuaction=calendar.bocalendar.update',document.getElementsByName('app_form')[0],'submitDetailsHandler'); return false; }
+			cancelButton = document.getElementById('cancel_button');
+			cancelButton.onclick = function () { calendar.dialog(); return false; }
+			deleteButton = document.getElementById('delete_button');
+			deleteButton.onclick = function () { removeEvent(eventId.id.substr(6)); calendar.dialog(); return false; }
+			divAddDialog.style.display = "block";
+		}
+		cExecute('../index.php?menuaction=calendar.uicalendar.add&plain=True&date='+datetime.substr(0,4)+datetime.substr(6,2)+datetime.substr(4,2)+'&hour='+datetime.substr(8,2)+'&minute='+datetime.substr(10,2),handler_embeddedHTML);
+	}
 
 function showDetails(eventId){
-	var handler_getDetails = function (data)
-	{
+	var handler_embeddedHTML = function (data) {
 		var divAddDialog = document.getElementById("divAddDialog");
-		var xsl = XMLTools.load('xsl/detailsDialog.xsl?'+ Date.parse(new Date));
-		if(!divAddDialog) {
+		var xsl = XMLTools.load('xsl/windowDialog.xsl');
+		if(!divAddDialog)
+		{
 			divAddDialog = document.createElement("DIV");
 			divAddDialog.id = 'divAddDialog';
@@ -174,32 +131,29 @@
 			document.body.appendChild(divAddDialog);
 		}
-		divAddDialog.style.left = "300px";
-		divAddDialog.style.top  = "200px";
-		divAddDialog.innerHTML = xtools.parse(data, xsl);
+		divAddDialog.style.left = "100px";
+		divAddDialog.style.top  = "100px";
+		xml = "<return></return>";
+		divAddDialog.innerHTML = xtools.parse(xml, xsl);
+		document.getElementById('form_content').innerHTML = data;
+		submitButton = document.getElementById('submit_button');
+		submitButton.onclick = function () { cExecuteForm('/index.php?menuaction=calendar.bocalendar.update',document.getElementsByName('app_form')[0],'submitDetailsHandler'); calendar.dialog(); return false; }
+		try
+		{
+			cancelButton = document.getElementById('cancel_button');
+			cancelButton.onclick = function () { calendar.dialog(); return false; }
+		}
+		catch (e)
+		{
+			cancelButton = document.createElement('INPUT');
+			cancelButton.type = "submit";
+			cancelButton.value = get_lang('cancel');
+			cancelButton.onclick = function () { calendar.dialog(); return false; }
+			document.getElementsByName('app_form')[0].appendChild(cancelButton);
+		};
+		deleteButton = document.getElementById('delete_button');
+		deleteButton.onclick = function () { removeEvent(eventId.id.substr(6)); calendar.dialog(); return false; }
 		divAddDialog.style.display = "block";
-		var saveBut = document.getElementById("saveLink");
-		saveBut.onclick = function () { saveEvent(eventId); }
-		var startDate = document.getElementById('startstr');
-		var endDate = document.getElementById('endstr');
-		var startHour = document.getElementById('starthour');
-		var startMin = document.getElementById('startmin');
-		var endHour = document.getElementById('endhour');
-		var endMin = document.getElementById('endmin');
-		objDate = new Date();
-		objDate.setTime(startDate.value*1000);
-		startDate.value = objDate.getDate()+"/"+(objDate.getMonth()+1)+"/"+objDate.getFullYear();
-		startHour.value = objDate.getHours();
-		startMin.value = objDate.getMinutes();
-		if (startMin.value.length < 2)
-			startMin.value += "0";
-		objDate.setTime(endDate.value*1000);
-		endDate.value = objDate.getDate()+"/"+(objDate.getMonth()+1)+"/"+objDate.getFullYear();
-		endHour.value = objDate.getHours();
-		endMin.value = objDate.getMinutes();
-		if (endMin.value.length < 2)
-			endMin.value += "0";
-		}
-	XMLTools.__RETURN_MODE__ = 'XML';
-	XMLTools.request('$this.uicalendar.getDetails&id='+eventId.id.substr(6), 'GET', handler_getDetails);
+	}
+	cExecute('../index.php?menuaction=calendar.uicalendar.edit&cal_id='+eventId.id.substr(6)+'&plain=True',handler_embeddedHTML);
 }
 function removeButtons(eventDiv){
@@ -215,5 +169,5 @@
 	var handler_removeEvent = function (data) {
 		var xsl = XMLTools.load('xsl/returnData.xsl?'+ Date.parse(new Date));
-                var serverRet = xtools.parse(data, xsl);
+		var serverRet = xtools.parse(data, xsl);
 		serverRet = serverRet.substr(serverRet.indexOf('>')+1);
 		var retStatus = serverRet.substr(0,5);
Index: trunk/expressoCalendar/js/calendar_functions.js
===================================================================
--- trunk/expressoCalendar/js/calendar_functions.js	(revision 656)
+++ trunk/expressoCalendar/js/calendar_functions.js	(revision 665)
@@ -29,5 +29,5 @@
 			document.getElementById("div_main").style.opacity = 1;
 			document.getElementById("div_main").filters.alpha.opacity=100;
-		} catch (e) {  }
+		} catch (e) {};
 	return true;
 	}
@@ -55,8 +55,11 @@
 	divAddDialog.innerHTML = xtools.parse(data, xsl);
 	var closeButton = document.getElementById('closeDialog');
-	if (is_ie){
+	if (is_ie)
+	{
 		closeButton.style.left = '285px';
 		closeButton.style.top = '5px';
-	}else{
+	}
+	else
+	{
 		closeButton.style.left = '320px';
 		closeButton.style.top = '25px';
@@ -112,8 +115,15 @@
 			document.getElementById("l_date").innerHTML += "<a href=\"javascript:calendar.getView('div_main','"+viewType+"','&time='+this.nextView);\">&nbsp;\>\></a>";
 
-		var events = document.getElementById('returnEvents');
-		while(typeof(events.firstChild.id) == 'string'){
-			createEventDiv(events.firstChild);
+		var getEventsDay = function (data)
+		{
+			var xsl = XMLTools.load('xsl/events'+type+'.xsl');
+			var div = document.getElementById('div_main');
+			div.innerHTML += xtools.parse(data, xsl);
+			var events = document.getElementById('returnEvents');
+			while(typeof(events.firstChild.id) == 'string')
+				createEventDiv(events.firstChild);
 		}
+	        XMLTools.__RETURN_MODE__ = 'XML';
+		XMLTools.request('$this.uicalendar.getEvents'+type+(data?data:'')+'&uid='+calendar.uid, 'GET', getEventsDay);
 
 	};
@@ -137,4 +147,5 @@
 	    var div = document.getElementById(this.idEl);
 	    div.innerHTML = xtools.parse(data, xsl);
+	    document.getElementById('divAppbox').style.height = "100%";
 	}
 	catch(e){
@@ -142,5 +153,6 @@
 	}
 
-	if (type == 'Week' || type == 'Month'){
+	if (type == 'Week' || type == 'Month')
+	{
 		var trWeek = document.getElementById('tr_week');
 		for (var i=0; i < trWeek.childNodes.length; i++)
@@ -202,5 +214,5 @@
 		default: month = ""; break;
 	}
-	return get_lang(month);
+	return get_lang("%1 of %2",get_lang(month),(obj.getYear()+1900));
 }
 Calendar.prototype.parseDate = function (timeStamp) {
@@ -242,2 +254,87 @@
 }
 var calendar = new Calendar();
+
+// This array stores the events in table to avoid conflict in screen
+var screenTable = new Array();
+var today = new Date();
+var weekDay = today.getDay();
+function createEventDiv(eventDiv){
+	eventDiv.className = "event_div";
+	eventDiv.style.height = parseInt(eventDiv.childNodes[1].id-eventDiv.childNodes[0].id)/120000+"px";
+	var end_ = timeStamp2id(eventDiv.childNodes[1].id).substr(8);
+	var start_ = parseInt(timeStamp2id(eventDiv.childNodes[0].id).substr(8),10);
+	if (viewType == "Day"){
+		if (!screenTable[weekDay])
+			screenTable[weekDay] = new Array();
+		eventDiv.style.width = "190px";
+
+		currentPos = 1;
+		for (var hour = parseInt(start_,10); hour < parseInt(end_,10);(hour%100 == 30)?hour+=70:hour+=30){
+			if (!screenTable[weekDay][hour])
+				screenTable[weekDay][hour] = 0;
+
+			if (currentPos <= screenTable[weekDay][hour])
+				currentPos = screenTable[weekDay][hour]+1;
+		}
+		for (var hour = parseInt(start_,10); hour < parseInt(end_,10);(hour%100 == 30)?hour+=70:hour+=30)
+			screenTable[weekDay][hour] = currentPos;
+		eventDiv.style.left  = 90+(205*(currentPos-1)) + "px" ;
+		eventDiv.onmouseover = function(){ createButtons(eventDiv); };
+		eventDiv.onmouseout = function(){ removeButtons(eventDiv); };
+		var resizeDiv = document.createElement('DIV');
+		resizeDiv.id = "resize_" + eventDiv.id;
+		resizeDiv.className = 'resize_div';
+		resizeDiv.onmousedown = function() { resizeEvent(eventDiv); };
+		eventDiv.appendChild(resizeDiv);
+	}
+	if (viewType == "Week"){
+		var tempDate = new Date;
+		tempDate.setTime(eventDiv.childNodes[1].id);
+		if (!screenTable[tempDate.getDay()])
+			screenTable[tempDate.getDay()] = new Array();
+		currentPos = 1;
+		if (!screenTable[tempDate.getDay()][start_])
+			screenTable[tempDate.getDay()][start_] = 0;
+
+		if (currentPos <= screenTable[tempDate.getDay()][start_])
+			currentPos = screenTable[tempDate.getDay()][start_]+1;
+		screenTable[tempDate.getDay()][start_] = currentPos;
+
+		var widthValue = 100;
+		eventDiv.style.width = widthValue+"px";
+
+		var headerElement = document.getElementById('weekHeader_'+timeStamp2id(eventDiv.childNodes[1].id).substr(0,8));
+		if (currentPos > 1)
+			eventDiv.style.left = (10+(tempDate.getDay()*122)+(widthValue*currentPos))+"px";
+		headerElement.style.width = (widthValue*currentPos)+"px";
+		eventDiv.style.height = "20px";
+		eventDiv.style.cursor = "pointer";
+		eventDiv.onmouseover = function () { this.style.height = "auto"; this.style.zIndex = 2;};
+		eventDiv.onmouseout = function () { this.style.height = "20px"; this.style.zIndex = 1; };
+		eventDiv.onclick = function () { calendar.getView('div_main','Day','&time='+timeStamp2id(eventDiv.childNodes[1].id).substr(0,8)); };
+	}
+
+	var tdElement = document.getElementById(timeStamp2id(eventDiv.childNodes[0].id));
+
+	if (viewType == "Month"){
+		var tdElement = document.getElementById(timeStamp2id(eventDiv.childNodes[0].id).substr(0,8)+'0000');
+		eventDiv.style.width = "60px";
+		eventDiv.style.height = "15px";
+		eventDiv.onmouseover = function () { if (this.childNodes[2].length > 9) this.style.width = "auto"; this.style.zIndex = 2; };
+		eventDiv.onmouseout = function () { this.style.width = "60px"; this.style.zIndex = 1; };
+		eventDiv.onclick = function () { calendar.getView('div_main','Day','&time='+timeStamp2id(eventDiv.childNodes[1].id).substr(0,8)); };
+		eventDiv.style.cursor = "pointer";
+
+		tdElement.style.height = (tdElement.childNodes.length * 10) + "px";
+
+		if (tdElement.childNodes.length > 3)
+			eventDiv.style.margin = "20 0 0 "+(20+(tdElement.childNodes.length-4)*25);
+		else
+			eventDiv.style.margin = "0 0 0 "+(20+(tdElement.childNodes.length-1)*25);
+	}
+
+	eventDiv.style.top  =  (tdElement.offsetTop + 160) + "px";
+	tdElement.appendChild(eventDiv);
+}
+
+
Index: trunk/expressoCalendar/templates/default/main.css
===================================================================
--- trunk/expressoCalendar/templates/default/main.css	(revision 632)
+++ trunk/expressoCalendar/templates/default/main.css	(revision 665)
@@ -59,4 +59,17 @@
 }
 
+.action_error_th {
+	font-family: Verdana, Arial, Helvetica, sans-serif;
+	font-size: 11px;
+	border-width: 0px 0px 0px 0px;
+	padding: 1px 10px 0px 10px;
+	border-style: inset inset inset inset;
+	border-color: gray gray gray gray;
+	background-color: red;
+	color: white;
+	-moz-border-radius: 6px 6px 6px 6px;
+}
+
+
 .resize_div {
 	position: absolute;
