I've number of rows, i need to take the rowindex of the selected row and pass it as parameter to swapUp or swapDown methods which are called when user selects a row and clicks on Up or Down button

Code:
<html>
<head>
<body>
<form name="myForm">

 <table id="mainTable" border="1" width="100%">

   <script>
...