calendar fix
diff --git a/erpnext/startup/event_handlers.py b/erpnext/startup/event_handlers.py
index 8def5bb..6420e80 100644
--- a/erpnext/startup/event_handlers.py
+++ b/erpnext/startup/event_handlers.py
@@ -81,9 +81,13 @@
 			webnotes.conn.get_value('Website Settings', None, 'analytics_code')
 		bootinfo['analytics_call'] = \
 			webnotes.conn.get_value('Website Settings', None, 'analytics_call')
+		
 	else:	
 		bootinfo['letter_heads'] = get_letter_heads()
 
+		import webnotes.model.doctype
+		bootinfo['docs'] += webnotes.model.doctype.get('Event')
+
 def get_letter_heads():
 	"""load letter heads with startup"""
 	import webnotes
diff --git a/erpnext/utilities/page/calendar/calendar.css b/erpnext/utilities/page/calendar/calendar.css
index bcf7cce..2f3356f 100644
--- a/erpnext/utilities/page/calendar/calendar.css
+++ b/erpnext/utilities/page/calendar/calendar.css
@@ -156,9 +156,7 @@
 }
 
 div.cal_event {
-	width: 100%;
-	height: 12px;
-	overflow: hidden;
+	overflow-x: hidden;
 	font-size: 11px;
 	color: #00B;
 	margin-bottom: 2px;
diff --git a/erpnext/utilities/page/calendar/calendar.js b/erpnext/utilities/page/calendar/calendar.js
index 6e59f21..ac1ac88 100644
--- a/erpnext/utilities/page/calendar/calendar.js
+++ b/erpnext/utilities/page/calendar/calendar.js
@@ -33,7 +33,6 @@
 Calendar=function() {
 	this.views=[];
 	this.events = {};
-	this.has_event = {};
 	this.events_by_name = {};
 	this.weekdays = new Array("Sun","Mon","Tue","Wed","Thu","Fri","Sat");
 }
@@ -57,15 +56,18 @@
 	this.views['Day'] = new Calendar.DayView(this);
 
 	// Month view as initial
-	this.cur_view = this.views['Day'];
-	this.views['Day'].show();
+	this.cur_view = this.views['Month'];
+	this.views['Month'].show();
 	
 }
 
 Calendar.prototype.rename_notify = function(dt, old_name, new_name) {
 	// calendar
-	if(dt = 'Event' && this.has_event[old_name])
-		this.has_event[old_name] = false;	
+	if(dt = 'Event'){		
+		if(this.events_by_name[old_name]) {
+			delete this.events_by_name[old_name];
+		}
+	}
 }
 
 //------------------------------------------------------
@@ -119,19 +121,15 @@
 			
 			// save values
 			d.ev.description = d.widgets['Description'].value;
-			if(d.widgets['Cancel Event'].checked) d.ev.event_type='Cancel';
-			else if(d.widgets['Public Event'].checked) d.ev.event_type='Public';
+			if(d.widgets['Cancel Event'].checked) 
+				d.ev.event_type='Cancel';
+			else if(d.widgets['Public Event'].checked) 
+				d.ev.event_type='Public';
 			
 			me.event_dialog.hide();
 			
 			// if new event
-			if(d.cal_ev)
-				var cal_ev = d.cal_ev;
-			else 
-				var cal_ev = me.set_event(d.ev);
-
-			cal_ev.save();
-			if(me.cur_view)me.cur_view.refresh();			
+			me.save_event(d.ev);
 		}
 		this.event_dialog = d;
 	}
@@ -141,6 +139,20 @@
 	
 }
 
