Generalization of autocomplete

S'ha generalitzat la funciĆ³ autocomplete per poder-la utilitzar a l'afegir arestes.
diff --git a/js/autocomplete.js b/js/autocomplete.js
index d1ff083..351c786 100644
--- a/js/autocomplete.js
+++ b/js/autocomplete.js
@@ -1,4 +1,4 @@
-function autocomplete(inp, obj) {

+function autocomplete(inp, obj, act) {

   /*the autocomplete function takes two arguments,

   the text field element and an objay of possible autocompleted values:*/

   var currentFocus;

@@ -42,11 +42,16 @@
 				  var n = this.getElementsByTagName("input")[0].value;

 				  inp.value = obj[n].name;

 				  

-				  // Move camera to desired node

-					sigma.misc.animation.camera( s.camera,

-					  { x: obj[n].x, y: obj[n].y, ratio: 0.5 },

-					  { duration: s.settings('animationsTime') || 300 }

-					);

+				  switch (act) {

+					case "search":

+					  // Move camera to desired node

+						cameraGoto(obj[n].x, obj[n].y);

+						break;

+					case "addEdge":

+					  // Add an edge between A and B

+					  alert(obj[n].name);

+					  break;

+				  }

 			  

 				  // Close the search box

 				  var searchBox = document.getElementById('searchBox');

diff --git a/js/script.js b/js/script.js
index af7d4cb..5d7a5e4 100644
--- a/js/script.js
+++ b/js/script.js
@@ -183,7 +183,7 @@
       });
 
       s.refresh();
-	  autocomplete(document.getElementById("searchInput"), graf.nodes);
+	  autocomplete(document.getElementById("searchInput"), graf.nodes, "search");
     });
 }