http://fiddle.jshell.net/rH3gx/2/
You need to wrap the function in a function which requires no arguments:
function myFunction(myParam, tries){
if (typeof tries == "undefined"){
tries = 0;
}
tries++;
if (tries < 2){
setTimeout(function() {
myFunction(myParam, tries);
}, 50);
}
}
myFunction("something");