var CreateTextAds = function(core, target, data, returnCB){ var tool = null; this.exit = exit;; run(); function run(){ var adFields = [ { 'title' : 'Title', 'key' : 'adTitle', 'className' : 'adTitle', 'reference' : 'adTitle' }, { 'title' : 'Text', 'key' : 'adText', 'className' : 'adText', 'reference' : 'adText' }, { 'title' : 'Button Text', 'key' : 'buttonText', 'className' : 'buttonText', 'reference' : 'buttonText' }, { 'title' : 'Landing Page', 'key' : 'landingURL', 'className' : 'landingURL', 'reference' : 'locationURL', 'fn' : isValidURL, 'errorMessage' : 'Please ensure you have entered a valid URL' } ], adText = 'Your body text goes here to attract new customers to your site.', adData = [{ 'adTitle' : 'YOUR-Site.com', 'adText' : adText, 'buttonText' : 'Button Text' }]; tool = new AdCreationTool(core, target, data, returnCB, 'Text', adFields, adData, new TextAdTemplate, 300, 250, false, true); } function exit(){ if(isDefined(tool)) tool.exit(); housekeeping(); } function housekeeping(){ tool = null; } };