diff -urN entrans/list.php entrans_ajax/list.php
--- entrans/list.php	2006-10-06 14:55:53.000000000 +0530
+++ entrans_ajax/list.php	2008-04-02 20:23:06.000000000 +0530
@@ -58,30 +58,33 @@
 
 	// Variables used for page listing
 
-	$category	= $_GET["category"];	// Category type : 'all' or 'untrans' 
-	$file_list	= $_GET["file_list"];	// File Wise Viewing
-	$file_id	= $_GET["file_id"];	// Selected File Id
-	$funtrans	= $_GET["funtrans"];	// View only Untranslated strings in a File
+	$category	= $_REQUEST["category"];	// Category type : 'all' or 'untrans' 
+	$file_list	= $_REQUEST["file_list"];	// File Wise Viewing
+	$file_id	= $_REQUEST["file_id"];	// Selected File Id
+	$funtrans	= $_REQUEST["funtrans"];	// View only Untranslated strings in a File
 	$root		= getParentId($file_id);	// Main page contents' section-root
 
-	$page		= $_GET["page"];	// Page Number
+	$page		= $_REQUEST["page"];	// Page Number
 	$next_pg	= $page+1;		// Next Page Number
 	$prev_pg	= $page-1;		// Previous Page Number
-	$last_pg	= $_GET["last_pg"];	// Used while submitting multiple suggestions in the last page
+	$last_pg	= $_REQUEST["last_pg"];	// Used while submitting multiple suggestions in the last page
 	$rec_per_page	= 100;			// Number of records displayed per page
 
-	$edit_all	= $_GET["edit_all"];
+	$edit_all	= $_REQUEST["edit_all"];
 
 	$show_input_method_selection_box	 = TRUE;
 
 	// Variables used during submission of suggestion
-	$user_sug	= $_POST["user_sug"];		// User Suggestion
-	$check_valid	= $_POST["check_valid"];	// Should the suggestion be validated?
-	$string_id	= $_POST["string_id"];		// String Id
-	$submit_all	= $_POST["submit_all"];		// Submit suggestion for many/all strings in a page
-	$fuzzy		= $_POST["fuzzy"];		// Is the suggestion fuzzy?
+	$user_sug	= $_REQUEST["user_sug"];		// User Suggestion
+	$check_valid	= $_REQUEST["check_valid"];	// Should the suggestion be validated?
+	$string_id	= $_REQUEST["string_id"];		// String Id
+	$submit_all	= $_REQUEST["submit_all"];		// Submit suggestion for many/all strings in a page
+	$fuzzy		= $_REQUEST["fuzzy"];		// Is the suggestion fuzzy?
 	$fuzzy		= ($fuzzy) ? 1 : 0;
