var fwescortparts = { load: function(timer) { var timer = timer; // If we look ten times, and don't find fwescort, clear out if(timer === 10) return clearTimeout(fwescortparts.timerHold); if(typeof fwescort !== "undefined" && typeof fwescort.fw_i === "function") { fwescort.fw_i({ un: 'worlddirectory', np: 0, prov: 0, cd: 13141, ll: 14634, cat: '003', al: 2 }); } else { fwescortparts.timerHold = setTimeout(function() { fwescortparts.load(timer++); }, 300); } }, timerHold: null }; (function() { fwescortparts.load(1); })();