var CeneoAP = { options: { ad_creation: null, ad_channel: null, ad_partner: null, ad_type: 1, ad_content: null, ad_format: 1, ad_newpage: true, ad_basket: false, ad_formatTypeId: 1, ad_includePrice: true, ad_includePicture: true, ad_includeRating: false, ad_customWidth: 400, ad_rowCount: 1, ad_columnCount: 3, ad_bdColor: null, ad_bgColor: null, ad_txColor: null, ad_priceColor: null, ad_fontSize: 12, ad_boldPrice: false, ad_imageHeight: 50, ad_container: 'ceneoaffcontainer', ad_onAfterRender: null, ad_hideLogo: false, ad_fontOptionId: 1, ad_fontOptionName: null, ad_sUpButton: false, ad_upButtonT: null, ad_upButtonTCol: null, ad_upButtonBcgCol: null, ad_upButtonRPc: 0, ad_sDwnButton: false, ad_dwnButtonT: null, ad_dwnButtonTCol: null, ad_dwnButtonBcgCol: null, ad_dwnButtonRPc: 0, ad_sPrBor: false, ad_prBorCol: null, ad_prBorWth: 0, ad_hMore: false, ad_redirect: null, ad_showRank: false }, ad_container: null, ad_GetRotatorProductsMethod: '//partnerzyapi.ceneo.pl/External/RotatorProducts', ad_stylesheet: '//partnerzyapi.ceneo.pl/Content/apv2_pl-PL.css', // ------ Privates ------ // _ApplyOptions: function (opts) { for (name in opts) { $CeneoAP.options[name] = opts[name]; } $CeneoAP.ad_container = document.getElementById($CeneoAP.options.ad_container); }, _IncludeCssScript: function (href) { if (href == null || href == '') return; var ss = document.styleSheets; for (var i = 0, max = ss.length; i < max; i++) { var sshref = ss[i].href; if (sshref != null && sshref.substr(sshref.length - href.length) === href) { return; } } var link = document.createElement("link"); link.setAttribute("href", href); link.setAttribute("rel", "stylesheet"); link.setAttribute("type", "text/css"); link.setAttribute("charset", "utf-8"); var head = document.getElementsByTagName('head')[0]; head.appendChild(link); }, // ------ Public ------ // Render: function (opts) { $CeneoAP._IncludeCssScript($CeneoAP.ad_stylesheet + "?" + parseInt(new Date().getTime() / 86400, 10)); // refresh css $CeneoAP._ApplyOptions(opts); if ($CeneoAP.options.ad_partner == null) return; var isContextual = $CeneoAP.options.ad_contextual != null ? $CeneoAP.options.ad_contextual : false; var isRecommended = $CeneoAP.options.ad_recommended != null ? $CeneoAP.options.ad_recommended : false; var rotatorMethodUrl = $CeneoAP.ad_GetRotatorProductsMethod; var request = rotatorMethodUrl + ($CeneoAP.options.ad_creation != null ? "?creation=" + $CeneoAP.options.ad_creation : "") + ($CeneoAP.options.ad_channel != null ? "&channel=" + $CeneoAP.options.ad_channel : "") + "&partner=" + $CeneoAP.options.ad_partner + ($CeneoAP.options.ad_type != null ? "&type=" + $CeneoAP.options.ad_type : "") + ($CeneoAP.options.ad_content != null ? "&content='" + $CeneoAP.options.ad_content + "'" : "") + ($CeneoAP.options.ad_format != null ? "&format=" + $CeneoAP.options.ad_format : "") + "&container=" + $CeneoAP.options.ad_container + "&newpage=" + $CeneoAP.options.ad_newpage + "&basket=" + $CeneoAP.options.ad_basket + "&formatTypeId=" + $CeneoAP.options.ad_formatTypeId + "&includePrice=" + $CeneoAP.options.ad_includePrice + "&includePicture=" + $CeneoAP.options.ad_includePicture + "&includeRating=" + $CeneoAP.options.ad_includeRating + "&customWidth=" + $CeneoAP.options.ad_customWidth + "&rowCount=" + $CeneoAP.options.ad_rowCount + "&columnCount=" + $CeneoAP.options.ad_columnCount + "&boldPrice=" + $CeneoAP.options.ad_boldPrice + "&fontSize=" + $CeneoAP.options.ad_fontSize + "&imageHeight=" + $CeneoAP.options.ad_imageHeight + ($CeneoAP.options.ad_bdColor != null ? "&bdColor=" + $CeneoAP.options.ad_bdColor : "") + ($CeneoAP.options.ad_bgColor != null ? "&bgColor=" + $CeneoAP.options.ad_bgColor : "") + ($CeneoAP.options.ad_txColor != null ? "&txColor=" + $CeneoAP.options.ad_txColor : "") + ($CeneoAP.options.ad_pcColor != null ? "&pcColor=" + $CeneoAP.options.ad_pcColor : "") + "&isContextual=" + isContextual + (isContextual ? "&referrerUrl=" + encodeURIComponent(window.location) : "") + (isContextual ? ($CeneoAP.options.ad_forceCategory != null ? "&forceContextualCategoryRestriction=" + $CeneoAP.options.ad_forceCategory : "") : "") + "&isRecommended=" + isRecommended + "&fontOptionId=" + $CeneoAP.options.ad_fontOptionId + "&hMore=" + $CeneoAP.options.ad_hMore + ($CeneoAP.options.ad_redirect != null ? "&redirect=" + $CeneoAP.options.ad_redirect : "") + "&showRank=" + $CeneoAP.options.ad_showRank; if($CeneoAP.options.ad_fontOptionId == 3){ request = request + "&fontOptionName=" + $CeneoAP.options.ad_fontOptionName; } if($CeneoAP.options.ad_hideLogo){ request = request + "&hideLogo=true"; } if($CeneoAP.options.ad_sUpButton){ request = request + "&sUpButton=" + $CeneoAP.options.ad_sUpButton + "&upButtonT=" + $CeneoAP.options.ad_upButtonT + "&upButtonTCol=" + $CeneoAP.options.ad_upButtonTCol + "&upButtonBcgCol=" + $CeneoAP.options.ad_upButtonBcgCol + "&upButtonRPc=" + $CeneoAP.options.ad_upButtonRPc } if($CeneoAP.options.ad_sDwnButton){ request = request + "&sDwnButton=" + $CeneoAP.options.ad_sDwnButton + "&dwnButtonT=" + $CeneoAP.options.ad_dwnButtonT + "&dwnButtonTCol=" + $CeneoAP.options.ad_dwnButtonTCol + "&dwnButtonBcgCol=" + $CeneoAP.options.ad_dwnButtonBcgCol + "&dwnButtonRPc=" + $CeneoAP.options.ad_dwnButtonRPc } if($CeneoAP.options.ad_sPrBor){ request = request + "&sPrBor=" + $CeneoAP.options.ad_sPrBor + "&prBorCol=" + $CeneoAP.options.ad_prBorCol + "&prBorWth=" + $CeneoAP.options.ad_prBorWth; } var script = document.createElement("script"); script.setAttribute("language", "javascript"); script.setAttribute("type", "text/javascript"); script.setAttribute("src", request); script.setAttribute("charset", "utf-8"); $CeneoAP.ad_container.appendChild(script); } }; var $CeneoAP = CeneoAP; if (CeneoAPOptions != null) { for (var i = 0; i < CeneoAPOptions.length; i ++) { $CeneoAP.Render(CeneoAPOptions[i]); } CeneoAPOptions = null; }