-	$lang_sug	= $_POST["lang_sug"];		// Language of suggestion
+	$lang_sug	= $_REQUEST["lang_sug"];		// Language of suggestion
+        
+        // Addition of AJAX support
+        $ajax           = $_REQUEST["ajax"];
 
 	if (is_numeric($page))
 	{
@@ -107,9 +110,9 @@
 
     if ($category)
     {
-        if ($_GET["lang"])
+        if ($_REQUEST["lang"])
         {
-            $lang	= $_GET["lang"];
+            $lang	= $_REQUEST["lang"];
             if ($lang == "all")
             {
                 setcookie("lang_id");
@@ -249,7 +252,6 @@
     if (!$sel_file_id && $category)
         $sel_file_id	= -1;			// No such file
 
-
     if ($submit_all)
     {
         $result_list_id	= mysql_query ($sql_list_id);
@@ -267,21 +269,20 @@
                 $select_sug_temp	= "select_" . $string_id;
                 $valid_sug_temp	= "valid_"  . $string_id;
                 $fuzzy_temp		= "fuzzy_"  . $string_id;
-                $select_sug		= $_POST["$select_sug_temp"];
+                $select_sug		= $_REQUEST["$select_sug_temp"];
                 if ($select_sug == "yes")
                 {
-                    $valid_sug	= $_POST["$valid_sug_temp"];
-                    $fuzzy		= $_POST["$fuzzy_temp"];
+                    $valid_sug	= $_REQUEST["$valid_sug_temp"];
+                    $fuzzy		= $_REQUEST["$fuzzy_temp"];
                     $fuzzy		= ($fuzzy) ? 1 : 0;
                     if (!get_magic_quotes_gpc())
                     {
-                        $user_sug	= addslashes($_POST["$user_sug_temp"]);
+                        $user_sug	= addslashes($_REQUEST["$user_sug_temp"]);
                     }
                     else
                     {
-                        $user_sug	= $_POST["$user_sug_temp"];
+                        $user_sug	= $_REQUEST["$user_sug_temp"];
                     }
-                    
                     if($user_sug)
                         SubmitSuggestion ($string_id, $user_sug, $lang_sug, $fuzzy, $sel_file_id, $valid_sug);
                     
@@ -303,13 +304,157 @@
     $total_pages	= $total_rec/$rec_per_page;
     $total_pages	= ceil($total_pages);			// Total Number of Pages
 
+    // Page SID Info 
+    $first_page_sid = 1;
+    $last_page_sid = $rec_per_page;
+
     if ($file_id)
     {
         $file_lang	= getLang($file_id);
     }
 
 
-    include ("head.php");					// Start HTML page
+
+
+
+if ($ajax) {                                               //Prevents HTML generation
+  $edit = $_REQUEST["edit"];
+  $edit_query = $_REQUEST["edit_query"];
+  
+  // Query to get user suggestion with higest votes
+  $sql_high_vote = "select user_suggestion ".
+    "from $table_suggestion ".
+    "where string_id=$edit and lang='$file_lang' ".
+    "order by vote desc limit 1";
+
+  $result_high_vote = mysql_query($sql_high_vote);
+  if(mysql_num_rows($result_high_vote))
+    {
+      $row_high_vote = mysql_fetch_row($result_high_vote);
+      $popular_sug = $row_high_vote[0];
+      $display_sug = htmlentities($popular_sug,ENT_COMPAT,'UTF-8');
+    }
+
+  $select  = "edit=$string_id";
+  $replace = "edit=$string_id";
+  $skip_1  = "skip=1";
+  $skip_0  = "skip=0";
+
+  $pos_select  = "&scrollPos=".$_REQUEST["scrollPos"];
+  $pos_replace = "";
+
+  $next_string = str_replace($select, $replace, $_SERVER['REQUEST_URI']);
+  $next_string = str_replace($skip_0, $skip_1, $next_string);
+  $next_string = str_replace($pos_select, $pos_replace, $next_string);
+
+  if (!strstr($next_string,$skip_1))
+    $next_string = $next_string."&skip=1";
+
+  $next_string = htmlspecialchars($next_string);
+
+  if($edit_query) {
+?>
+  <form name="edit_form" method="POST" action="<?php echo $next_string; ?>">
+    <table border=0 align="center">
+      <tr>
+	<td colspan="3">
+	  <textarea name="user_sug" class="indic_ime" cols  = "50" rows = "2"><?php echo $display_sug; ?></textarea>
+	</td>
+      </tr>
+      <tr>
+	<td  align="left">
+	  <a href="#" onClick="return submitAndMove()" ><img src="images/submit.png" alt="Submit"></a>
+	</td>
+	<td align="center">
+	  <input type="checkbox" name="fuzzy" >Fuzzy
+	</td>
+	<td align="center">
+<?php					    	        
+    if ($_SESSION['user_role']=="validator")
+    { 
+?>
+          <input type="checkbox" name="check_valid" value="yes"/>Validate<?php } ?>&nbsp;
+          <input type="hidden" name="string_id" 
+		 value="<?php echo $edit; ?>"/>
+	  <input type="hidden" name="lang_sug" 
+		 value="<?php echo $file_lang; ?>"/>
+	</td>
+	
+      </tr>
+    </table>
+  </form>
+<?php
+ }
+  else {
+
+    // Query to get form info for AJAX query
+    $sql_submit_query = "select t.string_id, t.string_value, c.context_id, c.valid_sug_id, ".
+      "c.is_fuzzy from $table_string_list as t, $table_string_context as c where t.string_id = $string_id".
+      " and c.string_id = $string_id and c.file_id=$file_id";
+
+    $result_list = mysql_query($sql_submit_query);
+    $row = mysql_fetch_row($result_list);
+
+    $valid_sug_id = '';
+    $display_sug = '';
+    $fuzzy_sug = '';
+    $popular_sug = '';
+
+    if ($row[3]!='-1' )	// If valid_suggestion exists
+      {
+	$valid_sug_id = $row[3];
+	$sql_valid_sug = "select user_suggestion from $table_suggestion where ".
+	  "sug_id = $valid_sug_id";
+
+	$result_valid_sug = mysql_query($sql_valid_sug);
+	$valid_sug = mysql_result($result_valid_sug,0,0);
+	$fuzzy_sug = $row[4];
+
+	$display_sug = htmlentities ($valid_sug,ENT_COMPAT,'UTF-8');
+      }
+    else
+      {
+	$context_id = $row[2];
+	
+	// Get the Suggestion with the Maximum Vote for that context
+	$sql_high_vote = "select user_suggestion ".
+	  "from $table_suggestion ".
+	  "where string_id=$string_id and lang='$file_lang' ".
+	  "order by vote desc limit 1";
+
+	$result_high_vote = mysql_query($sql_high_vote);
+
+	if(mysql_num_rows($result_high_vote))
+	  {
+	    $row_high_vote = mysql_fetch_row($result_high_vote);
+	    $popular_sug = $row_high_vote[0];
+	    $display_sug = htmlentities($popular_sug,ENT_COMPAT,'UTF-8');
+	  }
+      }
+    if ($valid_sug) // If valid_suggestion exists
+      {
+	if ($fuzzy_sug)
+	  echo '<img src="images/fuzzy.png" height="15" hspace=5 alt="Valid: ">';
+	else    
+	  echo '<img src="images/valid.png" height="15" hspace=5 alt="Valid: ">';
+	printf(" %s ",$display_sug);
+	$valid_sug	= '';
+      }
+    else			// Search for Most Popular Suggestion
+      {
+	if($popular_sug !='')
+	  {
+	    echo '<img src="images/vote215.png" height="15" hspace=5 alt="Popular">';
+	    printf(" %s",$display_sug);
+	    $popular_sug	= '';
+	  }
+	else
+	  echo "<i>No Suggestion available</i>";
+      }
+  }
+}
+else {
+  include ("head.php");					// Start HTML page
 ?>
 
 <style type="text/css">
@@ -404,7 +549,7 @@
     // Storing Previous and Next link's HTML tags in PHP variable for ease of use (note: HTML tags are incomplete)
 
     $link_current_url	= $_SERVER["REQUEST_URI"];
-    $find			= "&scrollPos=".$_GET["scrollPos"];
+    $find			= "&scrollPos=".$_REQUEST["scrollPos"];
     $replace		= "";
     $link_current_url	= str_replace ($find, $replace, $link_current_url);
     $link_current		= htmlspecialchars($link_current_url);
@@ -436,7 +581,7 @@
         echo '<div class="langbar">';
         echo 'Language ';
         echo '<select name="lang_sel" class="submit_sel_file" '.
-            'onChange="setLang(\''.$lang.'\',\''.$_GET["edit"].'\');">';
+            'onChange="setLang(\''.$lang.'\',\''.$_REQUEST["edit"].'\');">';
         $selected	= "";
         if (!$lang)
         {
@@ -579,7 +724,7 @@
           <tr>
             <td  width="30%">
 <?php
-            if ($_GET["edit"] || $show_input_method_selection_box)
+            if ($_REQUEST["edit"] || $show_input_method_selection_box)
             {
 ?>
           <ul class="editbar">
@@ -648,7 +793,7 @@
         </td>	
         <td align="right" width="30%" >
 <?php
-            if ($_GET["edit_all"])
+            if ($_REQUEST["edit_all"])
             {
 ?>
             <ul class="buttonbar">
@@ -673,10 +818,10 @@
         <td align="right" width="15%">
             <ul class="buttonbar">
 <?php
-            if ($_GET["edit_all"])
+            if ($_REQUEST["edit_all"])
             {
                 $current_url	= $_SERVER['REQUEST_URI'];
-                $find		= "&edit_all=".$_GET["edit_all"];
+                $find		= "&edit_all=".$_REQUEST["edit_all"];
                 $replace	= "";
                 $current_url	= str_replace( $find, $replace, $current_url);
                 $current_url	= htmlspecialchars($current_url);
@@ -685,12 +830,12 @@
             else
             {
                 $current_url	= $_SERVER['REQUEST_URI'];
-                $find		= "&edit=".$_GET["edit"];
+                $find		= "&edit=".$_REQUEST["edit"];
                 $replace	= "";
                 $current_url	= str_replace($find, $replace, $current_url);
-                $find		= "&skip=".$_GET["skip"];
+                $find		= "&skip=".$_REQUEST["skip"];
                 $current_url	= str_replace($find, $replace, $current_url);
-                $find		= "&scrollPos=".$_GET["scrollPos"];
+                $find		= "&scrollPos=".$_REQUEST["scrollPos"];
                 $current_url	= str_replace($find, $replace, $current_url);
                 $current_url	= $current_url . "&edit_all=yes";
                 $current_url	= htmlspecialchars($current_url);
@@ -709,7 +854,7 @@
 
 
 <?php
-        if ($_GET["edit_all"])
+        if ($_REQUEST["edit_all"])
         {
 ?>
         <form name="edit_all" method="POST" action="<?php echo $next_set; ?>">
@@ -753,7 +898,7 @@
             <img src="images/spacer.png" width="1" height="20" alt="">
 <?php
 
-        if ($_GET["edit_all"])
+        if ($_REQUEST["edit_all"])
         {
             echo '<input type="hidden" name="submit_all" value="yes">';
             if ($category)
@@ -771,14 +916,18 @@
 
 <?php		
 
-        $skip		= $_GET["skip"];
-        $edit		= $_GET["edit"];
+        $skip		= $_REQUEST["skip"];
+        $edit		= $_REQUEST["edit"];
         $hide_edit_icon	= 0;
+	$sidArray       = array();
+
+	$first_page_sid = $row_list[0];
         do{
             /* Displaying each record in the list generated by $sql_list. Read Comments above.
              * The result of $sql_list is retrieved and strored in $row_list, row or record wise.
              */
 
+      	    $sidArray[] = $row_list[0];
             $display_edit_icon	= 1;
             $backimg=($backimg=="#ffffff")?"#efefef":"#ffffff";
             if ($file_list)
@@ -813,7 +962,7 @@
                     $display_sug	= '';
 
                     echo "<td bgcolor=\"$backimg\" width=\"40%\" class=\"tdtrans\" >\n";
-                    echo "<div class=\"trans\" style=\"display:block\">\n";
+                    echo "<div name=\"edit_using_ajax\" class=\"trans\" style=\"display:block\">\n";
                     $display_sug 	= "";
                     if ($row_list[3]!='-1' )	// If valid_suggestion exists
                     {
@@ -844,7 +993,7 @@
                         }
                     }
 
-                    if ($_GET["edit_all"])
+                    if ($_REQUEST["edit_all"])
                     {
                         echo "<textarea name=\"sug_$string_id\"  class=\"indic_ime\" ".
                             "cols =\"40\" rows = \"2\">$display_sug</textarea>\n";
@@ -865,7 +1014,7 @@
                             }
                             else
                             {
-                                $pos_select  = "&scrollPos=".$_GET["scrollPos"];
+                                $pos_select  = "&scrollPos=".$_REQUEST["scrollPos"];
                                 $pos_replace = "";
                                 $next_string = str_replace($select, $replace, $_SERVER['REQUEST_URI']);
                                 $next_string = str_replace($skip_0, $skip_1, $next_string);
@@ -888,7 +1037,7 @@
                             </tr>
                             <tr>
                           <td  align="left">
-                                <a href="#" onClick="submitAndMove()" ><img 
+                                <a href="#" onClick="return submitAndMove()" ><img 
                             src="images/submit.png" alt="Submit"></a>
                           </td>
                           <td align="center">
@@ -949,34 +1098,34 @@
                     echo "</div>\n";
                     echo "</td>\n";
 
-                    echo "<td width=\"10\" align=\"center\" bgcolor=\"$backimg\">\n";
-                    if ($_GET["edit_all"])
+                    echo "<td width=\"10\" align=\"center\" bgcolor=\"$backimg\" name=\"edit_button\">\n";
+                    if ($_REQUEST["edit_all"])
                     {
                         echo "<input type=\"checkbox\" class=\"checkstring\" ".
                             "name=\"select_$string_id\" value=\"yes\">\n";
                     }
                     else if ($hide_edit_icon)
                     {
-                        $find_edit          = $_GET["edit"];
+                        $find_edit          = $_REQUEST["edit"];
                         $replace_edit       = "";
-                        $find_skip          = $_GET["skip"];
+                        $find_skip          = $_REQUEST["skip"];
                         $replace_skip       = "";
-                        $find_scrollPos     = $_GET["scrollPos"];
+                        $find_scrollPos     = $_REQUEST["scrollPos"];
 
                         $arg = "'$find_edit','$replace_edit','$find_skip','$replace_skip',";
                         $arg .= "'$find_scrollPos'";
-                        echo '<a href="" onClick="return reDirect('.$arg.');">'.
+                        echo '<a name="close_button" href="" onClick="return close();">'.
                             '<img src="images/close.png" alt="Close"></a>';
 
                         $hide_edit_icon = 0;
                     }
                     else 
                     {
-                        $find_edit          = $_GET["edit"];
+                        $find_edit          = $_REQUEST["edit"];
                         $replace_edit       = $string_id;
-                        $find_skip          = $_GET["skip"];
+                        $find_skip          = $_REQUEST["skip"];
                         $replace_skip       = "0";
-                        $find_scrollPos     = $_GET["scrollPos"];
+                        $find_scrollPos     = $_REQUEST["scrollPos"];
 
                         $arg  = "'$find_edit','$replace_edit','$find_skip','$replace_skip',";
                         $arg .= "'$find_scrollPos'";
@@ -1174,7 +1323,7 @@
                         }
                         else
                         {
-                            $pos_select  = "&scrollPos=".$_GET["scrollPos"];
+                            $pos_select  = "&scrollPos=".$_REQUEST["scrollPos"];
                             $pos_replace = "";
                             $next_string = str_replace($select, $replace, $_SERVER['REQUEST_URI']);
                             $next_string = str_replace($skip_0, $skip_1, $next_string);
@@ -1191,13 +1340,12 @@
                             <tr>
                             <td colspan="3">
                                     <textarea name="user_sug" class="indic_ime" 
-                                    cols  = "50" rows = "2"><?php 
-                            echo $display_sug; ?></textarea>
+                                    cols  = "50" rows = "2"><?php echo $display_sug; ?></textarea>
                             </td>
                         </tr>
                         <tr>
                             <td  align="left">
-                                    <a href="#" onClick="submitAndMove()" ><img 
+                                    <a href="#" onClick="return submitAndMove()" ><img 
                                src="images/submit.png" alt="Submit"></a>
                             </td>
                             <td align="center">
@@ -1242,11 +1390,11 @@
 <?php			   }
 else if ($hide_edit_icon)
 {
-    $find_edit          = $_GET["edit"];
+    $find_edit          = $_REQUEST["edit"];
     $replace_edit       = "";
-    $find_skip          = $_GET["skip"];
+    $find_skip          = $_REQUEST["skip"];
     $replace_skip       = "";
-    $find_scrollPos     = $_GET["scrollPos"];
+    $find_scrollPos     = $_REQUEST["scrollPos"];
 
     $arg = "'$find_edit','$replace_edit','$find_skip','$replace_skip',";
     $arg .= "'$find_scrollPos'";
@@ -1257,11 +1405,11 @@
 }
 else
 {
-    $find_edit          = $_GET["edit"];
+    $find_edit          = $_REQUEST["edit"];
     $replace_edit       = $string_id;
-    $find_skip          = $_GET["skip"];
+    $find_skip          = $_REQUEST["skip"];
     $replace_skip       = "0";
-    $find_scrollPos     = $_GET["scrollPos"];
+    $find_scrollPos     = $_REQUEST["scrollPos"];
 
     $arg = "'$find_edit','$replace_edit','$find_skip','$replace_skip',";
     $arg .= "'$find_scrollPos'";
@@ -1301,13 +1449,13 @@
                </tr>		
 <?php
             }
-
+        $last_page_sid = $row_list[0];
         }while($row_list = mysql_fetch_row($list_result));
 ?>
 
     </table>
 <?php
-        if ($_GET["edit_all"])
+        if ($_REQUEST["edit_all"])
         {
             echo "\n</form>";
         }		
@@ -1409,7 +1557,7 @@
 
     <script type="text/javascript">
     <!--
-        var scrollPos = "<?php echo "{$_GET['scrollPos']}"; ?>";
+        var scrollPos = "<?php echo "{$_REQUEST['scrollPos']}"; ?>";
     if(!scrollPos)
         scrollPos = 0;
 
@@ -1420,7 +1568,24 @@
 <?php
 
     mysql_close($db);
+?>
 
-    include ("footer.php");
+<form name="ajax_patch_info">
+    <input type="hidden" name="first_page_sid" value="<?php echo $first_page_sid ?>">
+    <input type="hidden" name="last_page_sid" value="<?php echo $last_page_sid ?>">
+</form>
 
+<form name="ajax_patch_sid_info">
+<?php
+      foreach($sidArray as $key => $value) {
+?>
+    <input type="hidden" name="sids" value="<?php echo $value ?>">
+<?php
+    }
+?>
+</form>
+
+<?php
+    include ("footer.php");
+}
 ?>
diff -urN entrans/scripts/list.js entrans_ajax/scripts/list.js
--- entrans/scripts/list.js	2006-05-15 18:39:59.000000000 +0530
+++ entrans_ajax/scripts/list.js	2008-04-02 20:23:17.000000000 +0530
@@ -26,6 +26,9 @@
 var iexplore = !window.opera && (window.event || document.all); 
 var classAttrib = (iexplore)? "className":"class";
 var scriptFilePath = "scripts/";
+var oldInnerHTML;
+var oldsid;
+var onePageLimit = 100; // page limit
 
 document.onkeypress = eventCaptured;// For IE & Netscape
 document.onkeydown = ieEvent;  //for IE
@@ -92,7 +95,7 @@
                 break;
         }
         if(keyCode == 13 && target.type == "textarea" && target.getAttribute(classAttrib) == "indic_ime") {
-            submitAndMove();
+            return submitAndMove();
         }
 
         return;
@@ -150,10 +153,24 @@
     window.scrollTo(0,scrollTop);
 }
 
+// Changed function for AJAX patch
 function reDirect(f_edit,r_edit,f_skip,r_skip,f_scrollPos)
 {
+
+    var first_page_sid = document.ajax_patch_info.first_page_sid.value;
+    var last_page_sid = document.ajax_patch_info.last_page_sid.value;
+
     var href = window.location.pathname + window.location.search;
-    var new_href;
+    form = document.getElementsByName('edit_form')[0];
+
+    if(form) {
+	string_id = document.edit_form.string_id.value;
+	if(confirm("Your old changes in previous textarea will be discarded.\n Are you sure to continue?")) {
+	    close_edit(string_id);
+	} else {
+	    return false;
+	}
+    }
 
     href = href.replace("&edit=" + f_edit,"");
     if(r_edit != "")
@@ -165,9 +182,15 @@
 
     href = href.replace("&scrollPos=" + f_scrollPos,"");
     href += "&scrollPos=" + getScrollPos();
+    href += "&ajax=1";
+    href += "&edit_query=1";
 
-    window.location	= href;
+    sendAsynch(href, r_edit, 0); 
 
+    if (parseInt(r_edit) <= last_page_sid) {
+	edit_button = document.getElementsByName('edit_button')[parseInt(getIndex(r_edit))];
+	edit_button.innerHTML = '<a onClick=" return close_edit('+ r_edit +');" href=""><img src="images/close.png" alt="Close"></a>';
+    }
     return false;               //to stop loading the anchor's href
 }
 
@@ -242,6 +265,9 @@
 
 function submitAndMove()
 {
+    var first_page_sid = document.ajax_patch_info.first_page_sid.value;
+    var last_page_sid = document.ajax_patch_info.last_page_sid.value;
+
     var lang_sug    = document.edit_form.lang_sug.value;
     if (!lang_sug)
     {
@@ -252,8 +278,109 @@
     var loc = document.getElementsByName('edit_form')[0].action;
     loc += "&scrollPos=" + getScrollPos();
 
-    document.getElementsByName('edit_form')[0].action = loc;
-    document.edit_form.submit();
+    
+    var string_id = document.edit_form.string_id.value;
+    var fuzzy =  document.edit_form.fuzzy.value;
+    var user_sug =  document.edit_form.user_sug.value;
+
+    var ajax = 1; // prevents html generation in case call is from AJAX
+
+    loc += "&string_id="+ string_id + "&lang_sug=" + lang_sug + "&fuzzy=" + fuzzy + "&user_sug=" + user_sug + "&ajax=" +ajax + "&edit_query=0";  
+
+    // Ajax call
+    sendAsynch(loc, string_id, 1);
+    
+    return false;
+}
+
+// Returns index for corresponding string id
+function getIndex(string_id) {
+    var sidArray = document.getElementsByName('sids');
+    for (var index=0; index<=sidArray.length; index++) {
+	if(sidArray[index].value == string_id) {
+	    return index;
+	}
+    }
+}
+
+// Returns string id for corresponding index
+function getSid(index) {
+    var sidArray = document.getElementsByName('sids');
+    if (index >= sidArray.length) {
+	return false;
+    }
+    return sidArray[parseInt(index)].value;
+}
+
+// queryStr: AJAX query
+// string_id: Current string id
+// nextflag: if true we requery for next string id
+function sendAsynch(queryStr, string_id, nextflag){
+    var last_page_sid = document.ajax_patch_info.last_page_sid.value;
+    if (parseInt(string_id) > last_page_sid) {
+	return false;
+    }
+
+    // post AJAX query 
+    var oXmlHttp = crtHTTPObject(); 
+    oXmlHttp.open("post", queryStr, true);
+
+    oXmlHttp.onreadystatechange = function () {
+        if (oXmlHttp.readyState == 4) {
+    		if (oXmlHttp.status == 200) {
+		    
+		    // Record response
+		    var response = oXmlHttp.responseText;
+
+		    if (nextflag) {
+			// Submit query
+
+			var currentdiv = document.getElementsByName('edit_using_ajax')[getIndex(string_id)];
+			var next_string_id = getSid(getIndex(string_id) + 1);
+
+			currentdiv.innerHTML = response;
+			
+			// Change edit button to close button
+			edit_button = document.getElementsByName('edit_button')[parseInt(getIndex(string_id))];
+			edit_button.innerHTML = '<a href="" onClick="return reDirect(\'\',' + string_id + ',\'\',\'0\',\'\');"><img src="images/edit.png" alt="Edit"></a>';
+
+			//close_edit(string_id);
+
+			// Special case for last page element
+			if(!next_string_id) {
+			    return false;
+			}
+
+			// Edit next element. Default behaviour
+			reDirect('',next_string_id,'','0','');
+		    } else {
+			// Edit query
+
+			var currentdiv = document.getElementsByName('edit_using_ajax')[getIndex(string_id)];
+			oldInnerHTML = currentdiv.innerHTML;
+			
+			currentdiv.innerHTML = response;
+		    }
+    		} else {
+		    alert("An error occurred: <br>"+ oXmlHttp.statusText);
+    		}
+        }
+    };
+    oXmlHttp.send(null);
+    return true;        
+}
+
+// Change close button to edit
+function close_edit(string_id)
+{
+    var currentdiv = document.getElementsByName('edit_using_ajax')[parseInt(getIndex(string_id))];
+    currentdiv.innerHTML = oldInnerHTML;
+    
+    // Inserting HTML for edit button
+    edit_button = document.getElementsByName('edit_button')[parseInt(getIndex(string_id))];
+    edit_button.innerHTML = '<a href="" onClick="return reDirect(\'\',' + string_id + ',\'\',\'0\',\'\');"><img src="images/edit.png" alt="Edit"></a>';
+
+    return false;
 }
 
 function submitAllAndMove()
@@ -327,3 +454,25 @@
 
     window.location = new_href;
 }
+
+function crtHTTPObject(){
+    if (typeof XMLHttpRequest != "undefined") {
+	return new XMLHttpRequest();
+    } else if (window.ActiveXObject) {
+	var aVersions = [ "MSXML2.XMLHttp.5.0",
+			  "MSXML2.XMLHttp.4.0","MSXML2.XMLHttp.3.0",
+			  "MSXML2.XMLHttp","Microsoft.XMLHttp"
+			  ];
+	for (var i = 0; i < aVersions.length; i++) {
+	    try {
+		var oXmlHttp = new ActiveXObject(aVersions[i]);
+		return oXmlHttp;
+	    } catch (oError) {
+		//Do nothing
+	    }
+	}
+    }
+    throw new Error("XMLHttp object could not be created.");
+}
+
+