if (!quad_oax .static.initialized) with (quad_oax) { trace('initializing static'); static.fstarts = []; static.evlog = nslog_oax; static.evlog.s += ' BS'; try {x.x.x} catch(e) {static.fstarts.push(['conf', e.lineNumber, 0])}; conf.prefix = 'oax'; conf.placementPrefix = 'QAPS_OAX'; conf.version = '71'; conf.enableRaports = true; conf.raportLimit = 10; conf.maxContent = '600'; conf.defaultTimeout = 400; conf.coile = 100; conf.mod100 = 55; conf.doneStats = 100; conf.pscript_prefix = 'x___x'; conf.pscript_ecdef = 'extra_content'; conf.retries = 1000; conf.write_form_retries = 20; conf.enableOneLineForms = false; conf.allowForceEx = false; conf.tag_boost = {h1: 2, h2: 2, h3: 2, h4: 2, h5: 2, h6: 2, bold: 2, strong: 2, em: 2, i: 2, u: 2}; conf.whiteChars_str = '!@#$$%^&*()_+-=[]{};\':",/?\\|<>\n\t\r '; conf.blockChars_str = unescape('%A0'); conf.adc_skip_tags = ['SCRIPT', 'STYLE', 'SELECT', 'A', 'NOSCRIPT']; conf.trim_chars = '.'; conf.defaultSysoColor = 'gray'; conf.subframeSysoColor = 'brown'; conf.enableLandingPageParams = true; conf.ads_limit = 20; conf.defaultFont = 'Arial'; conf.allowedFonts = '#Arial#'; conf.allowSamePlacementIds = true; conf.ignoreSamePlacementIds = false; conf.longTimeout = 15000; conf.enableAKPlacements = false; conf.localDbg = false; conf.allowOnlyMeta = 1; conf.minFS = 9; conf.maxFS = 14; conf.labelsCnt = 11; conf.minWordLength = 4; conf.enableC2a = false; conf.c2aText = unescape(''); conf.c2aShortText = unescape(''); conf.c2aColor = '#0000FF'; //deprecated conf.c2aFS = 10; conf.c2aWidth = 30; conf.c2aShortWidth = 30; conf.encoding = 'UTF-8'; conf.enableCopyAds = true; conf.enders = []; conf.enders_no = []; conf.enders_ne = []; conf.emptyBoxes = true; conf.noClickurlTrash = false; conf.adWarnInnerHTML = false; conf.ad_warn_function = function(form) {//TODO if (form.showHeader === 'f') return null; if (form.showHeader != 't' && !conf.default_show_header) return null; return {height: 15, text: 'annonce'}; }; conf.twoLetterWords = '11,12,14,15,16,18,19,20,21,25,2_,30,33,3G,3_,3g,45,4G,4L,4_,50,55,57,5_,60,62,65,66,6_,75,80,88,8C,8_,90,96,99,9_,A1,A2,A3,A4,A5,A6,A8,AC,AE,AX,A_,BH,BX,B_,C1,C2,C3,C4,C5,C6,C8,CA,CI,CX,C_,DG,E3,E9,F1,F6,F8,F_,Fi,G6,GE,GS,GT,H1,H2,H3,HA,HD,IT,J2,J5,J7,KZ,K_,Ka,M1,M3,M5,M6,MG,OB,P4,P6,P7,PB,PD,PV,Q5,Q7,R8,S1,S2,S3,S4,S5,S6,S8,SA,SK,SM,S_,T1,T2,TA,TC,TD,TF,TL,TN,TS,TT,T_,V8,VW,X1,X3,X5,X6,XF,XJ,XK,XM,XT,Y_,Z1,Z3,Z4,Z8,ZR,ZS,ZT,ZX,cv,el,em,f2,f3,fc,hk,hr,iQ,is,ka,ko,ll,lo,læ,mc,ol,pa,pc,q8,si,sø,te,tv,ur,vm,ål,øl'; conf.textLabelWidth = 65; conf.labelText = 'Open AdExchange'; conf.labelSizes = function() {return {vx: 15, vy: 60, hx: 106, hy: 15};}; conf.adc_akon_url = 'https://tracead.com/clickHandler.php?sId=2837&bId=65743'; conf.adc_akon_href = 'https://tracead.com/clickHandler.php?sId=2837&bId=65743'; conf.imgBottomColors = '#000000#7777FF#FF7700#444444#'; conf.img_text_label_width = 100; conf.img_text_label = 'Open AdExchange'; conf.enableAZ = false; conf.azInNewPage = false; conf.az_text = unescape(''); conf.az_shortText = unescape(''); conf.az_longText = unescape('') + ' '; conf.azAlign = 'left'; conf.azFS = 11; conf.azCB = 1; conf.azBB = 0.2; conf.azBold = true; conf.azUnderline = true; conf.moreAZ = false; conf.flashLabelWidth = 129; conf.flashLabelHeight = 17; conf.flashLabelSmall = 23; conf.az_ifheight = 720; conf.az_ifwidth = 310; conf.azbgimgs = ['buttons/160x150.PNG', 'buttons/234x60.PNG', 'buttons/300x100.PNG', 'buttons/468x60.PNG']; conf.cssOptions = 0; //***************************************************************************** conf.noCache = '1336352101661_e84b09b3c8b5cc73e61bd9d084a18e3b4a027768'; conf.ctr_url = 'http://adserver3.openadex.dk/c/c/?d=_D_&u=_UE_&e=_E_'; conf.vimgurl = 'http://adserver3.openadex.dk/_/static/oax/script_gen/labels/pion**.png?no_cache=1336352101661_e84b09b3c8b5cc73e61bd9d084a18e3b4a027768'; conf.himgurl = 'http://adserver3.openadex.dk/_/static/oax/script_gen/labels/poziom**.png?no_cache=1336352101661_e84b09b3c8b5cc73e61bd9d084a18e3b4a027768'; conf.adtesterUrl = 'http://mandie2.netsprint.net/secure/tomek/'; conf.spliter2Url = 'http://adserver3.openadex.dk/quad/spliter/?prid=_PRID_&caid=_CAID_&nc=_NC_&cc=_CC_&form=_FORM_&iid=_IID_&content=_CONTENT_&extra=_EXTRA_'; conf.spliter3Url = 'http://adserver3.openadex.dk/quad/spliter/?prid=_PRID_&caid=_CAID_&nc=_NC_&cc=_CC_&form=_FORM_&iid=_IID_&content=_CONTENT_&qnr=_QN_&without=_WO_&extra=_EXTRA_'; conf.adFrameUrl = 'http://adserver3.openadex.dk/quad/spliter/?prid=_PRID_&caid=_CAID_&nc=_NC_&cc=_CC_&form=_FORM_&iid=_IID_&jsdata=_FDEF_&bts=_IDS_&ref=_REF_'; conf.azUrls = [ 'http://panel.netsprint.pl/autoOrder/index?domain=_DOM_&cid=_CAID_&pid=_PRID_&utm_source=Adkontekst&utm_medium=kupreklame&utm_term=_EREF_&utm_campaign=layer&nc=_NC_', 'http://adserver3.openadex.dk/autoOrder/index?domain=_DOM_&cid=_CAID_&pid=_PRID_&nc=_NC_' ]; conf.azPrefix = 'http://adserver3.openadex.dk/_/static/akon/autozamowienie/'; conf.raportUrl = 'http://adserver3.openadex.dk/_/raport/?ft=box&'; conf.tp_url = unescape(''); conf.host = 'adserver3.openadex.dk'; conf.getParamsUrl = 'http://adserver3.openadex.dk/_/pb/?prid=_PRID_&caid=_CAID_&p=_PLIDS_&prefix=_PREFIX_&no_cache=1336352101661_e84b09b3c8b5cc73e61bd9d084a18e3b4a027768'; //w innym parametrze --- TODO if(typeof(spliter) != "undefined"){ conf.getParamsUrl+='&no_cache_chan='+spliter.lastChangeForChannel; } conf.imager_url_template = 'http://adserver3.openadex.dk/_/getImageII?vid=_ID_&typ=_TYP_&element=_ELEMENT_&nc=_TS_'; conf.flash_label_url = 'http://adserver3.openadex.dk/_/static/oax/script_gen/labels/metka_08.png?no_cache=1336352101661_e84b09b3c8b5cc73e61bd9d084a18e3b4a027768'; conf.azgaurl = 'http://ad.hit.gemius.pl/hitredir/id=.WqVhm_brTxgwVaRdbrcZZbffQrsJu7_ZbngHvx5yVv.57/stparam=wgrmiuknxi/%3F&url=_AZU_'; conf.azHelpUrl = ''; conf.azConfirmText = 'Czy chcesz przerwac tworzenie kampanii?'; conf.azConfirmNeeded = true; conf.adTypes = { T: {name: 'box', imagers: {}}, F: {name: 'flash', imagers: {image: 'http://adserver3.openadex.dk/_/getImageII/?vid=_ID_&typ=flash&element=image&nc=_TS_', flash: 'http://adserver3.openadex.dk/_/getImageII/?vid=_ID_&typ=flash&element=flash&nc=_TS_'}}, L: {name: 'largeFlash', imagers: {image: 'http://adserver3.openadex.dk/_/getImageII/?vid=_ID_&typ=largeFlash&element=image&nc=_TS_', flash: 'http://adserver3.openadex.dk/_/getImageII/?vid=_ID_&typ=largeFlash&element=flash&nc=_TS_'}}, A: {name: 'awatar', imagers: {image: 'http://adserver3.openadex.dk/_/getImageII/?vid=_ID_&typ=awatar&element=image&nc=_TS_'}}, E: {name: 'exclusive_normal', imagers: {image: 'http://adserver3.openadex.dk/_/getImageII/?vid=_ID_&typ=exclusive_normal&element=image&nc=_TS_'}}, S: {name: 'exclusive_sky', imagers: {image: 'http://adserver3.openadex.dk/_/getImageII/?vid=_ID_&typ=exclusive_sky&element=image&nc=_TS_'}}, Z: {name: 'imgK', imagers: {image: 'http://adserver3.openadex.dk/_/getImageII/?vid=_ID_&typ=imgK&element=image&nc=_TS_'}}, Y: {name: 'imgSP', imagers: {image: 'http://adserver3.openadex.dk/_/getImageII/?vid=_ID_&typ=imgSP&element=image&nc=_TS_'}}, X: {name: 'imgDP', imagers: {image: 'http://adserver3.openadex.dk/_/getImageII/?vid=_ID_&typ=imgDP&element=image&nc=_TS_'}}, W: {name: 'imgDB', imagers: {image: 'http://adserver3.openadex.dk/_/getImageII/?vid=_ID_&typ=imgDB&element=image&nc=_TS_'}}, V: {name: 'imgSW', imagers: {image: 'http://adserver3.openadex.dk/_/getImageII/?vid=_ID_&typ=imgSW&element=image&nc=_TS_'}}, D: {name: 'csAvatar', imagers: {image: 'http://adserver3.openadex.dk/_/getImageII/?vid=_ID_&typ=csAvatar&element=image&nc=_TS_'}}, C: {name: 'csFavico', imagers: {}}, O: {name: 'csAd', imagers: {image: 'http://adserver3.openadex.dk/_/getImageII/?vid=_ID_&typ=csAd&element=image&nc=_TS_'}}, N: {name: 'nkbox', imagers: {image: 'http://adserver3.openadex.dk/_/getImageII/?vid=_ID_&typ=nkbox&element=image&nc=_TS_'}} }; try {x.x.x} catch(e) {static.fstarts.push(['utils', e.lineNumber, 0])}; Utils = function(conf, options) { var that = this; this.options = options; if (!options) this.options = function() {return false}; conf.get = function(str, def) { if (conf[str] != undefined) return conf[str]; if (def != undefined) return def; if (that.busy) return; that.busy = true; that.raport('J3', 'No required configuration paramerer', str); that.busy = false; throw str; } conf.getUrl = function(confParam, def) { return conf.get(confParam, def) .replace(/_HOST_/g, conf.get('host')) .replace(/_PREFIX_/g, conf.get('prefix')) .replace(/_START_/g, conf.get('noCache')) .replace(/_NOW_/g, that.now()) ; } this.duzo = 1000000000; this.sendstatlimit = 100; this.errors = []; this.raportLimit = conf.get('raportLimit', 5); this.version = conf.get('version'); this.rndId = Math.floor(this.duzo * Math.random()); this.errcnt = 0; this.stageNo = 0; this.notDone = true; this.timeArr = {}; this.lastTime = 0; this.currTask = null; this._dbg_ = {}; this._dbgc_ = {}; this.trash = []; this.fstarts = []; this.excList = []; this.tmp_state = {}; this.busy_f = {}; this.s1cache = {}; this.reportsByType = {}; this.todo = []; this.evlog = {s:'0'}; this.ie = navigator.appVersion.indexOf('MSIE') >= 0; this.ie6 = navigator.appVersion.indexOf('MSIE 6') >= 0; this.adTypes = { text: 'T', box: 'T', skyscraper: 'S', exclusive_sky: 'S', rectangle: 'E', billboard: 'E', exclusive: 'G', exclusive_normal: 'E', flash: 'F', avatar: 'A', awatar: 'A', imgK: 'Z', imgSP: 'Y', imgsp: 'Y', imgDP: 'X', imgDB: 'W', imgSW: 'V', imgMP: 'U', imgMF: 'M', csAd: 'O', nkbox: 'N', largeflash: 'L' }; var ats = conf.get('adTypes'); for (var at in ats) { this.adTypes[ats[at].name] = at; } this.show_rect = function() {}; this.show_point = function() {}; this.printRect = function() {}; this.show_tmp_state = function() {}; this.insert_ix_dbg = function() {}; this.printTimes = function() {}; this.dbgAlterForms = function() {}; this.addBoxDbg1 = function() {}; this.replaceAds = function() {}; this.getImager = function(box, ktory) { ktory = that.ifnull(ktory, 'image'); if (box[ktory]) return box[ktory].replace('_MOD3_', Math.floor(Math.random() * 3)); var typ = that.ifnull(that.adTypes[box.typ], box.typ); typ = conf.get('adTypes')[typ]; if (!typ || !typ.imagers[ktory]) { that.raport('S1-', 'unknown imager', box.typ + '.' + ktory); return null; } return typ.imagers[ktory] .replace(/_ID_/g, box.id) .replace(/_TYP_/g, box.typ) .replace(/_ELEMENT_/g, ktory) .replace(/_TS_/g, box.timestamp) + (options('no_cache') ? '&nc2=' + that.now() : ''); } this.emptyAd = function() { return {title: '', desc: '', url: '', opis1: '', opis2: ''}; } this.co100 = function(coile) { var sto = that.ifnull(coile, conf.get('coile')); return that.rndId % sto === conf.get('mod100') % sto; } this.syso1 = function(str) { if (that.s1cache[str]) return trace(str); that.s1cache[str] = true; syso(str); } this.now = function() { return (new Date()).getTime(); } this.byId = function(id) { return document.getElementById(id); } this.cel = function(par, tag) { var el = document.createElement(tag); if (par) par.appendChild(el); return el; } this.cel_back = function(par, tag) { if (!par.firstChild) return that.cel(par, tag); var el = document.createElement(tag); par.insertBefore(el, par.firstChild); return el; } this.ctn = function(par, txt) { par.appendChild(document.createTextNode(txt)); } this.rm = function(node) { node.parentNode.removeChild(node); } this.clr = function(node) { while (node.firstChild) node.removeChild(node.firstChild); } this.createIframe = function(node, x, y, src) { if (that.ie && src) { for (var i=0; i= 0) return 'dbg_utils ' + lno; } catch(e) {} try { if (that.fstarts_closed === undefined) { that.fstarts_closed = true; that.fstarts.push('end', 100000, 0); syso('no line number table'); return '-'; } for (var i=0; i 0) && (exc === 'retry')) { return setTimeout(function() { that.syso1('retrying: ' + str); ret(rt - 1, a, b, c, d, e, false); }, firsttry ? 0 : utils.ifnull(to, conf.get('defaultTimeout'))); } else if (rt > 0) { that.ftry(str + '_failed', that.apply(oncomplete, false, a, b, c, d, e))(); that.errors.push(exc); that.exc(str, exc); } else { that.ftry(str + '_timeout', that.apply(oncomplete, null, a, b, c, d, e))(); that.raport('J1-', 'all tries failed', str); } } } return function(a, b, c, d, e) { return ret(retries, a, b, c, d, e, true); }; } this.onlyOnce = function(f, name, uniqParams) { if (name === undefined) name = f+''; return function(p1, p2, p3, p4, p5) { if (uniqParams) name += ' - ' + p1 + ',' + p2 + ',' + p3 + ',' + p4 + ',' + p5; if (that.busy_f[name]) return trace('not invoking: ' + name); that.busy_f[name] = true; setTimeout(function() { that.busy_f[name] = false; }, 0); f(p1, p2, p3, p4, p5); } } this.sendstat = function(str) { if (that.sendstatlimit-- < 0) return syso('reporting failed: ' + str, 'pink'); if (conf.get('enableRaports') === false) return syso('not reporting: ' + str); if (document.readyState === 'loading' || document.readyState === 'interactive') { return setTimeout(that.apply(that.sendstat, str), conf.get('defaultTimeout')); } if (that.raportLimit < 0) return syso('raport limit exceeded: ' + str); var logImage = that.byId('nsc_log_img_'+conf.get('prefix')+'_'+that.rndId+'_'+that.sendstatlimit); if (logImage === null) { logImage = new Image(1, 1); logImage.id = 'nsc_log_img_'+conf.get('prefix'); logImage.style.position = 'absolute'; logImage.style.left = '0px'; logImage.style.top = '0px'; document.body.appendChild(logImage); } else if (!logImage.complete) { syso('cannot happen', 'red'); return setTimeout(that.apply(that.sendstat, str), conf.get('defaultTimeout')); } that.raportLimit--; str = str.replace(/\s/g, '_').replace(/\{.*\}/g, '[...]').substring(0, 200); var resolution = 'unknown'; try { resolution = screen.width + 'x' + screen.height; } catch(e) {} logImage.src = conf.get('raportUrl') + 'version=' + that.version + '&rnd=' + that.rndId + (that.prid ? ('&prid='+that.prid) : '') + (that.caid ? ('&caid='+that.caid) : '') + (that.plid ? ('&plid='+that.plid) : '') + '&ie=' + (that.ie ? (that.ie6 ? '6' : 'T') : 'F') + '&evlog=' + (that.evlog.s.length <= 100 ? that.evlog.s.replace(/ /g, '_') : '-') + '&res=' + resolution + str; syso('reporting: ' + str.substring(1), 'white'); } this.exc = function(fname, exc, param) { try { if (that.fstarts.length > 0) { syso('reporting exception at: ' + that.getLno(exc) + ' (' + exc.lineNumber + ')', 'red'); } that.excList.push(exc); if (param === undefined) param = '-'; that.sendstat('&type=exception' + '&c=' + that.errcnt++ + '&fname=' + fname + '&e=' + that.ifnull(exc.message, '-') + '&lno=' + that.getLno(exc) + '¶m=' + param ); } catch(e) { syso('raporting failed: ' + e.lineNumber); } } this.raportParams = function(all, msg, param) { all = all.toLowerCase(); var ret = {msg: msg, param: param}; if (all.indexOf('s') >= 0) ret.cause = 'server'; if (all.indexOf('j') >= 0) ret.cause = 'js'; if (all.indexOf('p') >= 0) ret.cause = 'placement'; if (all.indexOf('1') >= 0) ret.sev = 1; if (all.indexOf('2') >= 0) ret.sev = 2; if (all.indexOf('3') >= 0) ret.sev = 3; if (all.indexOf('4') >= 0) ret.sev = 4; if (all.indexOf('o') >= 0) ret.old = true; if (all.indexOf('-') >= 0) ret.co100 = true; if (all.indexOf('f') >= 0) ret.c0 = true; return ret; } this.report_prv = function(all, msg, param, stray) { try { if (stray != undefined) { syso('stray params: ' + msg); that.later('stray', function() { that.raport('J1', 'stray raport params', msg); }); } if (typeof(all) === 'string') all = that.raportParams(all, msg, param); if (all.msg === undefined) all.msg = '-'; if (all.param === undefined) all.param = '-'; if (all.old === undefined) all.old = false; if (all.co100 === undefined) all.co100 = false; if (all.sev === undefined) all.sev = 0; if (all.cause === undefined) all.cause = 'unknown'; if (that.reportsByType[all.msg]) return trace(all.msg + ' - again'); that.reportsByType[all.msg] = all.param; var sysostr = all.msg + ': ' + all.param; var sysocolor = all.co100 ? 'navy' : ['yellow', 'gold', '#f50', 'red', '#70f'][all.sev]; if (all.co100 && !that.co100()) { return syso('not reporting - ' + sysostr, sysocolor); } syso('reporting - ' + sysostr, sysocolor); that.sendstat('&type=msg' + '&sev=' + all.sev + '&cause=' + all.cause + '&coile=' + (all.co100 ? conf.get('coile') : 1) + '&e=' + all.msg + '¶m=' + all.param + '&old=' + all.old + '&c=' + (all.c0 ? 0 : that.errcnt) ); if (all.sev > 0) that.errcnt++; } catch(e) { syso('reporting failed! ' + e.lineNumber, 'pink'); try { console.error(e); } catch(e1) {}; } } this.raport = this.report = this.report_prv; this.error = function(msg, param, old, co100) {//deprecated that.report_prv({sev: 2, msg: msg, param: param, old: old, co100: co100}); } this.warning = function(msg, param, old, co100) {//deprecated that.report_prv({sev: 1, msg: msg, param: param, old: old, co100: co100}); } this.placement = function(msg, param, old, co100) {//deprecated if (co100 === undefined) co100 = true; that.report_prv({sev: 2, msg: msg, param: param, old: old, co100: co100}); } this.info = function(msg, param, old, co100) {//deprecated that.report_prv({sev: 0, msg: msg, param: param, old: old, co100: co100}); } this.unknown = function(msg, param) {//deprecated that.report_prv({sev: 2, msg: msg, param: param}); } this.noAds = this.noAds0 = function(co100) { that.raport(co100 ? 'S3-o' : 'S3o', 'no ads'); that.stageNo = -1; } this.loadsc = function(href, nohead, enc) { if (!href) return that.raport('J2', 'no href'); if (that.options('no_cache')) href += '&noc=' + that.now(); syso('loading: ' + href.split('?')[0]); trace('params: ' + href); var sc = document.createElement('SCRIPT'); sc.src = href; sc.type = 'text/javascript'; sc.defer = false; sc.charset = that.ifnull(enc, conf.get('encoding')); var adc_head = document.getElementsByTagName('head'); if (adc_head[0] && !nohead) { adc_head[0].appendChild(sc); } else { that.raport('J1-', 'No head for document'); var where = document.body; if (typeof(nohead) === 'object') { if (nohead.parentNode) { where = nohead; } } where.appendChild(sc); } } this.start = function(taskName, nr) { var now = that.now(); if (that.currTask) { that.timeArr[that.currTask] += now - that.lastTime; } that.lastTime = now; that.currTask = taskName; if (taskName != null && that.timeArr[taskName] === undefined) { that.timeArr[taskName] = 0; } if (that.notDone && (nr === undefined || nr === 0)) { that.stageNo++; trace('stage ' + that.stageNo + ': ' + taskName); } } this.done = function(stats, type, coile) { if (coile === undefined) coile = conf.get('coile'); that.notDone = false; that.start(null); that.printTimes(); var msg = '&type=' + that.ifnull(type, 'done'); var total = 0; for (var i in that.timeArr) { if (i === 'null') continue; msg += '&'+i+'='+that.timeArr[i]; total += that.timeArr[i]; } for (var i in stats) { msg += '&'+i+'='+stats[i]; } if (that.co100(coile)) that.sendstat('&coile=' + coile + msg + '&total=' + total); } this.stages = function(n) { that.start('spliter1'); setTimeout(function() { if (that.evlog.s.split('BGI').length > 2) return that.raport('J2-', 'stray spliter call'); if (that.stageNo === n || that.stageNo === -1) return; if (that.stageNo > n) return syso('skipping script timeout check'); that.raport('S3-o', 'script died at stage', that.stageNo); }, conf.get('longTimeout')); if (!that.co100()) return; var to = Math.floor(that.rndId / that.duzo * conf.get('longTimeout')); setTimeout(function() { that.sendstat('&type=ok&t=' + to + '&max=' + conf.get('longTimeout')); syso('ok'); }, to); } this.checkVersion = function(co, v) { if (that.version+'' === v+'') return; if (that.version === '_' || v === '_' || options('betaIx') || options('static_src')) { return syso(co + ': skipping version chcek'); } that.raport('S1-', co + ' version mismatch', v); } this.later = function(name, f) { if (that.todo.length === 0) { setTimeout(that.ftry('later - ' + name, function() { syso('invoking ' + that.todo.length + ' delayed functions'); var todo = []; for (var i=0; i= 800) { w = Math.min(w, b.offsetWidth); } return {w: w, h: h}; } this.getScroll = function() { var sx = 0; var sy = 0; var de = document.documentElement; var b = document.body; if(typeof(window.pageYOffset) === 'number') { sy = window.pageYOffset; sx = window.pageXOffset; } else if(b && (b.scrollLeft || b.scrollTop)) { sy = b.scrollTop; sx = b.scrollLeft; } else if(de && (de.scrollLeft || de.scrollTop)) { sy = de.scrollTop; sx = de.scrollLeft; } return {x: sx, y: sy}; } this.mouseCoords = function(ev){ if (ev.pageX || ev.pageY) return {x: ev.pageX, y: ev.pageY}; var sc = that.getScroll(); return { x: ev.clientX + sc.x, y: ev.clientY + sc.y }; } this.offset = function(cont) { var ret = {x: 0, y: 0, w: cont.offsetWidth, h: cont.offsetHeight}; while (cont.offsetParent != null) { ret.x += cont.offsetLeft - utils.ifnull(cont.scrollLeft, 0); ret.y += cont.offsetTop - utils.ifnull(cont.scrollTop, 0); cont = cont.offsetParent; } return ret; } this.preloadImage = function(url, oncomplete) { oncomplete = that.ifnull(oncomplete, function() {}); var newimg = new Image(); newimg.src = url; newimg.onload = newimg.onerror = function() { trace(url + ' - img size: ' + this.width + ', ' + this.height); newimg.ok = true; if (this.width + this.height > 2) return oncomplete(false); utils.raport('J1-o', 'preloading failed', escape(url)); new Image().src = url + '&nc2=' + that.now(); oncomplete(true); } setTimeout(function() { if (newimg.complete && newimg.ok) return; utils.raport('J1-o', 'preloading timed out', escape(url)); oncomplete(null); }, 2000); } this.getValue = function(x) { if (typeof(x) === 'string' && x.indexOf(',') > 0) { var arr = x.split(','); var ret = []; for (var i=0; i is released under the MIT License */ swfobject = function() { var UNDEF = "undefined", OBJECT = "object", SHOCKWAVE_FLASH = "Shockwave Flash", SHOCKWAVE_FLASH_AX = "ShockwaveFlash.ShockwaveFlash", FLASH_MIME_TYPE = "application/x-shockwave-flash", EXPRESS_INSTALL_ID = "SWFObjectExprInst", ON_READY_STATE_CHANGE = "onreadystatechange", win = window, doc = document, nav = navigator, plugin = false, domLoadFnArr = [main], regObjArr = [], objIdArr = [], listenersArr = [], storedAltContent, storedAltContentId, storedCallbackFn, storedCallbackObj, isDomLoaded = false, isExpressInstallActive = false, dynamicStylesheet, dynamicStylesheetMedia, autoHideShow = true, /* Centralized function for browser feature detection - User agent string detection is only used when no good alternative is possible - Is executed directly for optimal performance */ ua = function() { var w3cdom = typeof doc.getElementById != UNDEF && typeof doc.getElementsByTagName != UNDEF && typeof doc.createElement != UNDEF, u = nav.userAgent.toLowerCase(), p = nav.platform.toLowerCase(), windows = p ? /win/.test(p) : /win/.test(u), mac = p ? /mac/.test(p) : /mac/.test(u), webkit = /webkit/.test(u) ? parseFloat(u.replace(/^.*webkit\/(\d+(\.\d+)?).*\$/, "\$1")) : false, // returns either the webkit version or false if not webkit ie = !+"\v1", // feature detection based on Andrea Giammarchi's solution: http://webreflection.blogspot.com/2009/01/32-bytes-to-know-if-your-browser-is-ie.html playerVersion = [0,0,0], d = null; if (typeof nav.plugins != UNDEF && typeof nav.plugins[SHOCKWAVE_FLASH] == OBJECT) { d = nav.plugins[SHOCKWAVE_FLASH].description; if (d && !(typeof nav.mimeTypes != UNDEF && nav.mimeTypes[FLASH_MIME_TYPE] && !nav.mimeTypes[FLASH_MIME_TYPE].enabledPlugin)) { // navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin indicates whether plug-ins are enabled or disabled in Safari 3+ plugin = true; ie = false; // cascaded feature detection for Internet Explorer d = d.replace(/^.*\s+(\S+\s+\S+\$)/, "\$1"); playerVersion[0] = parseInt(d.replace(/^(.*)\..*\$/, "\$1"), 10); playerVersion[1] = parseInt(d.replace(/^.*\.(.*)\s.*\$/, "\$1"), 10); playerVersion[2] = /[a-zA-Z]/.test(d) ? parseInt(d.replace(/^.*[a-zA-Z]+(.*)\$/, "\$1"), 10) : 0; } } else if (typeof win.ActiveXObject != UNDEF) { try { var a = new ActiveXObject(SHOCKWAVE_FLASH_AX); if (a) { // a will return null when ActiveX is disabled d = a.GetVariable("$version"); if (d) { ie = true; // cascaded feature detection for Internet Explorer d = d.split(" ")[1].split(","); playerVersion = [parseInt(d[0], 10), parseInt(d[1], 10), parseInt(d[2], 10)]; } } } catch(e) {} } return { w3:w3cdom, pv:playerVersion, wk:webkit, ie:ie, win:windows, mac:mac }; }(), /* Cross-browser onDomLoad - Will fire an event as soon as the DOM of a web page is loaded - Internet Explorer workaround based on Diego Perini's solution: http://javascript.nwbox.com/IEContentLoaded/ - Regular onload serves as fallback */ onDomLoad = function() { if (!ua.w3) { return; } if ((typeof doc.readyState != UNDEF && doc.readyState == "complete") || (typeof doc.readyState == UNDEF && (doc.getElementsByTagName("body")[0] || doc.body))) { // function is fired after onload, e.g. when script is inserted dynamically callDomLoadFunctions(); } if (!isDomLoaded) { if (typeof doc.addEventListener != UNDEF) { doc.addEventListener("DOMContentLoaded", callDomLoadFunctions, false); } if (ua.ie && ua.win) { doc.attachEvent(ON_READY_STATE_CHANGE, function() { if (doc.readyState == "complete") { doc.detachEvent(ON_READY_STATE_CHANGE, arguments.callee); callDomLoadFunctions(); } }); if (win == top) { // if not inside an iframe (function(){ if (isDomLoaded) { return; } try { doc.documentElement.doScroll("left"); } catch(e) { setTimeout(arguments.callee, 0); return; } callDomLoadFunctions(); })(); } } if (ua.wk) { (function(){ if (isDomLoaded) { return; } if (!/loaded|complete/.test(doc.readyState)) { setTimeout(arguments.callee, 0); return; } callDomLoadFunctions(); })(); } addLoadEvent(callDomLoadFunctions); } }(); function callDomLoadFunctions() { if (isDomLoaded) { return; } try { // test if we can really add/remove elements to/from the DOM; we don't want to fire it too early var t = doc.getElementsByTagName("body")[0].appendChild(createElement("span")); t.parentNode.removeChild(t); } catch (e) { return; } isDomLoaded = true; var dl = domLoadFnArr.length; for (var i = 0; i < dl; i++) { domLoadFnArr[i](); } } function addDomLoadEvent(fn) { if (isDomLoaded) { fn(); } else { domLoadFnArr[domLoadFnArr.length] = fn; // Array.push() is only available in IE5.5+ } } /* Cross-browser onload - Based on James Edwards' solution: http://brothercake.com/site/resources/scripts/onload/ - Will fire an event as soon as a web page including all of its assets are loaded */ function addLoadEvent(fn) { if (typeof win.addEventListener != UNDEF) { win.addEventListener("load", fn, false); } else if (typeof doc.addEventListener != UNDEF) { doc.addEventListener("load", fn, false); } else if (typeof win.attachEvent != UNDEF) { addListener(win, "onload", fn); } else if (typeof win.onload == "function") { var fnOld = win.onload; win.onload = function() { fnOld(); fn(); }; } else { win.onload = fn; } } /* Main function - Will preferably execute onDomLoad, otherwise onload (as a fallback) */ function main() { if (plugin) { testPlayerVersion(); } else { matchVersions(); } } /* Detect the Flash Player version for non-Internet Explorer browsers - Detecting the plug-in version via the object element is more precise than using the plugins collection item's description: a. Both release and build numbers can be detected b. Avoid wrong descriptions by corrupt installers provided by Adobe c. Avoid wrong descriptions by multiple Flash Player entries in the plugin Array, caused by incorrect browser imports - Disadvantage of this method is that it depends on the availability of the DOM, while the plugins collection is immediately available */ function testPlayerVersion() { var b = doc.getElementsByTagName("body")[0]; var o = createElement(OBJECT); o.setAttribute("type", FLASH_MIME_TYPE); var t = b.appendChild(o); if (t) { var counter = 0; (function(){ if (typeof t.GetVariable != UNDEF) { var d = t.GetVariable("$version"); if (d) { d = d.split(" ")[1].split(","); ua.pv = [parseInt(d[0], 10), parseInt(d[1], 10), parseInt(d[2], 10)]; } } else if (counter < 10) { counter++; setTimeout(arguments.callee, 10); return; } b.removeChild(o); t = null; matchVersions(); })(); } else { matchVersions(); } } /* Perform Flash Player and SWF version matching; static publishing only */ function matchVersions() { var rl = regObjArr.length; if (rl > 0) { for (var i = 0; i < rl; i++) { // for each registered object element var id = regObjArr[i].id; var cb = regObjArr[i].callbackFn; var cbObj = {success:false, id:id}; if (ua.pv[0] > 0) { var obj = getElementById(id); if (obj) { if (hasPlayerVersion(regObjArr[i].swfVersion) && !(ua.wk && ua.wk < 312)) { // Flash Player version >= published SWF version: Houston, we have a match! setVisibility(id, true); if (cb) { cbObj.success = true; cbObj.ref = getObjectById(id); cb(cbObj); } } else if (regObjArr[i].expressInstall && canExpressInstall()) { // show the Adobe Express Install dialog if set by the web page author and if supported var att = {}; att.data = regObjArr[i].expressInstall; att.width = obj.getAttribute("width") || "0"; att.height = obj.getAttribute("height") || "0"; if (obj.getAttribute("class")) { att.styleclass = obj.getAttribute("class"); } if (obj.getAttribute("align")) { att.align = obj.getAttribute("align"); } // parse HTML object param element's name-value pairs var par = {}; var p = obj.getElementsByTagName("param"); var pl = p.length; for (var j = 0; j < pl; j++) { if (p[j].getAttribute("name").toLowerCase() != "movie") { par[p[j].getAttribute("name")] = p[j].getAttribute("value"); } } showExpressInstall(att, par, id, cb); } else { // Flash Player and SWF version mismatch or an older Webkit engine that ignores the HTML object element's nested param elements: display alternative content instead of SWF displayAltContent(obj); if (cb) { cb(cbObj); } } } } else { // if no Flash Player is installed or the fp version cannot be detected we let the HTML object element do its job (either show a SWF or alternative content) setVisibility(id, true); if (cb) { var o = getObjectById(id); // test whether there is an HTML object element or not if (o && typeof o.SetVariable != UNDEF) { cbObj.success = true; cbObj.ref = o; } cb(cbObj); } } } } } function getObjectById(objectIdStr) { var r = null; var o = getElementById(objectIdStr); if (o && o.nodeName == "OBJECT") { if (typeof o.SetVariable != UNDEF) { r = o; } else { var n = o.getElementsByTagName(OBJECT)[0]; if (n) { r = n; } } } return r; } /* Requirements for Adobe Express Install - only one instance can be active at a time - fp 6.0.65 or higher - Win/Mac OS only - no Webkit engines older than version 312 */ function canExpressInstall() { return !isExpressInstallActive && hasPlayerVersion("6.0.65") && (ua.win || ua.mac) && !(ua.wk && ua.wk < 312); } /* Show the Adobe Express Install dialog - Reference: http://www.adobe.com/cfusion/knowledgebase/index.cfm?id=6a253b75 */ function showExpressInstall(att, par, replaceElemIdStr, callbackFn) { isExpressInstallActive = true; storedCallbackFn = callbackFn || null; storedCallbackObj = {success:false, id:replaceElemIdStr}; var obj = getElementById(replaceElemIdStr); if (obj) { if (obj.nodeName == "OBJECT") { // static publishing storedAltContent = abstractAltContent(obj); storedAltContentId = null; } else { // dynamic publishing storedAltContent = obj; storedAltContentId = replaceElemIdStr; } att.id = EXPRESS_INSTALL_ID; if (typeof att.width == UNDEF || (!/%\$/.test(att.width) && parseInt(att.width, 10) < 310)) { att.width = "310"; } if (typeof att.height == UNDEF || (!/%\$/.test(att.height) && parseInt(att.height, 10) < 137)) { att.height = "137"; } doc.title = doc.title.slice(0, 47) + " - Flash Player Installation"; var pt = ua.ie && ua.win ? "ActiveX" : "PlugIn", fv = "MMredirectURL=" + win.location.toString().replace(/&/g,"%26") + "&MMplayerType=" + pt + "&MMdoctitle=" + doc.title; if (typeof par.flashvars != UNDEF) { par.flashvars += "&" + fv; } else { par.flashvars = fv; } // IE only: when a SWF is loading (AND: not available in cache) wait for the readyState of the object element to become 4 before removing it, // because you cannot properly cancel a loading SWF file without breaking browser load references, also obj.onreadystatechange doesn't work if (ua.ie && ua.win && obj.readyState != 4) { var newObj = createElement("div"); replaceElemIdStr += "SWFObjectNew"; newObj.setAttribute("id", replaceElemIdStr); obj.parentNode.insertBefore(newObj, obj); // insert placeholder div that will be replaced by the object element that loads expressinstall.swf obj.style.display = "none"; (function(){ if (obj.readyState == 4) { obj.parentNode.removeChild(obj); } else { setTimeout(arguments.callee, 10); } })(); } createSWF(att, par, replaceElemIdStr); } } /* Functions to abstract and display alternative content */ function displayAltContent(obj) { if (ua.ie && ua.win && obj.readyState != 4) { // IE only: when a SWF is loading (AND: not available in cache) wait for the readyState of the object element to become 4 before removing it, // because you cannot properly cancel a loading SWF file without breaking browser load references, also obj.onreadystatechange doesn't work var el = createElement("div"); obj.parentNode.insertBefore(el, obj); // insert placeholder div that will be replaced by the alternative content el.parentNode.replaceChild(abstractAltContent(obj), el); obj.style.display = "none"; (function(){ if (obj.readyState == 4) { obj.parentNode.removeChild(obj); } else { setTimeout(arguments.callee, 10); } })(); } else { obj.parentNode.replaceChild(abstractAltContent(obj), obj); } } function abstractAltContent(obj) { var ac = createElement("div"); if (ua.win && ua.ie) { ac.innerHTML = obj.innerHTML; } else { var nestedObj = obj.getElementsByTagName(OBJECT)[0]; if (nestedObj) { var c = nestedObj.childNodes; if (c) { var cl = c.length; for (var i = 0; i < cl; i++) { if (!(c[i].nodeType == 1 && c[i].nodeName == "PARAM") && !(c[i].nodeType == 8)) { ac.appendChild(c[i].cloneNode(true)); } } } } } return ac; } /* Cross-browser dynamic SWF creation */ function createSWF(attObj, parObj, id) { var r, el = getElementById(id); if (ua.wk && ua.wk < 312) { return r; } if (el) { if (typeof attObj.id == UNDEF) { // if no 'id' is defined for the object element, it will inherit the 'id' from the alternative content attObj.id = id; } if (ua.ie && ua.win) { // Internet Explorer + the HTML object element + W3C DOM methods do not combine: fall back to outerHTML var att = ""; for (var i in attObj) { if (attObj[i] != Object.prototype[i]) { // filter out prototype additions from other potential libraries if (i.toLowerCase() == "data") { parObj.movie = attObj[i]; } else if (i.toLowerCase() == "styleclass") { // 'class' is an ECMA4 reserved keyword att += ' class="' + attObj[i] + '"'; } else if (i.toLowerCase() != "classid") { att += ' ' + i + '="' + attObj[i] + '"'; } } } var par = ""; for (var j in parObj) { if (parObj[j] != Object.prototype[j]) { // filter out prototype additions from other potential libraries par += ''; } } el.outerHTML = '' + par + ''; objIdArr[objIdArr.length] = attObj.id; // stored to fix object 'leaks' on unload (dynamic publishing only) r = getElementById(attObj.id); } else { // well-behaving browsers var o = createElement(OBJECT); o.setAttribute("type", FLASH_MIME_TYPE); for (var m in attObj) { if (attObj[m] != Object.prototype[m]) { // filter out prototype additions from other potential libraries if (m.toLowerCase() == "styleclass") { // 'class' is an ECMA4 reserved keyword o.setAttribute("class", attObj[m]); } else if (m.toLowerCase() != "classid") { // filter out IE specific attribute o.setAttribute(m, attObj[m]); } } } for (var n in parObj) { if (parObj[n] != Object.prototype[n] && n.toLowerCase() != "movie") { // filter out prototype additions from other potential libraries and IE specific param element createObjParam(o, n, parObj[n]); } } el.parentNode.replaceChild(o, el); r = o; } } return r; } function createObjParam(el, pName, pValue) { var p = createElement("param"); p.setAttribute("name", pName); p.setAttribute("value", pValue); el.appendChild(p); } /* Cross-browser SWF removal - Especially needed to safely and completely remove a SWF in Internet Explorer */ function removeSWF(id) { var obj = getElementById(id); if (obj && obj.nodeName == "OBJECT") { if (ua.ie && ua.win) { obj.style.display = "none"; (function(){ if (obj.readyState == 4) { removeObjectInIE(id); } else { setTimeout(arguments.callee, 10); } })(); } else { obj.parentNode.removeChild(obj); } } } function removeObjectInIE(id) { var obj = getElementById(id); if (obj) { for (var i in obj) { if (typeof obj[i] == "function") { obj[i] = null; } } obj.parentNode.removeChild(obj); } } /* Functions to optimize JavaScript compression */ function getElementById(id) { var el = null; try { el = doc.getElementById(id); } catch (e) {} return el; } function createElement(el) { return doc.createElement(el); } /* Updated attachEvent function for Internet Explorer - Stores attachEvent information in an Array, so on unload the detachEvent functions can be called to avoid memory leaks */ function addListener(target, eventType, fn) { target.attachEvent(eventType, fn); listenersArr[listenersArr.length] = [target, eventType, fn]; } /* Flash Player and SWF content version matching */ function hasPlayerVersion(rv) { var pv = ua.pv, v = rv.split("."); v[0] = parseInt(v[0], 10); v[1] = parseInt(v[1], 10) || 0; // supports short notation, e.g. "9" instead of "9.0.0" v[2] = parseInt(v[2], 10) || 0; return (pv[0] > v[0] || (pv[0] == v[0] && pv[1] > v[1]) || (pv[0] == v[0] && pv[1] == v[1] && pv[2] >= v[2])) ? true : false; } /* Cross-browser dynamic CSS creation - Based on Bobby van der Sluis' solution: http://www.bobbyvandersluis.com/articles/dynamicCSS.php */ function createCSS(sel, decl, media, newStyle) { if (ua.ie && ua.mac) { return; } var h = doc.getElementsByTagName("head")[0]; if (!h) { return; } // to also support badly authored HTML pages that lack a head element var m = (media && typeof media == "string") ? media : "screen"; if (newStyle) { dynamicStylesheet = null; dynamicStylesheetMedia = null; } if (!dynamicStylesheet || dynamicStylesheetMedia != m) { // create dynamic stylesheet + get a global reference to it var s = createElement("style"); s.setAttribute("type", "text/css"); s.setAttribute("media", m); dynamicStylesheet = h.appendChild(s); if (ua.ie && ua.win && typeof doc.styleSheets != UNDEF && doc.styleSheets.length > 0) { dynamicStylesheet = doc.styleSheets[doc.styleSheets.length - 1]; } dynamicStylesheetMedia = m; } // add style rule if (ua.ie && ua.win) { if (dynamicStylesheet && typeof dynamicStylesheet.addRule == OBJECT) { dynamicStylesheet.addRule(sel, decl); } } else { if (dynamicStylesheet && typeof doc.createTextNode != UNDEF) { dynamicStylesheet.appendChild(doc.createTextNode(sel + " {" + decl + "}")); } } } function setVisibility(id, isVisible) { if (!autoHideShow) { return; } var v = isVisible ? "visible" : "hidden"; if (isDomLoaded && getElementById(id)) { getElementById(id).style.visibility = v; } else { createCSS("#" + id, "visibility:" + v); } } /* Filter to avoid XSS attacks */ function urlEncodeIfNecessary(s) { var regex = /[\\\"<>\.;]/; var hasBadChars = regex.exec(s) != null; return hasBadChars && typeof encodeURIComponent != UNDEF ? encodeURIComponent(s) : s; } /* Release memory to avoid memory leaks caused by closures, fix hanging audio/video threads and force open sockets/NetConnections to disconnect (Internet Explorer only) */ var cleanup = function() { if (ua.ie && ua.win) { window.attachEvent("onunload", function() { // remove listeners to avoid memory leaks var ll = listenersArr.length; for (var i = 0; i < ll; i++) { listenersArr[i][0].detachEvent(listenersArr[i][1], listenersArr[i][2]); } // cleanup dynamically embedded objects to fix audio/video threads and force open sockets and NetConnections to disconnect var il = objIdArr.length; for (var j = 0; j < il; j++) { removeSWF(objIdArr[j]); } // cleanup library's main closures to avoid memory leaks for (var k in ua) { ua[k] = null; } ua = null; for (var l in swfobject) { swfobject[l] = null; } swfobject = null; }); } }(); return { /* Public API - Reference: http://code.google.com/p/swfobject/wiki/documentation */ registerObject: function(objectIdStr, swfVersionStr, xiSwfUrlStr, callbackFn) { if (ua.w3 && objectIdStr && swfVersionStr) { var regObj = {}; regObj.id = objectIdStr; regObj.swfVersion = swfVersionStr; regObj.expressInstall = xiSwfUrlStr; regObj.callbackFn = callbackFn; regObjArr[regObjArr.length] = regObj; setVisibility(objectIdStr, false); } else if (callbackFn) { callbackFn({success:false, id:objectIdStr}); } }, getObjectById: function(objectIdStr) { if (ua.w3) { return getObjectById(objectIdStr); } }, embedSWF: function(swfUrlStr, replaceElemIdStr, widthStr, heightStr, swfVersionStr, xiSwfUrlStr, flashvarsObj, parObj, attObj, callbackFn) { var callbackObj = {success:false, id:replaceElemIdStr}; if (ua.w3 && !(ua.wk && ua.wk < 312) && swfUrlStr && replaceElemIdStr && widthStr && heightStr && swfVersionStr) { setVisibility(replaceElemIdStr, false); addDomLoadEvent(function() { widthStr += ""; // auto-convert to string heightStr += ""; var att = {}; if (attObj && typeof attObj === OBJECT) { for (var i in attObj) { // copy object to avoid the use of references, because web authors often reuse attObj for multiple SWFs att[i] = attObj[i]; } } att.data = swfUrlStr; att.width = widthStr; att.height = heightStr; var par = {}; if (parObj && typeof parObj === OBJECT) { for (var j in parObj) { // copy object to avoid the use of references, because web authors often reuse parObj for multiple SWFs par[j] = parObj[j]; } } if (flashvarsObj && typeof flashvarsObj === OBJECT) { for (var k in flashvarsObj) { // copy object to avoid the use of references, because web authors often reuse flashvarsObj for multiple SWFs if (typeof par.flashvars != UNDEF) { par.flashvars += "&" + k + "=" + flashvarsObj[k]; } else { par.flashvars = k + "=" + flashvarsObj[k]; } } } if (hasPlayerVersion(swfVersionStr)) { // create SWF var obj = createSWF(att, par, replaceElemIdStr); if (att.id == replaceElemIdStr) { setVisibility(replaceElemIdStr, true); } callbackObj.success = true; callbackObj.ref = obj; } else if (xiSwfUrlStr && canExpressInstall()) { // show Adobe Express Install att.data = xiSwfUrlStr; showExpressInstall(att, par, replaceElemIdStr, callbackFn); return; } else { // show alternative content setVisibility(replaceElemIdStr, true); } if (callbackFn) { callbackFn(callbackObj); } }); } else if (callbackFn) { callbackFn(callbackObj); } }, switchOffAutoHideShow: function() { autoHideShow = false; }, ua: ua, getFlashPlayerVersion: function() { return { major:ua.pv[0], minor:ua.pv[1], release:ua.pv[2] }; }, hasFlashPlayerVersion: hasPlayerVersion, createSWF: function(attObj, parObj, replaceElemIdStr) { if (ua.w3) { return createSWF(attObj, parObj, replaceElemIdStr); } else { return undefined; } }, showExpressInstall: function(att, par, replaceElemIdStr, callbackFn) { if (ua.w3 && canExpressInstall()) { showExpressInstall(att, par, replaceElemIdStr, callbackFn); } }, removeSWF: function(objElemIdStr) { if (ua.w3) { removeSWF(objElemIdStr); } }, createCSS: function(selStr, declStr, mediaStr, newStyleBoolean) { if (ua.w3) { createCSS(selStr, declStr, mediaStr, newStyleBoolean); } }, addDomLoadEvent: addDomLoadEvent, addLoadEvent: addLoadEvent, getQueryParamValue: function(param) { var q = doc.location.search || doc.location.hash; if (q) { if (/\?/.test(q)) { q = q.split("?")[1]; } // strip question mark if (param == null) { return urlEncodeIfNecessary(q); } var pairs = q.split("&"); for (var i = 0; i < pairs.length; i++) { if (pairs[i].substring(0, pairs[i].indexOf("=")) == param) { return urlEncodeIfNecessary(pairs[i].substring((pairs[i].indexOf("=") + 1))); } } } return ""; }, // For internal usage only expressInstallCallback: function() { if (isExpressInstallActive) { var obj = getElementById(EXPRESS_INSTALL_ID); if (obj && storedAltContent) { obj.parentNode.replaceChild(storedAltContent, obj); if (storedAltContentId) { setVisibility(storedAltContentId, true); if (ua.ie && ua.win) { storedAltContent.style.display = "block"; } } if (storedCallbackFn) { storedCallbackFn(storedCallbackObj); } } isExpressInstallActive = false; } } }; }(); } try {x.x.x} catch(e) {static.fstarts.push(['placementUtils', e.lineNumber, 0])}; PlacementUtils = function(conf, utils, options) { var that = this; this.abc = '0123456789abcdef'; this.param_map = {}; if (options === undefined) options = function() {return false}; this.getSrc = function(scr, i) { try { return scr.src + ''; } catch(e) { utils.raport('J1-o', 'cannot access script src', i); return ''; } } this.parseScripts = utils.ftry('parseScripts', function(forms, global, events, host, placement_map, etag, prefix, encoding, oc) { if (oc === undefined) oc = function() {}; var oncomplete = utils.retry('waitForAkPlacements', function() { for (var i=0; i 0 && forms.length > that.formLimit) forms.pop(); } for (var i=0; i conf.get('ads_limit')) break; var e = extra[ei]; if (typeof(e) === 'function') { var fa = utils.ftry('extra1', e)(); syso('generated ' + fa.length + ' extra forms'); for (var i=0; i= 0) continue; try { var line = params.split('=')[1].split('&')[0]; if (map[line] === undefined) { utils.raport('S2', 'no such entry in placement map', line); continue; } var node = utils.cel(null, 'div'); sc.parentNode.insertBefore(node, sc); var form = that.readForm(node, map[line].split('-')[4], sc); form.needUpdate = true; form.prid = map[line].split('-')[2]; form.caid = map[line].split('-')[3]; forms.push(form) syso('found Quad-4 placement: ' + line); } catch(e) { utils.exc('parseQ4Scripts - unable to parse params', e, params); } } } this.parseQ3Scripts = function(forms, global) { var scarr = document.getElementsByTagName('script'); for (var i=0; i= 0) && (src.indexOf(host) < 0) && (src.indexOf('intext') < 0)) { return syso('alien QUAD-1 placement found; skipping old placements'); } } for (var i=0; i maxv)) { errors.push(['invalid int value', str + ' = ' + form[str]]); } form[str] = Math.min(maxv, Math.max(minv, utils.ifnull(i, def))); } this.fixColor = function(c) { if (c.charAt(0) === '#') c = c.substring(1); var cc = '#white|fff#aqua|0ff#magneta|f0f#yellow|ff0#red|f00#green|0f0#blue|00f#black|000#gray|777#silver|ddd#'; var ci = cc.indexOf('#'+c+'|'); if (ci >= 0) c = cc.substring(ci).split('|')[1].split('#')[0]; if (c.length === 3) c = c.charAt(0) + c.charAt(0) + c.charAt(1) + c.charAt(1) + c.charAt(2) + c.charAt(2); return c; } this.checkCol = function(form, errors, str, def) { if (form.colors[str] === undefined) form.colors[str] = def; if (form.colors[str] === "") form.colors[str] = def; form.colors[str] = that.fixColor(form.colors[str]); var strv = form.colors[str].toLowerCase(); if (strv.length != 6) { form.colors[str] = def; errors.push(['invalid color', strv]); return syso('restored default color: ' + form.colors[str]); } for (var i=0; i<6; i++) { if (that.abc.indexOf(strv.charAt(i)) < 0) { form.colors[str] = def; errors.push(['invalid color', strv]); return syso('restored default color: ' + form.colors[str]); } } } this.fixColors = function(form, errors, s1, s2, warn, change) { var c1 = form.colors[s1].toLowerCase(); var c2 = form.colors[s2].toLowerCase(); var diff = 0; for (var i=0; i<6; i+=2) { var ch1 = that.abc.indexOf(c1.charAt(i)); var ch2 = that.abc.indexOf(c2.charAt(i)); diff += Math.abs(ch1 - ch2); } trace('diff='+diff); if (diff > warn) return; if (form.warnings === undefined) form.warnings = []; form.warnings.push(['ugly colors', diff + ' (' + s1 + ', ' + s2 + ')']); form.colors['old'+s1] = form.colors[s1]; if (diff > change) return; var n1 = ''; var n2 = ''; for (var i=0; i<6; i+=2) { var ch1 = that.abc.indexOf(c1.charAt(i)); var ch2 = that.abc.indexOf(c2.charAt(i)); var d = Math.abs(ch1 - ch2); if (d > change / 3) { n1 += c1.charAt(i) + c1.charAt(i+1); n2 += c2.charAt(i) + c2.charAt(i+1); continue; } var ch = Math.floor((ch1 + ch2) / 2); var nh1 = that.abc.charAt(Math.max(0, Math.min(15, ch > 7 ? ch - 3 : ch + 3))); n1 += nh1 + nh1; } syso('fixed colors: ' + c1 + ', ' + c2 + ' --> ' + n1); form.colors[s1] = n1; } this.validateForm = function(form, errors) { if (form.colors === undefined) form.colors = {}; if (form.labelType === 0) form.labelType = 3; var checkInt = function(prop, minv, maxv, def, noWarn) { return that.checkInt(form, noWarn ? [] : errors, prop, minv, maxv, def); } var checkCol = function(prop, def) { if (form.colors[prop] === 'transparent') return true; return that.checkCol(form, errors, prop, def); } if (typeof(form.corners) != 'object') { form.errors.push(['no corners', '']); form.corners = {}; } checkInt('merging', 1, 7, 2); checkInt('spacing', 0, 20, 1); checkInt('labelType', 1, 4, 3); checkInt('labelId', 1, conf.get('labelsCnt'), 1); that.checkInt(form.corners, errors, 'tl', 0, 4, 3); that.checkInt(form.corners, errors, 'tr', 0, 4, 3); that.checkInt(form.corners, errors, 'bl', 0, 4, 3); that.checkInt(form.corners, errors, 'br', 0, 4, 3); checkInt('x', 40, 1600, 300); checkInt('y', 20, 1200, 100, true); checkInt('fontSize', 9, 12, NaN, true); checkInt('cornerSizeX', 3, 20, 7, true); checkInt('cornerSizeY', 3, 20, 7, true); checkInt('borderSize', 0, 4, 1, true); checkInt('placementId', 0, 1000000, 0, true); checkCol('title', '0000FF'); checkCol('bg', 'FFFFFF'); checkCol('desc', '000000'); checkCol('url', '0000FF'); checkCol('frame', 'B9B9B9'); checkCol('headerBg', 'FFFFFF'); checkCol('headerFrame', 'B9B9B9'); checkCol('labelTxt', form.colors.title); if (form.merging != 7) { that.fixColors(form, errors, 'title', 'headerBg', 5, 3); that.fixColors(form, errors, 'desc', 'bg', 5, 3); that.fixColors(form, errors, 'url', 'bg', 5, 3); that.fixColors(form, [], 'labelTxt', 'bg', 5, 3); } if (form.imgBottomColor && conf.get('imgBottomColors').indexOf('#'+form.imgBottomColor+'#') < 0) { errors.push(['disallowed image bottom color', form.imgBottomColor]); form.imgBottomColor = null; } if ((form.labelType < 1) || (form.labelType > 4)) form.labelType = 3; form.font = utils.ifnull(form.font, conf.get('defaultFont')); if (conf.get('allowedFonts').indexOf('#' + form.font + '#') < 0) { errors.push(['disallowed font', form.font]); form.font = 'Arial'; } form.x = form.x - 0; form.y = form.y - 0; return errors; } this.exclusiveIsEnabled = function(form) { if (options('noex')) return ''; if ((form.noEx === 'b') && conf.get('allowForceEx')) return 'E'; if ((form.noEx === 'w') && conf.get('allowForceEx')) return 'W'; if (form.forbidden && form.forbidden.search(/:exclusive:/i)) return ''; if (form.noEx) return ''; if (form.x >= 580 && form.y >= 100) return 'e'; if (form.x >= 540 && form.y >= 170) return 'E'; if (form.x >= 380 && form.y >= 190) return 'E'; if (form.x >= 240 && form.y >= 250) return 'E'; if (form.x >= 160 && form.y >= 400) return 'W'; return ''; } this.fixForm = function(form) { if (form.fixed) return form; var errors = that.validateForm(form, []); if (errors.length > 0) { form.errors = errors; utils.raport('P1-', 'form contains errors', errors.length + ' ' + errors[0][0] + ': ' + errors[0][1]); } form.fixed = true; form.cc = form.r * form.c; form.ee = that.exclusiveIsEnabled(form); return form; } this.readForm = function(node, str, script, caid) { if (typeof(str) != 'string') syso(str); var arr = str.split(','); var ret = { script: script, node: node, caid: caid, line: str, colors: { title: arr[0], bg: arr[1], desc: arr[2], url: arr[3], frame: arr[4], headerBg: arr[5], headerFrame: arr[6] }, x: arr[7], y: arr[8], r: arr[9], c: arr[10], corners: { tl: arr[11], tr: arr[12], bl: arr[13], br: arr[14] }, withUrl: arr[15] === 't', labelId: arr[16], labelType: arr[17], merging: arr[19], spacing: arr[20], noContent: arr[21] === 't' ? true : arr[21] === 'f' ? false : undefined, placementId: arr[22], noEx: arr[23] === 't', showHeader: arr[24], font: arr[25], fontSize: arr[26], cornerSizeX: arr[27], cornerSizeY: arr[28], borderSize: arr[29], imgBottomColor: arr[30], adart3: arr[31] === 't', showFavico: arr[32] === 't', labelPos: parseInt(utils.ifnull(arr[33], 0)) } return that.fixForm(ret); } this.getScriptParams = function(form) { var ret = ""; ret += form.colors.title + ','; ret += form.colors.bg + ','; ret += form.colors.desc + ','; ret += form.colors.url + ','; ret += form.colors.frame + ','; ret += form.colors.headerBg + ','; ret += form.colors.headerFrame + ','; ret += form.x + ','; ret += form.y + ','; ret += form.r + ','; ret += form.c + ','; ret += form.corners.tl + ','; ret += form.corners.tr + ','; ret += form.corners.bl + ','; ret += form.corners.br + ','; ret += (form.withUrl ? 't' : 'f') + ','; ret += form.labelId + ','; ret += form.labelType + ','; ret += '1,'; ret += form.merging + ','; ret += form.spacing + ','; ret += form.noContent === false ? 'f' : ''; ret += ',' + form.placementId; ret += ',' + (form.noEx ? 't' : 'f'); ret += ',' + form.showHeader; ret += ',' + utils.ifnull(form.font, ''); ret += ',' + utils.ifnull(form.fontSize, ''); ret += ',' + utils.ifnull(form.cornerSizeX, ''); ret += ',' + utils.ifnull(form.cornerSizeY, ''); ret += ',' + utils.ifnull(form.borderSize, ''); ret += ',' + utils.ifnull(form.imgBottomColor, ''); ret += ',' + (form.adart3 ? 't' : 'f'); ret += ',' + (form.showFavico ? 't' : 'f'); ret += ',' + form.labelPos; return ret; } } try {x.x.x} catch(e) {static.fstarts.push(['parser', e.lineNumber, 0])}; Parser = function(conf, utils, options) { this.minSpanLength = conf.get('minSpanLength', 12); this.minWordLength = conf.get('minWordLength', 2); this.maxWordLength = conf.get('maxWordLength', 24); this.input_boost = conf.get('input_boost', 1); this.desc_boost = conf.get('desc_boost', 1); this.kw_boost = conf.get('kw_boost', 1); this.title_boost = conf.get('title_boost', 1); this.tag_boost = conf.get('tag_boost'); this.important_word_bust = conf.get('important_word_bust', 2); this.ix_boost = conf.get('ix_boost', 1); this.allowOnlyMeta = conf.get('allowOnlyMeta');//0 or 1 this.minTitleLength = conf.get('minTitleLength', 3); this.timeout = conf.get('timeout', 10000); this.trim_chars = conf.get('trim_chars', ''); this.whiteChars_str = conf.get('whiteChars_str'); this.blockChars_str = conf.get('blockChars_str'); this.max_url = conf.get('max_url', 1900); this.adc_skip_tags = conf.get('adc_skip_tags'); this.ha_prefix = conf.get('ha_prefix', '_-_'); this.enders = []; this.enders_no = []; this.enders_ne = []; this.eplc_dict = {}; this.twoLetterWordsArr = conf.get('twoLetterWords'); var that = this; this.eplc_dict[unescape('%u00f8')]='71y'; /* ø */ this.eplc_dict[unescape('%u00c6')]='71E'; /* Æ */ this.eplc_dict[unescape('%u00e6')]='71e'; /* æ */ this.eplc_dict[unescape('%u00c5')]='71A'; /* Å */ this.eplc_dict[unescape('%u00e5')]='71a'; /* å */ this.eplc_dict[unescape('%u00d8')]='71Y'; /* Ø */ this.word_sort_val = function(a) { return a.so = a.bust*a.count*a.count*(1+a.count)*(8+a.word.length); } this.nonImportantWordArr = ''; this.importantWordsArr = ''; this.makeArray = function(str) { var ret = {}; for (var i=0; i= 0) return null; } ret.word=w; for(var key=0; key 0) { if (that.trimArr[word.charAt(0)]) { word = word.substring(1); o.begin++; } else if (that.trimArr[word.charAt(word.length - 1)]) { word = word.substring(0, word.length - 1); } else { break; } } var ok = true; for (var ch in that.trimArr) if (word.indexOf(ch) >= 0) ok = false; if (!ok) { trace('skipping word: ' + word); word = ''; continue; } if(ch === '<' && noTags !== true) tag = true; o.orgin=word; o.content=that.ecapeNationalLowerCase(word); o.set=0; if (word.length > 1) array.push(o); word = ''; } } else { if(ch === '>' && !quotes && !apostrof) { tag=false; } else if(ch === '"' && !apostrof) { quotes=!quotes; } else if(ch === "'" && !quotes) { apostrof=!apostrof; } } } return array; } this.copy = function(obj) { var ret = {}; for (var i in obj) ret[i] = obj[i]; return ret; } this.printObj = function(obj) { var ret = ''; for (var i in obj) ret += ', ' + i + '=' + obj[i]; return ret.substring(2); } this.walk = function(node, state, onTextNode, onEnter, onExit, onLeaf) { if ((node.nodeType === 3) && (node.nodeValue) && (node.nodeValue.length > 2) && (node.nodeValue[0] != '<')) { return onTextNode(node, state); } var ch = node.childNodes; var tag = 'unknown tag'; if (node.tagName != undefined) tag = node.tagName.toLowerCase(); if ((ch.length === 0) && onLeaf) return onLeaf(tag, node, state); if (onEnter) { try { state = onEnter(tag, node, state); } catch(e) { if (typeof(e) === 'object') utils.exc('walk', e); return; } } for (var i=0; i 1) color = ['#00a', '#22f']; that.mark(node, color[0], color[1], 'text node'); that.spans.push(s); }, function(tag, node, state) { if ((new Date()).getTime() > that.timeEnd) { throw that.mark(node, '#000', '#222', 'timeout'); } for (var t=0; t that.maxWordLength) continue; that.addWord(hashArr, content, that.spans[t].contextBust, 1, arr.length); } } } this.addWord = function(hashArr, word, bust, only, msl) { word = word.toLowerCase(); if (word.length === 2 && that.twoLetterWords[word] === undefined) return; if (bust === undefined) bust = 1; var o = that.getBaseForm(word); if (o === null) return; if (hashArr[o.bform]) { hashArr[o.bform].only |= only; hashArr[o.bform].msl = Math.max(hashArr[o.bform].msl, msl); hashArr[o.bform].count++; hashArr[o.bform].words += ',' + word; hashArr[o.bform].totalbust += bust; hashArr[o.bform].bust = hashArr[o.bform].totalbust * hashArr[o.bform].origBust / hashArr[o.bform].count; hashArr[o.bform].busts.push(bust); return; } o.only = only;//przynajmniej jedno wystapienie w kontencie dla Ix o.msl = msl;//max. span length o.count = 1; o.words = word; if (that.impWords[word] !== undefined) { o.important = that.impWords[word];//dbg o.bust *= that.impWords[word]; } o.origBust = o.bust; o.busts = [o.bust];//dbg o.bust = o.bust * bust; o.totalbust = bust; hashArr[o.bform] = o; } this.getReturnStr = function(hashArr) { var array_tmp = []; for(var key in hashArr) { if ({}[key] === undefined) { var val = hashArr[key]; if (typeof(val) != 'object') continue; if ((!val.only) || (val.so <= 0)) continue; array_tmp.push(val); } } if (array_tmp.length === 0) { utils.raport('P1-o', 'no content', undefined); return ''; } else if (array_tmp.length < 30) { utils.raport('P0-o', 'low content', array_tmp.length); } for (var i=0; ithat.max_url) break; content += escape(array_tmp[p].word); content += '+'; array_tmp[p].normal_val = c_val; trace(c_val + ' ---> ' + array_tmp[p].word + ' (' + array_tmp[p].bform + ', ' + hashArr[array_tmp[p].bform].val + ')'); } return content; } this.addWords = function(hashArr, words, bust, only) { var arr = that.nsSplit(words); for (var i=0; i= that.minWordLength && content.length <= that.maxWordLength) { that.addWord(hashArr, arr[i].content, bust, only, arr.length); } } } this.getInputContent = function(hashArr) { var m = document.getElementsByTagName('input'); for (var i=0;i= 0) { that.addWords(hashArr, m[i].content, that.desc_boost, that.allowOnlyMeta); } else if (d.indexOf('keywords') >= 0) { that.addWords(hashArr, m[i].content, that.kw_boost, that.allowOnlyMeta); } } var t = document.getElementsByTagName('title'); for (var i=0; i conf.get('maxContent')) { content = content.substring(0, conf.get('maxContent')).replace(/\+[^+]*$/g, ''); for (var a=content.length-7; a= 0) that.getMetaContent(that.content); if (co.indexOf('I') >= 0) that.getInputContent(that.content); if (co.indexOf('C') >= 0) that.getSpansAndTexts(that.content, params); var ret = that.getReturnStr(that.content); var exceeded = (new Date()).getTime() - that.timeEnd; trace('parsing time='+(exceeded+that.timeout)); if (exceeded >= 0) utils.raport('P1-o', 'timeout exceeded', exceeded); syso('parsing completed'); return ret; } } try {x.x.x} catch(e) {static.fstarts.push(['nstables', e.lineNumber, 0])}; NSTables = function(utils, conf, options, font) { var that_nst = this; this.dbg = options('dbg_div'); this.font = font; var getDiv = function(doc) { return doc.createElement('div'); } if (this.dbg) { getDiv = function(doc, dbg) { var ret = doc.createElement('div'); ret.style.overflow = 'hidden'; ret.id = 'Q' + utils.trash.length; ret.dbg = dbg; utils.trash.push(ret); return ret; } } this.getImgDiv = function(url, minx, miny, fc, bc) { var obj = that_nst.emptyDiv(minx, miny, fc, bc); obj.css.backgroundImage = 'url('+url+')'; if (!utils.ie) { obj.css.backgroundPosition = 'center'; } obj.css.backgroundRepeat = 'no-repeat'; obj.img = true; return obj; } this.busy = false; this.over = []; var adda = function(dom, a) { if (a.click) { dom.onclick = a.click; if (a.mousedown) dom.onmousedown = a.mousedown; } else if (a.href) { dom.onclick = utils.ftry('click', utils.onlyOnce(function() { syso('click: ' + a.href); window.open(a.href, '_blank'); }, 'mainClick')); } var pri = a.pri === 1; var show_ws = function() { var desc = ''; var max = -1; for (var i=0; i max) { max = that_nst.over[i].pri; desc = that_nst.over[i].url; } } try { window.status = desc; } catch(e) { if (!that_nst.wsw_sent) { that_nst.wsw_sent = true; utils.raport('J1-', 'cannot change window status'); } }; } dom.onmouseout = utils.ftry('onmouseover', function() { for (var i=0; i h_out[obj.type]) h_out[obj.type] = obj.realSize.y; return obj.realSize.y; } obj.getFinalDOM = function(doc, par, x, y) { var rs = obj.realSize; if (obj.sizeFrom === undefined) { if ((rs.x <= 0) || (rs.y <= 0)) return; if (!obj.bc && !obj.img) return; } if (!obj.bc && !obj.img) return; obj.dom = doc.createElement('div'); if (that_nst.dbg) obj.dom = getDiv(doc, obj); var ods = obj.dom.style; for (var i in obj.css) { try { ods[i] = obj.css[i]; } catch(e) { utils.raport('J1-', 'unsupported css value', i + ' ' + obj.css[i]); } } if (obj.bc) ods.backgroundColor = obj.bc; ods.width = rs.x + 'px'; ods.height = rs.y + 'px'; ods.left = x + 'px'; ods.top = y + 'px'; if (obj.a) adda(obj.dom, obj.a); par.appendChild(obj.dom); if (obj.oncomplete) { obj.oncomplete(obj.dom); } } return obj; } this.textDiv = function(fc, bc, tc, txt, sfs, type) { var obj = that_nst.emptyDiv(0, 0, fc, bc); obj.tc = tc; obj.txt = txt; obj.sfs = sfs; obj.type = type; obj.go1 = function(doc, checkNodes, textNodes, smallDOM) { obj.checkSize = true; if (obj.type) checkNodes.push(obj); if (!obj.fixed) textNodes.push(obj); obj.dom = getDiv(doc, obj); var ds = obj.dom.style; for (var i in obj.css) ds[i] = obj.css[i]; if (obj.tc) ds.color = obj.tc; if (obj.bc) ds.backgroundColor = obj.bc; ds.width = ''; ds.height = ''; obj.span = doc.createElement('span'); obj.span.innerHTML = obj.txt; obj.dom.appendChild(obj.span); smallDOM.appendChild(obj.dom); return obj.minSize; } obj.setFullSize = function(dim, size) { if (size < 0) utils.raport('J2', 'negative full size: ' + dim, size); if (size === 0 && obj.txt) utils.raport('J2', 'no full size: ' + dim, size); obj.realSize[dim] = size; obj.dom.style.width = obj.realSize[dim] + 'px'; } obj.setFontSize = function(fs) { var cs = obj.sfs(fs); obj.dom.style.fontSize = cs.fs + 'px'; obj.dom.style.lineHeight = cs.fs + cs.lh + 'px'; } obj.getRealSize = function() { obj.realSize.y = obj.span.offsetHeight; if (obj.dom.offsetHeight > obj.span.offsetHeight) { utils.raport('J1-', 'check heights', 'div: ' + obj.dom.offsetHeight + ', span: ' + obj.span.offsetHeight); obj.realSize.y = obj.dom.offsetHeight; } if (obj.txt && (obj.realSize.y < 5)) { obj.realSize.y = (parseInt(obj.dom.style.fontSize) + 4) * Math.floor(obj.txt.length * 10 / obj.realSize.x + 1); if (obj.txt.length > 1 && !conf.get('force_write', false)) { utils.raport('J1', 'no height info available', obj.realSize.y + ', ' + obj.dom.style.fontSize); } } obj.exceedsWidth = obj.span.offsetWidth > obj.realSize.x + 0; obj.lastSizes = {x: obj.span.offsetWidth, y: obj.span.offsetHeight}; if (obj.exceedsWidth && obj.onWidthExceeded) { obj.onWidthExceeded(obj.span.offsetWidth - (obj.realSize.x + 0)); } } obj.getFinalDOM = function(doc, par, x, y) { if (obj.oncomplete) { obj.oncomplete(); obj.span.innerHTML = obj.txt; } var ds = obj.dom.style; ds.width = obj.realSize.x + 'px'; ds.height = obj.realSize.y + 'px'; ds.fontFamily = that_nst.font; ds.left = x + 'px'; ds.top = y + 'px'; if (obj.a) adda(obj.dom, obj.a); par.appendChild(obj.dom); utils.later('ckech span width', function() { if (obj.skipWidthChangeTest) return; if (obj.txt != '' && obj.span.offsetWidth != obj.lastSizes.x) { syso('width changed: ' + obj.txt); utils.raport('J1', 'span width changed', obj.lastSizes.x + ' != ' + obj.span.offsetWidth); } }); } return obj; } this.table = function(c, r, wx, wy, sx, sy) { var obj = {}; obj.colc = c; obj.rowc = r; obj.cellc = {x: c, y: r}; if (wx === undefined) wx = []; if (wy === undefined) wy = []; if (sx === undefined) sx = []; if (sy === undefined) sy = []; obj.weights = {x: wx, y: wy}; obj.minSizes = {x: sx, y: sy}; obj.cells = []; for (var x=0; x 0) { totalW += wg[i]; heavy.push(i); size -= obj.realSizes[dim][i]; } else { size -= obj.realSizes[dim][i]; } } var w0 = size % totalW; var w1 = (size - w0) / totalW; var hn = heavy.length; for (var i=0; i s1) s1 = h_in[ch.type]; if (s1 > obj.realSizes.y[ch.y]) obj.realSizes.y[ch.y] = s1; if (ch.exceedsWidth) obj.exceedsWidth = true; } var size = 0; for (var y=0; y maxY) { tn.txtPrefix = tn.txtPrefix.substring(0, tn.txtPrefix.lastIndexOf(' ')); tn.span.innerHTML = tn.txtPrefix + ' ...'; throw 'retry'; } }, undefined, undefined, 0); tn.oncomplete = function() { tn.dom.style.height = ''; utils.later('sety1', f); }; obj.css = {}; obj.go1 = function(doc, checkNodes, textNodes, smallDOM) { tn.css = obj.css; return oldgo1(doc, checkNodes, textNodes, smallDOM); } return obj; } this.hiddenTable = function(top, bottom, cache, id, tfc, tbc, tfsf, canShow) { var obj = that_nst.table(1, 2, [1], [1, 0]); var showAll = cache[id]; if (canShow) { obj.top = obj.cells[0][0] = that_nst.table(2, 1, [0, 1], [1], [10, 0]); var switcher = obj.top.cells[0][0] = that_nst.textDiv(tfc, tbc, 'black', showAll ? '-' : '+', tfsf); switcher.oncomplete = function() { switcher.dom.onclick = utils.onlyOnce(function() { syso('switcher clicked'); cache[id] = !showAll; cache.redraw(); }, 'mainClick'); } obj.top.cells[1][0] = top; bottom.skipWidthChangeTest = true; if (showAll) obj.cells[0][1] = bottom; } else { obj.cells[0][0] = top; } return obj; } this.root = function(tab) { var obj = {}; obj.tab = tab; obj.checkNodes = []; obj.textNodes = []; obj.exceedsWidth = false; obj.close = function(doc, root, width) { obj.root = root; obj.root.style.fontFamily = that_nst.font; obj.smallDOM = getDiv(doc, obj); obj.tab.go1(doc, obj.checkNodes, obj.textNodes, obj.smallDOM); obj.tab.setFullSize('x', width); } obj.getHeight = function(fs) { var heights = {}; for (var i=0; i'); cd.close(); div = cd.body; } catch(e) { utils.raport('P1-o', 'getIframe', e.message); cd = document; try { div.removeChild(ifr); } catch(e1){} return null; } return {cd: cd, div: div}; } this.fixfs = function(n, fs) { return {fs: fs, lh: 2}; } this.fsf = { title : function(n) {return that.fixfs(n, Math.min(n+1, 13))}, desc : function(n) {return that.fixfs(n, Math.min(n, 12))}, url : function(n) {return that.fixfs(n, Math.max(Math.min(n-1, 11), 9))}, label : function(n) {return that.fixfs(n, 10)}, small_title : function(n) {return that.fixfs(n, Math.min(n+1, 13))}, small_desc : function(n) {return that.fixfs(n, Math.min(n, 12))}, small_label : function(n) {return that.fixfs(n, 10)}, ex_title : function(n) {return that.fixfs(n, n+10)}, ex_desc : function(n) {return that.fixfs(n, n+3)}, ex_url : function(n) {return that.fixfs(n, n-1)}, ex_label : function(n) {return that.fixfs(n, 10)}, image : function(n) {return {fs: n, lh: 1}}, fixed : function(f) { return function() { return {fs: f, lh: 1}; } } } this.writeAll = function(forms, redraw, oncomplete) { utils.start('iframes'); var limit = conf.get('ads_limit'); for (var i=0; i 0; if (conf.get('force_write', false)) ok = true; if (!ok) { var n = form.node; var why = ''; for (var j=0; j<100; j++) { if (!n) { why = 'detached'; break; } if (n.tagName === 'HEAD') { why = 'head'; break; } if (n.style.display === 'none') why = 'none'; if (options('reveal')) { if (n.style.display != 'inline') n.style.display = 'block'; n.style.overflow = 'visible'; } if (n === document.body) break; n = n.parentNode; } if (why === 'none') { utils.raport('P2-o', 'display none'); } else if (why === 'detached') { utils.raport('P2-', 'form detached'); } else if (why === 'head') { utils.raport('P2-', 'form in head section'); } else { setTimeout(function() { if (that.formVisible) return; utils.raport('P2-o', 'no size info available'); }, conf.get('hiddenFormReportTimeout', 3000)); } } return ok; } this.maxFeatures = 4; this.cutoff = function(stage) { return { cutAvatars: stage <= 0, smallAzButton: stage <= 1, noC2a: stage <= 2, extraC2a: stage >= 4 }; } this.writeF = function(form, stage) { form.cutoff = that.cutoff(stage); var dom = form.write(form, form.ads); dom = that.addLabel(form, dom); dom = features.fixForm(form, dom); var root = nst.root(dom); root.close(form.doc, form.body, form.x); root.fs = that.getFontSizes(root, form, stage === 0); return root; } this.write2 = function(forms, redraw, oncomplete) { utils.start('rendering'); var anyerr = false; for (var i=0; i 0) { that.formVisible = true; utils.raport('P0-o', 'form appeared ' + (form.retries < 10 ? 'soon' : 'late'), form.retries); } form.painted = true; form.created = utils.now(); if (!conf.get('silentWriter', false)) { syso('written form #' + i + ' (' + form.placementId + ')'); } }, conf.get('retries'))(form, i); } utils.start('sync'); utils._dbg_.totalTime = utils.timeArr.rendering + 'ms'; utils.retry('waitForAll', function(forms) { for (var i=0; i= 3) { node.cells[x][y] = nst.textDiv(null, null, col.title, conf.get('labelText'), that.fsf.ex_label); node.cells[x][y].css = {textAlign: 'right', textDecoration: 'underline'}; node.cells[x][y].a = that.a_label; } } this.exForm = function(tab) { tab.type = 'A'; tab.bc = 'FFFFFF'; tab.fc = '777777'; } this.exColors = function(colors) { colors.bg = colors.headerBg = 'FFFFFF'; colors.frame = colors.headerFrame = '777777'; var check = function(col) { if ('0123456789'.indexOf(col.charAt(0)) >= 0) return true; if ('0123456789'.indexOf(col.charAt(2)) >= 0) return true; return false; } if (check(colors.title) && check(colors.desc) && check(colors.url)) return colors; colors.title = colors.desc = colors.labelTxt = '737486'; colors.url = '5368B8'; return colors; } this.addLabel = function(form, dom) { var ls = conf.get('labelSizes')(form.labelId); if (form.labelType === 1) { var ret = nst.table(2, 2, [1, 0], [1, 0]); ret.cells[0][0] = dom; var labT = nst.table(1, 3, [1], [1, 0, 0]); ret.cells[1][0] = labT; labT.cells[0][0] = nst.emptyDiv(0, 0); labT.cells[0][2] = nst.emptyDiv(0, Math.min(10, (form.y - ls.vy) / 2)); labT.cells[0][1] = nst.getImgDiv(conf.get('vimgurl').replace('**', form.labelId), ls.vx, ls.vy);//FIXME labT.cells[0][1].a = that.a_label; if (!form.cutoff.smallAzButton && conf.get('moreAZ')) { features.az(ret, 0, 1, 'left', form, 1); } return ret; } else if (form.labelType === 2) { var ret = nst.table(1, 2, [1], [1, 0]); ret.cells[0][0] = dom; var labT = nst.table(3, 1, [1, 0, 0], [0]); ret.cells[0][1] = labT; labT.cells[0][0] = nst.emptyDiv(0, 0); features.az(labT, 0, 0, 'left', form, 2); labT.cells[2][0] = nst.emptyDiv(ls.hy, 0); labT.cells[1][0] = nst.getImgDiv(conf.get('himgurl').replace('**', form.labelId), ls.hx, ls.hy);//FIXME labT.cells[1][0].css.backgroundPosition = 'right'; labT.cells[1][0].a = that.a_label; return ret; } return dom; } this.getFontSizes = function(dom, form, mustFit) { var mins = 1 * conf.get('minFS') - 1; var maxs = 1 * conf.get('maxFS'); var fixed = parseInt(form.fontSize); if (!isNaN(fixed)) { dom.getHeight(fixed); return fixed; } var ok = null; var maxiter = 100; var ile; while (mins < maxs) { if (maxiter--<0) break; var check = Math.floor((mins + maxs + 1) / 2); ile = dom.getHeight(check); ok = ile <= form.y && !dom.exceedsWidth; trace(mins+' '+maxs+' '+ile+' '+(dom.exceedsWidth ? '<-->' : '')); if (ok) { mins = check; } else { maxs = check - 1; } } if (mustFit && (mins < 1 * conf.get('minFS'))) { if (ile - form.y > 0) { utils.raport('P1-o', 'not enought space in form', 'missing: ' + (ile - form.y) + ', current=' + form.y + ', required=' + ile); } if (dom.exceedsWidth) { utils.raport('P1-o', 'form width exceeded', 'x='+form.x+', y='+form.y+', c='+form.c+', r='+form.r); } } utils._dbgc_.fontSize = mins < 1 * conf.get('minFS') ? 'maroon' : 'green'; mins = Math.max(mins, 1 * conf.get('minFS')); ile = dom.getHeight(mins); utils._dbgc_.height = form.y < ile ? 'maroon' : 'green'; utils._dbg_.fontSize = mins; utils._dbg_.height = ile + ' px'; if (!ok) dom.getHeight(mins); trace('font size: ' + mins); return mins; } this.getBorder = function(tab) { var gb = function(tab, top, bottom, left, right, fc, bc) { if (tab.fc) fc = tab.fc; if (tab.bc) bc = tab.bc; if (tab.leaf || tab.fc) { if (top) top.push({fg: fc, bg: bc, node: tab}); if (bottom) bottom.push({fg: fc, bg: bc, node: tab}); if (left) left.push({fg: fc, bg: bc, node: tab}); if (right) right.push({fg: fc, bg: bc, node: tab}); } else { if (top) for (var x=0; x=0; j--) { var sub = Math.min(arr[j].size, t.end); arr[j].size -= sub; t.end -= sub; } } root.tab.dom.style.display = 'none'; for (var i=0; i 1) || (y+1/n > 1) ? 0 : 1; }, function(x, y, n) { var s = 0.4/n; return n*(1-(x+s)*(x+s)-(y+s)*(y+s))/2.0; }, function(x, y, n) { return (x<1/n) || (y<1/n) ? 0 : n*(1-x-y)/1.4; } ]; this.mergeColors = function(c1, c2, w) { var ret = ''; var digits = '0123456789abcdef'; var getc = function(c) { return digits.indexOf(c.toLowerCase()) } for (var i=0; i<3; i++) { var val1 = 16 * getc(c1.charAt(2*i)) + getc(c1.charAt(2*i+1)); var val2 = 16 * getc(c2.charAt(2*i)) + getc(c2.charAt(2*i+1)); var val = Math.max(0, Math.min(255, val1 * (1-w) + val2 * w)); ret += digits.charAt(Math.floor(val / 16)); ret += digits.charAt(val % 16); } return ret; } this.opa = function(ch, op) { try {ch.css.filter='alpha(opacity='+(op*100)+')'} catch(e) {}; try {ch.css.MozOpacity = op} catch(e) {}; try {ch.css.opacity = op} catch(e) {}; } this.setColor = function(ch, val, colors) { ch.bc = val >= 0.999 ? colors.bg : (val >= -1.001 ? colors.fg : null); if (val < 0) { var op = Math.min(1, val+1); if (op <= 0) { ch.bc = null; } else if (val < -0.01) { that.opa(ch, op); } } else { if ((colors.fg === undefined) || (colors.bg === undefined)) { utils.raport('J2', 'color definition is missing'); ch.bc = 'FF0000'; } else { if (colors.bg === 'transparent') { ch.bc = colors.fg; that.opa(ch, 1 - val); } else if (colors.fg === 'transparent') { ch.bc = colors.bg; that.opa(ch, val); } else { ch.bc = that.mergeColors(colors.fg, colors.bg, Math.max(0.0, Math.min(1.0, val))); } } } } this.drawCorner = function(form, corner, colors, hswap, vswap) { var cs1y = form.cornerSizeY; var cs1x = form.cornerSizeX; var bs = form.borderSize; var cdef = corner + '-' + cs1x + '-' + cs1y + '-' + bs; if (!that.corners[cdef]) { var c = []; for (var x=0; x 0.999) v = 0.999; if (v != last) { if (posy >= 0) cx.push({v: last, r: y - posy}); posy = y; last = v; } } cx.push({v: last, r: cs1y - posy}); } var cc = that.corners[cdef] = []; var last1 = []; var posx = -1; for (var x=0; x= 0) cc.push({v: last1, r: x - posx}); posx = x; last1 = v; } } cc.push({v: last1, r: c.length - posx}); } var csa = that.corners[cdef]; var tx = nst.table(csa.length, 1); tx.minSizes.y[0] = cs1y; for (var x=0; x maxx) return false; if (form.y < miny || form.y > maxy) return false; return utils.ifnull(cc, 1); } var avdim = function(form, minx, maxx, miny, maxy, cc) { form.avSize = {x: 72, y: 60}; return oddo(form, minx, maxx, miny, maxy, cc); } this.featureConf = function() {return [ [that.adart3, utils.adTypes.csAd, function(form) { return form.adart3 && form.cc; }], [that.billboard, utils.adTypes.billboard, function(form) { return form.ee === 'e' ? 1 : false; }], [that.rectangle, utils.adTypes.billboard, function(form) { return form.ee === 'E' ? 1 : false; }], [that.skyscraper, utils.adTypes.skyscraper, function(form) { return form.ee === 'W' ? 1 : false; }], [that.billboard, utils.adTypes.exclusive, function(form) { return form.ee === 'e' ? 1 : false; }], [that.rectangle, utils.adTypes.exclusive, function(form) { return form.ee === 'E' ? 1 : false; }], [that.skyscraper, utils.adTypes.exclusive, function(form) { return form.ee === 'W' ? 1 : false; }], [that.nkform, utils.adTypes.nkbox, function(form) { return form.merging != 7 ? form.cc : false; }], [that.nkformSmall, utils.adTypes.nkbox, function(form) { return form.merging == 7 ? 1 : false; }], [that.imageAd(false, 250, 250), utils.adTypes.imgK, function(form) { return oddo(form, 250, 299, 250, 300); }], [that.imageAd(false, 300, 250), utils.adTypes.imgSP, function(form) { return oddo(form, 300, 335, 250, 300); }], [that.imageAd(false, 336, 280), utils.adTypes.imgDP, function(form) { return oddo(form, 336, 474, 280, 300); }], [that.imageAd(false, 728, 90), utils.adTypes.imgDB, function(form) { return oddo(form, 724, 1025, 90, 130); }], [that.imageAd(true, 160, 600), utils.adTypes.imgSW, function(form) { return oddo(form, 160, 220, 600, 1000); }], [that.imageAd(false, 468, 60), utils.adTypes.imgMP, function(form) { return form.x >= 468 && form.x <= 727 && form.y >= 60 && form.y <= 200 ? 1 : false; }], [that.stdFlashAd, utils.adTypes.flash, function(form) { return form.x === 300 && form.y === 250 ? 1 : false; }], [that.smallFlashAd(468, 60), utils.adTypes.imgMF, function(form) { return form.x >= 468 && form.x <= 727 && form.y >= 60 && form.y <= 200 ? 1 : false; }], [that.avatarBilb, utils.adTypes.avatar, function(form) { return avdim(form, 200, 579, 100, 130, 1); }], [that.avatarBilb, utils.adTypes.avatar, function(form) { return avdim(form, 580, 649, 100, 130, 2); }], [that.avatarBilb, utils.adTypes.avatar, function(form) { return avdim(form, 650, 899, 100, 130, 3); }], [that.avatarBilb, utils.adTypes.avatar, function(form) { return avdim(form, 900, 1300, 100, 130, 4); }], [that.avatarRect, utils.adTypes.avatar, function(form) { return avdim(form, 250, 600, 131, 199, 2); }], [that.avatarRect, utils.adTypes.avatar, function(form) { return avdim(form, 250, 600, 200, 300, 3); }], [that.avatarTop, utils.adTypes.avatar, function(form) { return avdim(form, 160, 249, 180, 279, 1); }], [that.avatarTop, utils.adTypes.avatar, function(form) { return avdim(form, 160, 249, 280, 499, 2); }], [that.avatarTop, utils.adTypes.avatar, function(form) { return avdim(form, 160, 249, 500, 799, 3); }], [that.avatarTop, utils.adTypes.avatar, function(form) { return avdim(form, 160, 249, 800, 1100, 4); }], [that.oneLineForm, utils.adTypes.text, function(form) { form.oneLine = form.labelType === 'right' ? (Math.round((form.y - form.spacing * form.r) / form.r) < 58) && (Math.round((form.x - 16 - form.spacing * form.c) / form.c) >= 480) : (Math.round((form.y - 16 - form.spacing * form.r) / form.r) < 58) && (Math.round((form.x - form.spacing * form.c) / form.c) >= 480); return conf.get('enableOneLineForms') && form.oneLine ? form.r * form.c : false; }], [that.wideForm, utils.adTypes.text, function(form) { if (form.labelType === 4) return form.cc; if (form.y / form.r > 63) return false; if (form.x * form.r / (form.y * form.c) >= conf.get('labelXY', 6)) { return form.cc; } return false; }], [that.textForm, utils.adTypes.text, function(form) { return form.r * form.c; }] ]}; this.setBottom = function(_writer, _nst, ref) { writer = _writer; nst = _nst; that.ref = ref; } this.onBeforeIframes = function(form) { if (form.fixedSizes) return; form.fixedSizes = true; var adWarn = conf.get('ad_warn_function')(form); if (!adWarn) return; form.y += adWarn.height; } this.fixForm = function(form, dom) { var adWarn = conf.get('ad_warn_function')(form); if (adWarn) { var ret = nst.table(1, 2, [1], [0, 1], [0], [adWarn.height, 0]); ret.cells[0][0] = nst.textDiv(null, null, '000', adWarn.text, function() { return {fs: adWarn.height - 2, lh: 2}; }); var inn = conf.get('adWarnInnerHTML', false); if (inn) { ret.cells[0][0].oncomplete = function() { ret.cells[0][0].dom.innerHTML = inn; } } ret.cells[0][1] = dom; dom = ret; } return dom; } this.fixurl = function(box, form) { var ret = box.aa; if (!ret) { syso('no click-url'); return null; } if (conf.get('noClickurlTrash')) return ret; try { var cs = that.clickStats(box, form); for (var i in cs) { if (!([][i] === undefined)) continue; if (!({}[i] === undefined)) continue; ret += '&'+i+'='+cs[i]; } if (typeof(quad_events) != 'undefined') {//bc if (quad_events.ctr_param) ret += '&ctr_param=' + escape(quad_events.ctr_param); } syso('click url: ' + ret); } catch(e) { utils.exc('click_stats', e); } return ret; } this.a_box = function(box, form, ifnoflash) { return { click: utils.ftry('mainClick', utils.onlyOnce(function() { if (that.dontclick) return syso('don\'t click'); if (ifnoflash) { if (form.doc.body.innerHTML.indexOf('flashblock') < 0) return syso('flash bg click'); syso('flashblock detected'); } form.clicked = utils.now(); var url = that.fixurl(box, form); if (url) window.open(url, '_blank'); }, 'mainClick')), mousedown: function() { setTimeout(function() { if (form.clicked) return; form.clicked = utils.now(); utils.raport('J1o', 'no click', utils.now()); }, conf.get('dontClickTimeout', 3000)) }, url: box.durl, pri: 0 } } this.clickStats = function(box, form) { var now = utils.now(); return { prid: form.prid, caid: form.caid, formx: form.x, formy: form.y, time1: now - form.created, time2: now - form.created, forme: 'ex_' + form.ee }; } this.goC2a = function(form) { if (form.y <= 120) return false; if (form.cutoff.noC2a) return false; return conf.get('enableC2a') != options('noC2a'); } this.goAZ = function(form, lt) { lt = utils.ifnull(lt, 3); if (!conf.get('enableAZ')) return false; if (!that.enableAZ) return false; if (form.cutoff.noAZ) return false; if (form.labelType != lt) return false; if (form.x < 160) return false; if (form.y < 60 && lt === 3) return false; if (form.noIframe) return false; if (window != window.top) return false; return true; } this.c2a = function(node, x, y, align, text, color, form) { if (!that.goC2a(form)) return; var cta = node.cells[x][y] = nst.textDiv(null, null, color, text, function() { return {fs: conf.get('c2aFS'), lh: 2}; }); cta.css.textAlign = align; } this.bright = function(color) { return '01234567'.indexOf(color.charAt(0)) < 0 || '01234567'.indexOf(color.charAt(2)) < 0 || '0123456789AB'.indexOf(color.charAt(4)) < 0; } this.az = function(node, x, y, align, form, lt) { if (!that.goAZ(form, lt)) return; var col = writer.mergeColors(form.colors.bg, form.colors.title, conf.get('azCB')); col = writer.mergeColors(col, that.bright(col) ? '000000' : 'FFFFFF', conf.get('azBB')); var txt = conf.get(form.ee === 'W' ? 'az_shortText' : 'az_text').replace(/ /g, ' '); if (!form.aoWontFit) { txt = conf.get('az_longText').replace(/_WHERE_/g, utils.getDomain()); } var az = node.cells[x][y] = nst.textDiv(null, null, col, txt, function() { return {fs: conf.get('azFS'), lh: 2}; }); az.onWidthExceeded = function(oile) { trace('ao width exceeded by ' + oile); form.aoWontFit = true; } az.css.textAlign = align; if (conf.get('azBold')) az.css.fontWeight = 'bold'; if (conf.get('azUnderline')) az.css.textDecoration = 'underline'; az.a = {click: utils.onlyOnce(utils.apply(autoOrder.show, form.prid, form.caid, that.ref), 'mainClick'), url: conf.get('az_text'), pri: 2}; autoOrder.preload(); } this.setCss = function(node, shift) { var opts = conf.get('cssOptions') >> shift; if (opts & 1) node.css.fontWeight = 'bold'; if (opts & 8) node.css.textDecoration = 'underline'; } this.getDurl = function(form, box) { if (!form.withUrl) return ''; var durl = box.durl; var chars = ['.', '/', '?', '=', '&']; for (var i=0; i'); } return durl; } this.alignForm = function(form, node, minX, minY) { if (form.x <= minX && form.y <= minY) return node; var ex = form.x - minX; var ey = (form.y - minY) / 2; syso('transparent align required: ' + minX + ' ' + minY); var ret = nst.table(2, 3, [0, 1], [1, 0, 1], [minX, ex], [ey, minY, ey]); ret.cells[0][1] = node; return ret; } this.smallFlashAd = function(minX, minY) { return function(form) { return that.flashAd(form, minX, minY); } } this.stdFlashAd = function(form) { return that.flashAd(form); } this.flashAd = function(form, minX, minY) { minX = utils.ifnull(minX, form.x); minY = utils.ifnull(minY, form.y); form.labelType = 3; var box = form.ads[0]; utils.raport('S0-o', 'flash box', box.type); var fpv = utils.getFlashPlayerVersion(); syso('flash player version: ' + fpv); var ret = nst.table(1, 1, [1], [1]); var main = ret.cells[0][0] = nst.getImgDiv(utils.getImager(box), minX, minY); main.a = that.a_box(box, form, fpv); main.a.mousedown = function() {}; main.oncomplete = function(node) { var aa = that.fixurl(box, form); if (fpv != null) { var obj = node; var emb = form.doc.createElement('embed'); if (!utils.ie) { obj = form.doc.createElement('object'); var param = form.doc.createElement('param'); obj.appendChild(param); param.name = 'wmode'; param.value = 'opaque'; obj.setAttribute('wmode', 'opaque'); emb.setAttribute('wmode', 'opaque'); } emb.width = minX + 'px'; emb.height = minY + 'px'; emb.type = 'application/x-shockwave-flash'; if (aa) emb.setAttribute('flashvars', 'click='+escape(aa)+'&clickTag='+escape(aa)); emb.src = utils.ifnull(box.fimg, utils.getImager(box, 'flash')); emb.wmode = 'opaque'; obj.appendChild(emb); obj.style.zIndex = 100; emb.style.zIndex = 200; if (!utils.ie) node.appendChild(obj); } var a = form.doc.createElement('a'); node.appendChild(a); var d = form.doc.createElement('div'); a.appendChild(d); d.style.width = conf.get('flashLabelWidth') + 'px'; d.style.height = conf.get('flashLabelHeight') + 'px'; d.style.position = 'absolute'; d.style.left = minX - conf.get('flashLabelSmall') + 'px'; d.style.bottom = '0px'; d.style.zIndex = 10000; d.style.opacity = 1; var lurl = conf.get('flash_label_url') .replace(/_MOD3_/g, Math.floor(Math.random() * 6)) .replace(/_TS_/g, box.timestamp); d.style.backgroundImage = 'url('+lurl+')'; d.onmouseover = function() { d.style.left = minX - conf.get('flashLabelWidth') + 'px'; that.dontclick = true; }; d.onmouseout = function() { d.style.left = minX - conf.get('flashLabelSmall') + 'px'; that.dontclick = false; }; a.href = writer.a_label.href; a.target = '_blank'; } return that.alignForm(form, ret, minX, minY); } this.imgBottomLabel = function(form) { var box = form.ads[0]; var belka = nst.table(4, 1, [0, 1, 0, 0], [1], [3, 0, conf.get('img_text_label_width'), 3]); belka.cells[1][0] = nst.textDiv(null, null, 'FFFFFF', box.url, writer.fsf.image); belka.cells[1][0].a = that.a_box(box, form); belka.cells[2][0] = nst.textDiv(null, null, 'FFFFFF', conf.get('img_text_label'), writer.fsf.image); belka.cells[2][0].a = writer.a_label; belka.cells[2][0].css.textAlign = 'right'; return belka; } this.nkform = function(form) { form.cornerSizeX = form.cornerSizeY = 1; var col = form.colors; return writer.writeBoxForm(form, function (box, lastLine, lastBox, ext) { var ret = nst.table(3, 9, [0, 1, 0], [0, 0, 0, 0, 0, 0, 0, 0, 1], [ext.l, 0, ext.r], [ext.t, 0, 10, 0, 10, 0, 6, 0, ext.b]); var titleDiv = ret.cells[1][1] = nst.textDiv(null, null, col.title, box.title, writer.fsf.fixed(11, 0)); if (box.extra === 'img') { var it = ret.cells[1][3] = nst.table(2, 1, [0, 1], [1]); it.cells[0][0] = nst.getImgDiv(utils.getImager(box), 113, 75); } ret.cells[1][5] = nst.textDiv(null, null, col.desc, box.opis1, writer.fsf.fixed(11, 3)); var urlDiv = ret.cells[1][7] = nst.textDiv(null, null, col.url, box.durl, writer.fsf.fixed(11, 0)); titleDiv.css.fontWeight = 'bold'; urlDiv.css.textDecoration = 'underline'; if (!form.withUrl) { urlDiv.css.display = 'none'; } ret.fc = col.frame; ret.bc = 'FFFFFF'; ret.a = that.a_box(box, form); return ret; }); } this.nkformSmall = function(form) { var col = form.colors; var box = form.ads[0]; var ret = nst.table(1, 7, [1], [0, 0, 0, 0, 0, 0, 1], [0], [0, 10, 0, 10, 0, 6, 0]); ret.bc = 'transparent'; var titleDiv = ret.cells[0][0] = nst.textDiv(null, null, col.title, box.title, writer.fsf.fixed(11, 0)); if (box.extra === 'img') { var it = ret.cells[0][2] = nst.table(2, 1, [0, 1], [1]); it.cells[0][0] = nst.getImgDiv(utils.getImager(box), 113, 75); } ret.cells[0][4] = nst.textDiv(null, null, col.desc, box.opis1, writer.fsf.fixed(11, 3)); var urlDiv = ret.cells[0][6] = nst.textDiv(null, null, col.url, box.durl + '»', writer.fsf.fixed(11, 0)); titleDiv.css.fontWeight = 'bold'; urlDiv.css.textDecoration = 'underline'; ret.a = that.a_box(box, form); return ret; } this.imageAd = function(sky, minX, minY) { utils._dbg_.formType = 'graphics'; return function(form) { minX = utils.ifnull(minX, form.x); minY = utils.ifnull(minY, form.y); form.labelType = 3; var box = form.ads[0]; var lh = sky ? 22 : 11; var ret = nst.table(1, 2, [1], [1, 0], [0], [0, lh]); ret.cells[0][0] = nst.getImgDiv(utils.getImager(form.ads[0]), minX, minY - lh); ret.cells[0][0].a = that.a_box(box, form); if (sky) { var belka = ret.cells[0][1] = nst.table(1, 2, [1], [1, 1]); belka.cells[0][0] = nst.textDiv(null, null, 'FFFFFF', box.url, writer.fsf.image); belka.cells[0][0].a = that.a_box(box, form); belka.cells[0][0].css.textAlign = 'center'; belka.cells[0][1] = nst.textDiv(null, null, 'FFFFFF', conf.get('img_text_label'), writer.fsf.image); belka.cells[0][1].a = writer.a_label; belka.cells[0][1].css.textAlign = 'center'; } else { ret.cells[0][1] = that.imgBottomLabel(form); } ret.cells[0][1].bc = utils.ifnull(form.imgBottomColor, '000000'); return that.alignForm(form, ret, minX, minY); } } this.avImgTab = function(form, box, margin, color, ci) { var ret = nst.table(3, 3, [0, 0, 0], [0, 0, 0], [margin, 0, margin], [margin, 0, margin]); ret.cells[1][1] = nst.getImgDiv(utils.getImager(box), form.avSize.x, form.avSize.y - ci); ret.bc = form.colors.bg; return ret; } this.avColors = function(form) { form.origColors = utils.shallowCopy(form.colors); form.colors = writer.exColors(form.colors); form.colors.labelTxt = form.colors.title; form.colors.bg = 'FFFFFF'; form.colors.headerBg = 'FFFFFF'; form.colors.frame = '777777'; form.colors.headerFrame = '777777'; } this.avatarBilb = function(form) { utils._dbg_.formType = 'avatar-bilb'; return that.avatarLeft(form, 1, form.ads.length); } this.avatarRect = function(form) { utils._dbg_.formType = 'avatar-rect'; return that.avatarLeft(form, form.ads.length, 1); } this.avatarLeft = function(form, r, c) { var sp = form.cutoff.cutAvatars ? 1 : 4; var ci = form.cutoff.cutAvatars ? 4 : 0; form.r = r; form.c = c; that.avColors(form); return writer.writeBoxForm(form, function (box, lastLine, lastBox, ext) { var ret = nst.table(4, 3, [0, 0, 1], [0, 1, 0], [sp + ext.l, form.avSize.x, 0], [sp, form.avSize.y - ci, sp]); var itab = ret.cells[1][1] = nst.table(3, 3, [1, 0, 1], [options('centerAvY') ? 1 : 0, 0, 1]); itab.cells[1][1] = that.avImgTab(form, box, 0, '000077', ci); ret.cells[2][1] = that.singleBox(form, box, lastLine, lastBox, {l: 6, t: 0, b: 0, r: ext.r}, true); ret.a = that.a_box(box, form); ret.bc = form.colors.bg; ret.fc = form.colors.frame; if (lastLine) return that.addLabelBar(ret, form, box.x === 0, lastBox, ext); return ret; }); } this.avatarTop = function(form) { utils._dbg_.formType = 'avatar-top'; var sp = 6; form.r = form.ads.length; form.c = 1; that.avColors(form); return writer.writeBoxForm(form, function (box, lastLine, lastBox, ext) { var es = form.ads.length === 2 ? 6 : 0; var ret = nst.table(3, 3, [0, 1, 0], [0, 0, 1], [sp, 0, sp], [sp + es, 0, sp]); var itab = ret.cells[1][1] = nst.table(3, 3, [options('centerAvX') ? 0 : 1, 0, 1], [1, 0, 1]); itab.cells[1][1] = that.avImgTab(form, box, 0, '000077', 0); ret.cells[1][2] = that.singleBox(form, box, lastLine, lastBox, {l: 0, t: sp, b: 0, r: 0}, true); ret.bc = 'FFFFFF'; ret.fc = '777777'; ret.a = that.a_box(box, form); if (lastLine) return that.addLabelBar(ret, form, true, true, ext); return ret; }); } this.billboard = function(form) { utils._dbg_.formType = 'billboard'; var box1 = form.ads[0]; var col = writer.exColors(form.colors); var ret = nst.table(5, 3, [0, 0, 0, 1, 0], [1, 0, 1], [10, 0, 30, 0, 10], [6, 0, 0]); writer.exForm(ret); var tImg = ret.cells[1][1] = nst.table(1, 3, [1], [0, 0, 1], [200], [50, 5, 0]); tImg.cells[0][0] = nst.getImgDiv(utils.getImager(box1), 200, 50); tImg.cells[0][1].css.backgroundPosition = 'center'; tImg.cells[0][2] = nst.textDiv(null, null, col.url, box1.durl, writer.fsf.ex_url); tImg.cells[0][2].css.textAlign = 'center'; var tDesc = ret.cells[3][1] = nst.table(1, 5, [1], [0, 0, 0, 0, 1], [0], [0, 8, 20, 0, 0]); tDesc.cells[0][0] = nst.textDiv(null, null, col.title, box1.title, writer.fsf.ex_title); tDesc.cells[0][0].css = {fontWeight: 'bold', textDecoration: 'underline'}; tDesc.cells[0][2] = nst.textDiv(null, null, col.desc, box1.opis1, writer.fsf.ex_desc); tDesc.cells[0][2].css = {fontWeight: 'bold'}; ret.a = that.a_box(box1, form); ret = that.addLabelBar(ret, form, true, true, {exColors: col, bm: 4}); ret = writer.addCorners(ret, form, {tl: 3, tr: 3, bl: 3, br: 3}); return ret; } this.rectangle = function(form) { utils._dbg_.formType = 'rectangle'; var box1 = form.ads[0]; var col = writer.exColors(form.colors); var ret = nst.table(1, 12, [1], [1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0], [0], [8, 50, 10, 0, 16, 0, 10, 0, 10, 0, 0, 8]); writer.exForm(ret); ret.cells[0][1] = nst.getImgDiv(utils.getImager(box1), 200, 50); ret.cells[0][1].css.backgroundPosition = 'center'; ret.cells[0][3] = nst.textDiv(null, null, col.url, box1.url, writer.fsf.ex_url); ret.cells[0][3].css.textAlign = 'center'; ret.cells[0][5] = nst.textDiv(null, null, col.title, box1.title, writer.fsf.ex_title); ret.cells[0][5].css = {textAlign: 'center', fontWeight: 'bold', textDecoration: 'underline'}; ret.cells[0][7] = nst.textDiv(null, null, col.desc, box1.opis1, writer.fsf.ex_desc); ret.cells[0][7].css = {textAlign: 'center', fontWeight: 'bold'}; that.c2a(ret, 0, 9, 'center', conf.get('c2aText'), col.title, form); ret.a = that.a_box(box1, form); ret = that.addLabelBar(ret, form, true, true, {exColors: col, bm: 10}); ret = writer.addCorners(ret, form, {tl: 3, tr: 3, bl: 3, br: 3}); return ret; } this.skyscraper = function(form) { utils._dbg_.formType = 'skyscraper'; var box1 = form.ads[0]; var col = writer.exColors(form.colors); var ret = nst.table(1, 12, [1], [0, 0, 2, 0, 0, 0, 0, 3, 0, 0], [0], [20, 50, 10, 0, 20, 0, 10, 0, 0, 10, 0, 10]); writer.exForm(ret); ret.cells[0][1] = nst.getImgDiv(utils.getImager(box1), 140, 120); ret.cells[0][3] = nst.textDiv(null, null, col.title, box1.title, writer.fsf.ex_title); ret.cells[0][3].css.textAlign = 'center'; ret.cells[0][3].css.textDecoration = 'underline'; ret.cells[0][5] = nst.textDiv(null, null, col.desc, box1.opis1, writer.fsf.ex_desc); ret.cells[0][5].css.textAlign = 'center'; ret.cells[0][5].css.fontWeight = 'bold'; that.c2a(ret, 0, 7, 'right', conf.get('c2aText'), col.title, form); ret.cells[0][8] = nst.textDiv(null, null, col.url, box1.url, writer.fsf.ex_url); ret.cells[0][8].css.textAlign = 'center'; ret.a = that.a_box(box1, form); ret = that.addLabelBar(ret, form, true, true, {exColors: col, bm: 10}); ret = writer.addCorners(ret, form, {tl: 3, tr: 3, bl: 3, br: 3}); return ret; } this.wideForm = function(form) { utils._dbg_.formType = 'wide'; form.labelType = 4; var lw = conf.get('textLabelWidth'); if (that.goC2a(form)) { lw = Math.max(lw, conf.get('c2aWidth')); } return writer.writeBoxForm(form, function(box, lastLine, lastBox, ext) { var col = form.colors; var ret = nst.table(5, 5, [0, 5, 0, 0, 0], [0, 0, 0, 1, 0], [ext.l, 0, 0, lw, ext.r], [0, 0, 0, 0, 0]); ret.cells[1][1] = nst.textDiv(col.headerFrame, col.headerBg, col.title, box.title, writer.fsf.small_title, 'T'); ret.cells[1][1].css.fontWeight = 'bold'; ret.cells[1][3] = nst.textDiv(col.frame, col.bg, col.desc, box.opis1, writer.fsf.small_desc, 'D'); if (lastBox && lastLine) { var ltab = ret.cells[3][3] = nst.table(1, 3, [1], [1, 1, 0]); ltab.cells[0][2] = nst.textDiv(col.frame, col.bg, col.url, conf.get('labelText'), writer.fsf.small_label); ltab.cells[0][2].css.textAlign = 'right'; ltab.a = writer.a_label; } else { var ltab = ret.cells[3][3] = nst.table(1, 2, [1], [1, 1]); that.c2a(ltab, 0, 1, 'right', conf.get('c2aText'), col.title, form); } for (var x=0; x 2; var col = form.colors; var ret = nst.table(2, 3, [1, 0], [1, 0, 1], [0, lw], [0, 0, 0]); var html = ('_T_ ' + '_D_ ' + '_U_') .replace(/_CT_/g, col.title) .replace(/_T_/g, box.title) .replace(/_CD_/g, col.desc) .replace(/_D_/g, box.opis1) .replace(/_CU_/g, col.url) .replace(/_U_/g, form.withUrl ? box.durl : ''); ret.cells[0][1] = nst.textDiv(null, null, null, html, writer.fsf.small_desc, 'O'); ret.cells[0][1].a = that.a_box(box, form); if (last && !that.goAZ(form)) { var ltab = ret.cells[1][1] = nst.table(1, 2, [1], [0, 1]); if (form.cutoff.extraC2a) { ltab.weights.y[0] = 1; that.c2a(ltab, 0, 0, 'right', conf.get('c2aShortText'), col.title, form); ltab.cells[0][0].a = that.a_box(box, form); } ltab.cells[0][1] = nst.textDiv(null, null, col.labelTxt, conf.get('labelText'), writer.fsf.small_label, 'O'); ltab.cells[0][1].css.textDecoration = 'underline'; ltab.cells[0][1].css.verticalAlign = 'middle'; ltab.cells[0][1].css.textAlign = 'right'; ltab.cells[0][1].a = writer.a_label; writer.center(ltab.cells[0][1]); } else { that.c2a(ret, 1, 1, 'right', conf.get('c2aShortText'), col.title, form); ret.cells[1][1].a = that.a_box(box, form); } var ret1 = nst.table(3, 3, [0, 1, 0], [0, 1, 0], [ext.l, 0, ext.r], [Math.floor(ext.t / 2), 0, Math.floor(ext.b / 2)]); ret1.cells[1][1] = ret; ret1.type = 'O'; ret1.fc = col.frame; ret1.bc = col.bg; if (lastLine && that.goAZ(form) && form.labelType > 2) { return that.addLabelBar(ret1, form, box.x === 0, lastBox, ext); } return ret1; }); } this.textForm = function(form) { utils._dbg_.formType = 'text'; return writer.writeBoxForm(form, function (box, lastLine, lastBox, ext) { return that.singleBox(form, box, lastLine, lastBox, ext); }); } this.singleBox = function(form, box, lastLine, lastBox, ext, forAvatars) { var col = form.colors; var canAddAZ = box.x === 0 && lastLine && !forAvatars; var textLabel = form.labelType === 3 && lastLine; var ret = nst.table(1, 2, [1], [0, 1]); var top = ret.cells[0][0] = nst.table(3, 3, [0, 1, 0], [1, 0, 1], [ext.l, 0, ext.r], [ext.t, 0, 3]); var bottom = ret.cells[0][1] = nst.table(3, 5, [0, 1, 0], [0, 0, 1, 0, lastLine && lastBox && form.labelType >= 3 || !that.goC2a(form) ? 0 : 1], [ext.l, 0, ext.r], [0, 0, 0, 0, ext.b]); if (!forAvatars) { top.type = 'T'; bottom.type = 'D'; } top.fc = col.headerFrame; top.bc = col.headerBg; top.tc = col.title; bottom.fc = col.frame; bottom.bc = col.bg; var title = top.cells[1][1] = nst.textDiv(null, null, null, box.title, writer.fsf.title); title.css.fontWeight = 'bold'; title.css.textDecoration = 'underline'; var desc = bottom.cells[1][0] = nst.textDiv(null, null, col.desc, box.opis1, writer.fsf.desc); var url = bottom.cells[1][1] = nst.textDiv(null, null, col.url, that.getDurl(form, box), writer.fsf.url); url.css.textDecoration = 'underline'; var labelTab = bottom.cells[1][3] = nst.table(2, 1, [1, 0], [1], [0, conf.get('c2aWidth')]); if (!textLabel || !lastBox || form.cutoff.extraC2a) { that.c2a(labelTab, 1, 0, 'right', conf.get('c2aText'), col.title, form); } ret.a = that.a_box(box, form); if (textLabel && !forAvatars) return that.addLabelBar(ret, form, box.x === 0, lastBox, ext); return ret; } this.addLabelBar = function(node, form, left, right, flags) { flags = utils.ifnull(flags, {}); var col = utils.ifnull(flags.exColors, form.colors); var ret = nst.table(1, 2, [1], [1, 0]); ret.cells[0][0] = node; var bar = ret.cells[0][1] = nst.table(5, 3, [0, 1, 0, 0, 0], [0, 1, 0], [utils.ifnull(flags.l, 0), 0, 0, right ? conf.get('textLabelWidth') : 0, utils.ifnull(flags.r, 0)], [utils.ifnull(flags.tm, 0), 1, utils.ifnull(flags.bm, 0)]); bar.fc = col.frame; bar.bc = col.bg; if (left) { var bl = bar.cells[1][0] = nst.table(2, 1, [1, 0], [1]); that.az(bl, 0, 0, conf.get('azAlign'), form); bar.oncomplete = utils.later('aoboc', function() { if (!bl.cells[0][0].span) return trace('autoOrder button - no dom'); if (!bl.cells[0][0].dom.parentNode) return trace('autoOrder button - no parent node'); bl.cells[0][0].dom.style.width = bl.cells[0][0].span.offsetWidth + 3 + 'px'; bl.cells[0][0].dom.parentNode.style.backgroundColor = bl.cells[0][0].dom.style.backgroundColor; }); } if (right && form.labelType === 3) { var label = bar.cells[3][0] = nst.textDiv( null, null, col.labelTxt, conf.get('labelText'), writer.fsf.label); label.css.textAlign = 'right'; label.css.textDecoration = 'underline'; label.a = writer.a_label; } return ret; } /**** ADART FORMS ****/ this.ago = function(when) {//XXX localization! if (when <= 0) return ['?', unescape('kiedy%u015B'), '']; var t = (utils.now() - when) / 1000; if (t <= 1) return ['?', 'teraz', '']; var d = [ {n: 60, d:['sek', 'sek', 'sek']}, {n: 60, d:['min', 'min', 'min']}, {n: 24, d:['godz', 'godz', 'godz']}, {n: 30, d:[unescape('dzie%u0144'), 'dni', 'dni']}, {n: 12, d:['m-c', 'm-ce', 'm-cy']}, {n: 100, d:['rok', 'lata', 'lat']} ]; for (var i=0; i 0) t1 = 1; if (d[i].n > 4) t1 = 2; if (t < d[i].n) return [Math.floor(t), d[i].d[t1], ' temu']; t /= d[i].n; } return ['?', 'dawno', 'temu']; } this.short = function(str, form) { var max = (form.x / form.c - 60) / 3.6; if (str.length < max) return str; return str.substring(0, max - 3).replace(/\s+[^\s]+$/, '...'); } this.fsaa = function(d, h) { h = utils.ifnull(h, 0); return function(n) { return {fs: Math.min(11, n) + d, lh: 2 + h}; } } this.darker = function(col, oile) { oile = Math.min(1, Math.max(-1, oile)); var digits = '0123456789ABCDEF'; var dark1 = function(c1) { var b = Math.min(15, Math.max(0, digits.indexOf(c1))); if (oile > 0) return digits.charAt(b * (1 - oile)); return digits.charAt(b + (b - 15) * oile); } var ret = ''; for (var i=0; i<6; ++i) { ret += dark1(col.charAt(i)); } return ret; } this.adart3 = function(form) { //form.colors.headerFrame = form.colors.desc; var bs = form.borderSize; var ls = conf.get('labelSizes')(form.labelPos); var fs = that.fsaa; var ret = nst.table(3, 3, [0, 1, 0], [0, 1, 0], [bs, 0, bs], [bs, 0, 0]); ret.bc = form.colors.frame; for (var i=0; i<2; ++i) { var corner = ret.cells[[0, 2][i]][2] = nst.table(1, 4, [1], [0, 0, 1, 0], [0], [0, bs, 0, 0]); corner.cells[0][2].bc = 'transparent'; corner.cells[0][3].bc = 'transparent'; } var main = ret.cells[1][1] = nst.table(2 * form.c - 1, 2 * form.r - 1); main.bc = form.colors.bg; for (var x=0; x 0) { main.weights.x[2 * x - 1] = 0; main.minSizes.x[2 * x - 1] = 1; var line = main.cells[2 * x - 1][2 * y] = nst.table(1, 3, [1], [0, 1, 0], [1], [4, 0, 4]); line.cells[0][1].bc = form.colors.frame; } if (y > 0) { main.weights.y[2 * y - 1] = 0; main.minSizes.y[2 * y - 1] = 1; var line = main.cells[2 * x][2 * y - 1] = nst.table(3, 1, [0, 1, 0], [1], [4, 0, 4], [1]); line.cells[1][0].bc = form.colors.frame; } } } var labelImgDiv = nst.getImgDiv(conf.getUrl('himgurl').replace('**', form.labelPos), ls.hx, ls.hy); labelImgDiv.a = writer.a_label; if (form.labelPos === 0) { var labelCell = nst.table(3, 3, [0, 1, 0], [0, 1, 0], [1, 0, 1], [1, 0, 1]); labelCell.bc = 'BBBBBB'; labelCell.cells[1][1] = labelImgDiv; var labout = ret.cells[1][2] = nst.table(1, 2, [1], [0, 1], [0], [bs, 0]); var labin = labout.cells[0][1] = nst.table(3, 1, [1, 0, 0], [1], [0, 0, 15], [0]); labin.bc = 'transparent'; labin.cells[1][0] = labelCell; labelCell.minSizes.y[0] = 0; } else { var shdown = 6; ret.cells[0][2].weights.y[0] = ret.cells[2][2].weights.y[0] = 1; ret.cells[0][2].minSizes.y[3] = ret.cells[2][2].minSizes.y[3] = shdown; var labfg = nst.table(3, 1, [1, 0, 0], [1], [0, 0, 15], [0]); labfg.bc = 'transparent'; labfg.cells[1][0] = labelImgDiv; var labbg = nst.table(1, 4, [1], [1, 0, 1], [0], [0, bs, 0, shdown]); labbg.cells[0][0].bc = form.colors.bg; labbg.cells[0][1].bc = form.colors.frame; labbg.cells[0][2].bc = 'transparent'; ret.cells[1][2] = nst.layered([labbg, labfg]); } return ret; } } try {x.x.x} catch(e) {static.fstarts.push(['cusom', e.lineNumber, 0])}; //cusom box features try {x.x.x} catch(e) {static.fstarts.push(['boxStatic', e.lineNumber, 35])}; utils = new Utils(conf, spliter.cookie_params); try { utils.checkVersion('ads1', ads1_version); } catch(e) { utils.raport('S2', 'old ads1 script'); } utils.checkVersion('spliter', spliter.ver); utils.fstarts = static.fstarts; utils.evlog = static.evlog; utils.prid = spliter.prid; utils.caid = spliter.caid; static.placementUtils = new PlacementUtils(conf, utils, spliter.cookie_params); static.parser = new Parser(conf, utils, spliter.cookie_params); static.autoOrder = new AutoOrder(conf, utils); static.features = new Features(conf, utils, spliter.cookie_params, static.autoOrder); static.featureConf = static.features.featureConf(); static.features.enableAZ = spliter.enableAZ; static.writer = new Writer(conf, utils, spliter.cookie_params, static.features, (spliter.ref+'').substring(2)); static.lock = true; static.forms = []; static.global = { ignoreContent: false, extraContent: '' }; static.cache = {}; static.without = []; static.withoutMap = {}; static.checkAdsLimit = function() { if (conf.get('emptyBoxes')) return; if (spliter.cookie_params('noLimit')) return syso('skipping ads limit check'); var cc = 0; for (var i=0; i/g, '>'); } static.validateAds = function(ads) { for (var i=0; i ' + set); if (static.lock === set) return false; static.lock = set; if (typeof(adp_forms) === 'object') adp_forms = null; return true; } static.adc_go1 = utils.ftry('go1', function() { syso('go1'); utils.start('other'); static.evlog.s += ' B1'; var er = spliter.earlyRaports; for (var i=0; i= 0) ch = '&'; b.a += escape(ch) + spliter.u_params; } if (conf.get('enableLandingPageParams')) { b.a=b.a.replace(new RegExp('\\$'+conf.get('prefix'),'g'), '%24'+conf.get('prefix')) .replace('%24'+conf.get('prefix')+'visid', escape(b.id)) .replace('%24'+conf.get('prefix')+'adid', escape(b.aid)) .replace('%24'+conf.get('prefix')+'campid', escape(b.cid)) .replace('%24'+conf.get('prefix')+'pubdomain', escape(b._d)); } b.aa = conf.get('ctr_url') .replace(/_D_/g, b._d) .replace(/_U_/g, b.a) .replace(/_UE_/g, escape(b.a)) .replace(/_K_/g, b._k) .replace(/_E_/g, b._e); if (spliter.events.ctr_param != undefined) { b.aa = b.aa+'&ctr_param='+spliter.events.ctr_param; } if (b._t != '') { b.aa += '&tag=' + b._t; } if (b._qpc != '') { b.aa = b._qpc.replace('quad_ctr', escape(b.aa)); } b.aa = b.aa.replace('?', '?p='+spliter.pserver_id+'&'); } spliter.fire('onbeforewrite'); return ads; } static.removeOldAds = utils.retry('removeOldAds', function() { var todorm = document.getElementById('todo_rm_'+conf.get('prefix')); if (todorm) { syso('removed empty space'); todorm.parentNode.removeChild(todorm); throw 'retry'; } }); static.extraForm = utils.retry('extraForm', function() { if (!static.setLock(true)) throw 'retry'; static.evlog.s += ' BE'; utils.raport('P0-o', 'delayed form found'); static.placementUtils.parseScripts(static.forms, static.global, spliter.events, spliter.rqh, placement_map, spliter.lastChangeForChannel, static.prefix, spliter.encoding, utils.ftry('go4', function() { spliter.fire('onafterformsparsed', static.forms, static.global, true); for (var i=0; i cc) break; if (static.withoutMap['#'+ads[i].id]) utils.syso1('got repeated ads'); static.withoutMap['#'+ads[i].id] = true; static.without.push(ads[i].id); } } static.checkLateAKPlacements = utils.retry('checkLateAKPlacements', function() { if (typeof(adKontekst_pola) === 'undefined') return; var ile = 0; for (var i=0; i 0) nextPlacement(); throw 'retry'; }, utils.duzo); static.writeBoxes = utils.ftry('writeBoxes', function(allads) { utils.start('other'); if (allads.length === 0) return utils.noAds(); syso('got ' + allads.length + ' ads.'); static.fixCtrUrls(allads); quad_spliter.boxes = spliter.allads; static.blockIds(allads, static.cc); static.removeOldAds(); static.chooseAds(static.forms, allads); static.checkLateAKPlacements(); if (spliter.safemode) { for (var i=0; i 0) utils.raport('P2-o', 'late AK placements found', ile); }), conf.get('longTimeout')); static.setLock(false); })); }); static.callback = static.writeBoxes; //changes after 1st call static.writeSingleForm = function(line, getAds) { utils.defaultColor = conf.get('subframeSysoColor'); syso('writing single form'); var ads = getAds(); if (ads.length === 0) return utils.raport('S2', 'no ads dd'); var form = static.placementUtils.readForm(document.body, line); static.forms.push(form); static.chooseAds([form], static.fixCtrUrls(ads)); form.noIframe = true; static.writer.writeAll([form], false, function() { syso('done.'); }); } static.adFrame = function(form, noIframe) { form.noIframe |= noIframe; if (form.painted) return; if (!form.noIframe) return; form.painted = true; syso('adFrame'); if (form.ads.length === 0) return utils.raport('J2', 'adFrame - no ads');//? static.features.onBeforeIframes(form); var ids = ''; for (var i=0; i