var SelectAdType = function(core, target, data, returnCB){ var events = new EventManager, element; apiRequest("GET", "billing", core.userID, null, init); function init(d) { var allow3rdParty = core.brand.name === 'Sito Mobile' || d.isIO || core.agencyID === '3012', adLinks = [new Anchor('/dashboard/ads/banners/upload', 'Upload')].concat( allow3rdParty ? [new Anchor('/dashboard/ads/thirdParty/upload', 'Third Party', 'grey')] : [] ), adTypes = [ new AdType("Upload Banner Ads", "bannerAdsPlaceholder.png", 1, adLinks), new AdType("Upload Mobile Ads", "mobileAdsPlaceholder.png", 2, adLinks), new AdType("Create Dynamic ads", "dynamicAdExample1_300x250.png", 5, [new Anchor('/dashboard/ads/dynamic/create')]), ], template = new Template; element = getElementFromString(render(template.index, { 'adTypes' : adTypes })); forEach(element.querySelectorAll('a'), bindAnchor); returnCB(); target.appendChild(element); } this.exit = exit; function Template(){ var title = '

{{ displayNumber }}.) {{ title }}

', img = '{{# img }}{{/ img }}', anchors = '{{# anchors }}{{ title }}{{/ anchors }}', container = '' + img + anchors + ''; this.index = '
{{# adTypes }}
' + title + container + '
{{/ adTypes }}
'; } function AdType(title, img, i, anchors){ this.title = title; this.img = "/public/images/adBuilder/" + img; this.displayNumber = i; this.anchors = anchors; } function Anchor(href, title, className){ this.href = href; this.title = title || 'Get Started'; this.className = className || 'mint'; } function bindAnchor(t){ events.add(t, 'click', popAnchor); } function exit(){ if(element) removeChild(target, element); if(events) events.reset(); housekeeping(); } function housekeeping(){ adTypes = template = element = events = null; } };