diff --git a/apps/calendar/ajax/activation.php b/apps/calendar/ajax/activation.php
new file mode 100644
index 0000000000000000000000000000000000000000..51c5777f643f49fb0cf58e7170e4577645018644
--- /dev/null
+++ b/apps/calendar/ajax/activation.php
@@ -0,0 +1,27 @@
+<?php
+/*************************************************
+ * ownCloud - Calendar Plugin                     *
+ *                                                *
+ * (c) Copyright 2011 Georg Ehrke                 *
+ * author: Georg Ehrke                            *
+ * email: ownclouddev at georgswebsite dot de     *
+ * homepage: ownclouddev.georgswebsite.de         *
+ * manual: ownclouddev.georgswebsite.de/manual    *
+ * License: GNU AFFERO GENERAL PUBLIC LICENSE     *
+ *                                                *
+ * If you are not able to view the License,       *
+ * <http://www.gnu.org/licenses/>                 *
+ * <http://ownclouddev.georgswebsite.de/license/> *
+ * please write to the Free Software Foundation.  *
+ * Address:                                       *
+ * 59 Temple Place, Suite 330, Boston,            *
+ * MA 02111-1307  USA                             *
+ *************************************************/
+require_once ("../../../lib/base.php");
+if(!OC_USER::isLoggedIn()) {
+	die("<script type=\"text/javascript\">document.location = oc_webroot;</script>");
+}
+$calendarid = $_POST['calendarid'];
+OC_Calendar_Calendar::setCalendarActive($calendarid, $_POST['active']);
+$cal = OC_Calendar_Calendar::findCalendar($calendarid);
+echo $cal['active'];
diff --git a/apps/calendar/appinfo/database.xml b/apps/calendar/appinfo/database.xml
index 36fd56a0516f3b1025dca050a9a174a55b033584..159ca0127e427da0f06e737265b13428902cce0d 100644
--- a/apps/calendar/appinfo/database.xml
+++ b/apps/calendar/appinfo/database.xml
@@ -136,6 +136,14 @@
     <length>100</length>
    </field>
 
+   <field>
+    <name>active</name>
+    <type>integer</type>
+    <default>1</default>
+    <notnull>true</notnull>
+    <length>4</length>
+   </field>
+
    <field>
     <name>ctag</name>
     <type>integer</type>
diff --git a/apps/calendar/js/calendar.js b/apps/calendar/js/calendar.js
index c825fc190906faaa7f5e50714034b5a657a1d4a5..bfead8f393342380595c7eed49ec261aa6ac34ef 100755
--- a/apps/calendar/js/calendar.js
+++ b/apps/calendar/js/calendar.js
@@ -896,3 +896,10 @@ function oc_cal_choosecalendar(){
 		alert(t("calendar", "You can't open more than one dialog per site!"));
 	}
 }
+function oc_cal_calender_activation(checkbox, calendarid)
+{
+	$.post(oc_webroot + "/apps/calendar/ajax/activation.php", { calendarid: calendarid, active: checkbox.checked?1:0 },
+	  function(data) {
+		checkbox.checked = data == 1;
+	  });
+}
diff --git a/apps/calendar/lib/calendar.php b/apps/calendar/lib/calendar.php
index 76f6b253b5d0c17c6b68befdeebd32a6025e6a50..5a4bed1fbc52f49e89debdc4c6472aaaabef3c10 100644
--- a/apps/calendar/lib/calendar.php
+++ b/apps/calendar/lib/calendar.php
@@ -42,6 +42,7 @@
  *     userid VARCHAR(255),
  *     displayname VARCHAR(100),
  *     uri VARCHAR(100),
+ *     active INTEGER UNSIGNED NOT NULL DEFAULT '0',
  *     ctag INTEGER UNSIGNED NOT NULL DEFAULT '0',
  *     description TEXT,
  *     calendarorder INTEGER UNSIGNED NOT NULL DEFAULT '0',
