Add field Last released version

Hi, 

I want to show the last Revision Released in the document form .

I added a text field in the form and a methode on the event onformPopulated of the form .

The code of this method is actualy :

    if (propName == "last_major_rev_released") {
        elements[i].value ="The last rev. released"

     //code to get the last revision released
  }

So the text The last rev. released is showed in the field.

Can you help me to write  the code (javascript) to get the last revision released ?