--- todolist-5.x-1.x-dev\todolist.js	2007-06-23 03:44:28.000000000 +0200
+++ todolist\todolist.js	2007-06-24 11:05:19.901377600 +0200
@@ -23,7 +23,7 @@
   $('#todolist-add-task-form').submit(function() {
     $.ajax({
       type: 'POST',
-      url: '/todolist/create_task',
+      url: getBaseUrl() + 'index.php?q=todolist/create_task',
       data: $('input, select', this).serialize() + '&order='+($('.todolist.incomplete .task').length+1),
       dataType: 'json',
     });
@@ -64,7 +64,7 @@
     serial = $.SortSerialize(obj[0].id);
     $.ajax({
       type: 'POST',
-      url: '/todolist/reorder_task',
+      url: getBaseUrl() + 'index.php?q=todolist/reorder_task',
       data: serial.hash,
     });
   },
@@ -77,7 +77,7 @@
       var element = $(this).parent();
       $.ajax({
         type: 'POST',
-        url: '/todolist/toggle_task',
+        url: getBaseUrl() + 'index.php?q=todolist/toggle_task',
         data: 'id='+this.name+'&checked='+(this.checked? '1' : '0')+'&order='+(this.checked? -1 : $('.todolist.incomplete .task').length+1),
         dataType: 'json',
         beforeSend: function() { $(element).addClass('loading'); },
@@ -90,7 +90,7 @@
     var element = $('#'+id);
     $.ajax({
       type: 'POST',
-      url: '/todolist/delete_task',
+      url: getBaseUrl() + 'index.php?q=todolist/delete_task',
       data: 'id='+id,
       dataType: 'json',
       beforeSend: function() { $(element).addClass('loading'); },
@@ -104,7 +104,7 @@
       var element = $(this).parent();
       $.ajax({
         type: 'POST',
-        url: '/todolist/edit_task',
+        url: getBaseUrl() + 'index.php?q=todolist/edit_task',
         data: $('input, textarea, select', this).serialize(),
         dataType: 'json',
         beforeSend: function() { $(element).addClass('loading'); },
@@ -114,7 +114,7 @@
       var element = $('#'+id);
       $.ajax({
         type: 'GET',
-        url: '/todolist/edit_task?id='+id,
+        url: getBaseUrl() + 'index.php?q=todolist/edit_task&id='+id,
         dataType: 'json',
         beforeSend: function() { $(element).addClass('loading'); },
         complete: function() { $(element).removeClass('loading'); },
@@ -203,5 +203,22 @@
       $('.todolist .nub').css('display', 'none');
       this.stop();
     }
-  }
-};
\ No newline at end of file
+  },
+};
+
+/**
+ *
+ * @access public
+ * @return void 
+ **/
+function getBaseUrl(){
+  var url = '';
+  var script = $.grep($('head > script'), function(i) {
+    return $(i).attr('src').indexOf('todolist.js') > -1
+  });
+  url = $(script).attr('src');
+  url = url.substring(0, url.indexOf('modules/'));
+  if (url.indexOf('sites/') > -1)
+    url = url.substring(0, url.indexOf('sites/'));
+  return url;
+}