@@ -55,9 +56,15 @@
  * This class manages our calendars
  */
 class OC_Calendar_Calendar{
-	public static function allCalendars($uid){
-		$stmt = OC_DB::prepare( 'SELECT * FROM *PREFIX*calendar_calendars WHERE userid = ?' );
-		$result = $stmt->execute(array($uid));
+	public static function allCalendars($uid, $active=null){
+		$values = array($uid);
+		$active_where = '';
+		if (!is_null($active)){
+			$active_where = ' AND active = ?';
+			$values[] = $active;
+		}
+		$stmt = OC_DB::prepare( 'SELECT * FROM *PREFIX*calendar_calendars WHERE userid = ?' . $active_where );
+		$result = $stmt->execute($values);
 		
 		$calendars = array();
 		while( $row = $result->fetchRow()){
@@ -121,6 +128,13 @@ class OC_Calendar_Calendar{
 		return true;
 	}
 
+	public static function setCalendarActive($id,$active){
+		$stmt = OC_DB::prepare( 'UPDATE *PREFIX*calendar_calendars SET active = ? WHERE id = ?' );
+		$stmt->execute(array($active, $id));
+
+		return true;
+	}
+
 	public static function touchCalendar($id){
 		$stmt = OC_DB::prepare( 'UPDATE *PREFIX*calendar_calendars SET ctag = ctag + 1 WHERE id = ?' );
 		$stmt->execute(array($id));
diff --git a/apps/calendar/templates/part.choosecalendar.php b/apps/calendar/templates/part.choosecalendar.php
index 0aef52b4388f2e24f66212cba63e09ac86331332..3bd7e5ef5910e79f8278b9844af228567eedbfec 100644
--- a/apps/calendar/templates/part.choosecalendar.php
+++ b/apps/calendar/templates/part.choosecalendar.php
@@ -4,8 +4,8 @@
 $option_calendars = OC_Calendar_Calendar::allCalendars(OC_User::getUser());
 for($i = 0; $i < count($option_calendars); $i++){
 	echo "<tr>";
-	echo "<td width=\"20px\"><input id=\"checkbox_" . $option_calendars[$i]["id"] . "\" type=\"checkbox\"></td>";
-	echo "<td><label for=\"checkbox_" . $option_calendars[$i]["id"] . "\">" . $option_calendars[$i]["displayname"] . "</label></td>";
+	echo "<td width=\"20px\"><input id=\"active_" . $option_calendars[$i]["id"] . "\" type=\"checkbox\" onClick=\"oc_cal_calender_activation(this, " . $option_calendars[$i]["id"] . ")\"></td>";
+	echo "<td><label for=\"active_" . $option_calendars[$i]["id"] . "\">" . $option_calendars[$i]["displayname"] . "</label></td>";
 	echo "<td width=\"20px\"><a style=\"display: block; opacity: 0.214133;\" href=\"#\" title=\"" . $l->t("Download") . "\" class=\"action\"><img src=\"/owncloud/core/img/actions/download.svg\"></a></td><td width=\"20px\"><a style=\"display: block; opacity: 0.214133;\" href=\"#\" title=\"" . $l->t("Rename") . "\" class=\"action\"><img src=\"/owncloud/core/img/actions/rename.svg\"></a></td>";
 	echo "</tr>";
 }
diff --git a/apps/calendar/templates/part.getcal.php b/apps/calendar/templates/part.getcal.php
index 5959564bad369f0fb28565ab4da11b613086fbed..3e9a8f5799dae286ba14879755e7ae915504a54a 100644
--- a/apps/calendar/templates/part.getcal.php
+++ b/apps/calendar/templates/part.getcal.php
@@ -1,5 +1,5 @@
 <?php
-$calendars = OC_Calendar_Calendar::allCalendars(OC_User::getUser());
+$calendars = OC_Calendar_Calendar::allCalendars(OC_User::getUser(), 1);
 $events = OC_Calendar_Calendar::allCalendarObjects($calendars[0]['id']);
 $select_year = $_GET["year"];
 $return_events = array();