I am trying to implement a system like googlemail where emails are removed using AJAX.

I am using the prototype library here....

I have my emails displayed in a HTML table, which is wrapped in a form

HTML Code:
<form name="ajaxmail">
<table id="emails">
	      <th><a href="#" onclick="delete_emails()">delete</a></th>
      <td><input type="checkbox" name="MessageNumber" value="#MessageNumber#" id="MessageNumber"><label for="#MessageNumber#">Delete #MessageNumber#</label></td>
The ajax for the delete_emails() function is

 function delete_emails() {
		 var messagenumber = $F('MessageNumber');
	     var url = '/ajax/emails_remove.cfm';
         var pars = 'messagenumber='+ messagenumber;
         var target = 'delete_success';
         var myAjax = new Ajax.Updater(target, url, {method:'post', parameters:pars});

So the id of the checkbox which is checked is passed to the ajax call and added to the var pars...eg =messagenumber = 22

then the action page for the ajax "emails_remove.cfm", which contains the code to remove the relevant email by the id....

HTML Code:
<!--- contact POP server and delete the message --->
<cfpop action="delete" messagenumber="#FORM.messagenumber#"
username="namtax@musicexplained.co.uk" password="dryryzer">..
However, the issue im having is that if the id of the email is greater than 9, the ajax call doesnt delete the email at all, and if i check more than one checkbox, the ajax call only deletes one email....

Hope this makes sense, any help would be appreciated