+Calendar.prototype.save_event = function(doc) {
+	var me = this;
+	save_doclist('Event', doc.name, 'Save', function(r) { 
+		var doc = locals['Event'][r.docname];
+		var cal = erpnext.calendar;
+		cal.cur_view.refresh();
+
+		// if cancelled, hide
+		if(doc.event_type=='Cancel') {
+			$(cal.events_by_name[doc.name].body).toggle(false);
+		}
+	});
+}
+
 //------------------------------------------------------
 
 Calendar.prototype.add_event = function() {
@@ -193,7 +205,7 @@
 Calendar.prototype.set_event = function(ev) {
 	// don't duplicate
 	if(this.events_by_name[ev.name]) {
-		return;
+		return this.events_by_name[ev.name];
 	}
 		
 	var dt = dateutil.str_to_obj(ev.event_date);
@@ -204,16 +216,16 @@
 	if(!this.events[y]) this.events[y] = [];
 	if(!this.events[y][m]) this.events[y][m] = [];
 	if(!this.events[y][m][d]) this.events[y][m][d] = [];
-	if(!this.events[y][m][d][cint(cint(ev.event_hour))]) 
+	if(!this.events[y][m][d][cint(ev.event_hour)]) 
 		this.events[y][m][d][cint(ev.event_hour)] = [];
 
 	var cal_ev = new Calendar.CalEvent(ev, this);
 	this.events[y][m][d][cint(ev.event_hour)].push(cal_ev);	
 	this.events_by_name[ev.name] = cal_ev;
-	this.has_event[ev.name] = true;
 	
 	return cal_ev;
 }
+
 //------------------------------------------------------
 
 Calendar.prototype.refresh = function(viewtype){//Sets the viewtype of the Calendar and Calls the View class based on the viewtype
@@ -235,14 +247,11 @@
 
 Calendar.CalEvent= function(doc, cal) {
 	this.body = document.createElement('div');
-	var v = locals['Event'][doc.name].description;
-	if(v==null)v='';
-	this.body.innerHTML = v;
-
+	this.link = $a(this.body, 'a', '', {}, locals['Event'][doc.name].description || '');
 	this.doc = doc;
 	var me = this;
 
-	this.body.onclick = function() {
+	this.link.onclick = function() {
 		if(me.doc.name) {
 			cal.show_event(me.doc, me);
 		}
@@ -252,26 +261,18 @@
 Calendar.CalEvent.prototype.show = function(vu) {
 
 	var t = this.doc.event_type;
-	this.my_class = 'cal_event cal_event_'+ t;
+	this.my_class = 'cal_event_'+ t;
 	
 	if(this.body.parentNode)
 		this.body.parentNode.removeChild(this.body);
 	vu.body.appendChild(this.body);
 	
 	// refresh
-	var v = this.doc.description;
-	if(v==null)v='';
-	this.body.innerHTML = v;
+	this.link.innerHTML = this.doc.description || '';
 	this.body.className = this.my_class;
 }
 
-Calendar.CalEvent.prototype.save = function() {
-	var me = this;
-	save_doclist('Event', me.doc.name, 'Save', function(r) { 
-		me.doc = locals['Event'][r.docname];
-		erpnext.calendar.has_event[r.docname] = true;
-	} );
-}
+
 // ----------
 
 Calendar.View =function() { this.daystep = 0; this.monthstep = 0; }
diff --git a/js/all-app.js b/js/all-app.js
index 4618dad..e62a7e6 100644
--- a/js/all-app.js
+++ b/js/all-app.js
Binary files differ
diff --git a/js/all-web.js b/js/all-web.js
index 0d45a49..4616da6 100644
--- a/js/all-web.js
+++ b/js/all-web.js
@@ -940,7 +940,7 @@
 return locals[dt][newdoc];}
 function make_doclist(dt,dn,deleted){var dl=[];dl[0]=locals[dt][dn];for(var ndt in locals){if(locals[ndt]){for(var ndn in locals[ndt]){var doc=locals[ndt][ndn];if(doc&&doc.parenttype==dt&&(doc.parent==dn||(deleted&&doc.__oldparent==dn))){dl[dl.length]=doc;}}}}
 return dl;}
-var rename_observers=[];function notify_rename_observers(dt,old_name,new_name){try{var old=locals[dt][old_name];old.parent=null;old.__deleted=1;}catch(e){alert("[rename_from_local] No Document for: "+old_name);}
+var rename_observers=[];function notify_rename_observers(dt,old_name,new_name){try{delete locals[dt][old_name];}catch(e){alert("[rename_from_local] No Document for: "+old_name);}
 for(var i=0;i<rename_observers.length;i++){if(rename_observers[i])
 rename_observers[i].rename_notify(dt,old_name,new_name);}}
 var Meta={};var local_dt={};Meta.make_local_dt=function(dt,dn){var dl=make_doclist('DocType',dt);if(!local_dt[dt])local_dt[dt]={};if(!local_dt[dt][dn])local_dt[dt][dn]={};for(var i=0;i<dl.length;i++){var d=dl[i];if(d.doctype=='DocField'){var key=d.fieldname?d.fieldname:d.label;local_dt[dt][dn][key]=copy_dict(d);}}}
diff --git a/version.num b/version.num
index 6e1d384..55df208 100644
--- a/version.num
+++ b/version.num
@@ -1 +1 @@
-687
\ No newline at end of file
+689
\ No newline at end of file