Chickening out of Duels.com

Hey,

A little more work, and here I have ,the ChickenFoot script to issue challenges to all my equals. The script is still within the boundaries of the game, all that this script does is remove the pain of manually challenging the players.
Before we get into the details of the script, a quick note on why I chose chicken foot over any other way of doing it. Apparently , chickenfoot is like greasemonkey (on steroids) spread across pages. I would still classify it as a web automation tool. The libraries that it has are good enough to do quick and dirty scripting.
Anyone with basic knowledge on how it works can cook up something like the following scriptlet.

The script is to be executed when on the battle page, viewing duelists. It challenges all players that are displayed in the current battle page. This allows the customization of the et of players who are challenged, to include only online players, only NPCs, filtered by levels, etc.
The script starts scraping the page by looking at the table with the "playerLists"id. It navigates to the child "tr" elements and picks up the URLs of all the duelists in the page. After saving it to an array, the script then start for all duelists in the array, go to their page, click on the challenge button. Then submits the next 2 forms that correspond to selection of the scroll and path power respectively. For now, I have hardcoded them, but it can be made a default selection.
On closer inspection, you would realize that the document.forms are submitted only when the page is loaded.
The final script looks something like this.

wait();
clear();
output("=====Starting to issue challenges=====");
var challengeList;
for (table = find("table"); table.hasMatch; table = table.next)
{
if (table.element && table.element.id == "playerlist")
{
challengeList = table.element;
}
}

var contestants = [];
challengeList = challengeList.childNodes[1];
for (var i = 2; i <>
{
if (challengeList.childNodes[i].childNodes[3])
{
contestants.push(challengeList.childNodes[i].childNodes[3].childNodes[0].href);
}
}

for (m in contestants)
{
go(contestants[m],true);
wait();
output("Challenging : " + contestants[m]);
var m = find("challenge");
if (m.element && m.element.src == "http://images.duels.com/images/button_challenge_grey.gif")
{
output("--There is already an outstanding challenge");
}
else
{
wait();
whenLoaded(function(){click(find("challenge").element);});
wait();
whenLoaded(function(){document.forms[0].submit();});
wait();
whenLoaded(function()
{
insert(after("Openers"),"<input value = '214' name = 'data[SkillsRank][SkillsRank][]' >");
document.forms[0].submit();
}
);
wait();
output("--challenge issued")
}
}

output("=======All challenges issued========")


[Please note that the script has a syntax error. I dont want to promote cheating in the game. People who are smart enough to fix the syntax error already know how to write the script. If you still want the script, ping me.]