var adSource; function AdsItem(pImgSrc, pImgW, pImgH, pItemLink, pItemTitle, pPriceTitle, pPrice, pTimeLeft, pNumBids, pImgType) { this.imgSrc = pImgSrc; this.imgW = pImgW; this.imgH = pImgH; this.itemLink = pItemLink; this.itemTitle = pItemTitle; this.priceTitle = pPriceTitle; this.price = pPrice; this.timeLeft = pTimeLeft; this.numBids = pNumBids; this.imgType = pImgType; this.init = function() { var i = this.price.indexOf('.00'); if (i==(this.price.length-3)) this.price = this.price.substring(0, i); } this.init(); } function AdsLink(pLink, pText) { this.link = pLink; this.text = pText; } function getTitle(pTitle, pCount) { var p = pTitle.length>pCount?'...':''; return pTitle.substring(0, pCount)+p; } function textTrunc(str, count){ if(count <= str.indexOf('') || (str.indexOf('')==-1 && str.length>count)) return str.substring(0, count)+'...'; else if(count > str.indexOf('') && count < str.indexOf('')-2) count+=3; else if(count > str.indexOf('')-5) count+=7; var p = str.length>count?'...':''; var newStr = str.substring(0, count); if(newStr.indexOf('')>-1) if(newStr.indexOf('')<0) newStr = newStr+''+p; else newStr = newStr+p; return newStr; } function ca_clickSearch(pElem) { if (pElem) pElem.value=''; return true; } function AdsTab(pKeyword,pKeywordLink,pItemCount) { this.sKeyword = pKeyword; this.sKeywordLink = pKeywordLink; this.iItemCount = pItemCount; this.aItemList = new Array(); this.aCategoryList = new Array(); this.AddItem = function(pImgSrc,pItemLink,pItemTitle,pPriceTitle,pPrice,pTimeLeft, pNumBids,pImgType) { if (this.aItemList.length < this.iItemCount) this.aItemList[this.aItemList.length] = new AdsItem(pImgSrc,80,80,pItemLink,pItemTitle,pPriceTitle,pPrice,pTimeLeft, pNumBids,pImgType); } this.AddCategory = function(pLink, pText) { this.aCategoryList[this.aCategoryList.length]=new AdsLink(pLink,pText); } this.AttachCategory = function(pCategory) { this.aCategoryList = pCategory; } } function Localize(pStr) { return pStr; } function ca_GoSearch(pURL, pKW) { var k = 'satitle='; var i = pURL.indexOf(k); if (i < 0) { k = 'satitle%3D'; i = pURL.indexOf(k); } if (i > 0) { var pre = pURL.substring(0, i+k.length); var pos = pURL.substring(pre.length, pURL.length); var e = null; if (document.all) e = document.all[pKW]; if (!e && document.getElementById) e = document.getElementById(pKW); if (e) { window.open(pre+encodeURIComponent(encodeURIComponent(e.value))+pos,"search"); } } return true; } function ca_GoSearchOnEnterKey(currentEvent, pURL, pKW) { if(currentEvent.keyCode == 13) { return ca_GoSearch(pURL, pKW); } } function AdsTextOnly120_240() { this.bgColor = "ffffff"; this.borderColor = "ffffff"; this.textColor = "3f3f3f"; this.linkColor = "2b5acc"; this.priceColor = '#990000'; this.stripeMulti = true; this.fontFamily = "Arial";this.itemTitleSize = '13px';this.titleSize = '11px';this.priceTitleSize = '10px';this.priceSize = '13px';this.timeSize = '10px';this.logoTextSize = '9px';this.rightNowSize = '12px';this.urlSize = '10px';this.searchForSize = '10px' this.spaceImg = "http://pics.ebaystatic.com/aw/pics/s.gif"; this.logoSrc = "http://pics.ebaystatic.com/aw/pics/logos/logoRightNowOn_75x42.gif"; this.logoSrcL = "http://pics.ebaystatic.com/aw/pics/logos/logoRightNowOn_98x54.gif"; this.searchForText = 'Search eBay for:'; this.shopAtText = 'Shop at eBay for:'; this.logoText = 'eBay AdContext'; this.logoLink = 'http://rover.ebay.com/rover/1/711-37018-2978-1/1?PID=2103840&AID=10420678&SID=managed&loc=http%3A%2F%2Fpages.ebay.com%2F'; this.VMLink = 'http://sofe.ebay.com/ws/eBayISAPI.dll?SojRedirect&cid=1066&ebayredir=http://affiliates.ebay.com/ads/adcontext?SSPageName=Contextad_hub'; this.searchLink = 'http://search.ebay.com/search/search.dll?satitle='; this.sepCharacter = ', '; this.adWindowText = 'eBay AdContext'; this.rightNowText = 'right now on eBay'; this.searchBoxText = 'Search eBay'; this.searchBoxLink = 'http://rover.ebay.com/rover/1/711-37018-2978-1/1?PID=2103840&AID=10420678&SID=managed&loc=http%3A%2F%2Fsearch.ebay.com%2Fsearch%2Fsearch.dll%3Fsatitle%3D%26ast%3Dd'; this.searchButtonText = 'Go'; this.findItButtonText = 'Find It'; this.browseMoreText = 'Browse more:'; this.start_Line1A_CreativeText = 'Looking for '; this.start_Line1B_CreativeText = 'Find exactly what you want today!'; this.start_Line1C_CreativeText = ''; this.start_Line2A_CreativeText = ''; this.start_Line2B_CreativeText = ''; this.start_Line2C_CreativeText = ''; this.start_Line3A_CreativeText = 'Find exactly what you want on eBay.'; this.start_Line3B_CreativeText = 'Shop eBay today!'; this.start_Line3C_CreativeText = ''; this.mid_Line1A_CreativeText = ''; this.mid_Line1B_CreativeText = ''; this.mid_Line1C_CreativeText = 'search.ebay.com/'; this.mid_Line2A_CreativeText = ' available.'; this.mid_Line2B_CreativeText = '. '; this.mid_Line2C_CreativeText = 'search.ebay.com/'; this.mid_Line3A_CreativeText = ''; this.mid_Line3B_CreativeText = ''; this.mid_Line3C_CreativeText = 'search.ebay.com/'; this.end_Line1A_CreativeText = '?'; this.end_Line1B_CreativeText = ''; this.end_Line1C_CreativeText = ''; this.end_Line2A_CreativeText = ''; this.end_Line2B_CreativeText = 'Shop now!'; this.end_Line2C_CreativeText = ''; this.end_Line3A_CreativeText = ''; this.end_Line3B_CreativeText = ''; this.end_Line3C_CreativeText = ''; this.countryId = '0'; this.width = 120; this.height = 240; this.imgWidth = '80'; this.imgHeight = '80'; this.itemCount = 2; this.titleCount = 38; this.catSize = 16; this.catCount = 2; this.kwSize = 32; this.maxChars = 13; this.maxSearchChars = 17; // item list this.itemList = new Array(); this.itemList[this.itemList.length] = new AdsItem('',0,0,'http://rover.ebay.com/rover/1/711-37018-2978-1/1?PID=2103840&AID=10420678&SID=managed&loc=http%3A%2F%2Fcgi.ebay.com%2Fws%2FeBayISAPI.dll%3FViewItem%26item%3D250519496593%26ih%3D015%26category%3D170331%26ast%3De%26rd%3D1%26keyword%3Dipod%26cacat%3D0','NEW FLEXISHIELD GEL SKIN CASE FOR IPOD NANO 5 5TH GEN','Price','$5.47',' '); // search for list contains keywords this.searchForList = new Array(); this.searchForList[this.searchForList.length] = new AdsLink('http://rover.ebay.com/rover/1/711-37018-2978-1/1?PID=2103840&AID=10420678&SID=managed&loc=http%3A%2F%2Fsearch.ebay.com%2Fsearch%2Fsearch.dll%3Fsatitle%3Dipod%26sacat%3D0%26ast%3Dd','ipod'); this.searchForList[this.searchForList.length] = new AdsLink('http://rover.ebay.com/rover/1/711-37018-2978-1/1?PID=2103840&AID=10420678&SID=managed&loc=http%3A%2F%2Fsearch.ebay.com%2Fsearch%2Fsearch.dll%3Fsatitle%3Diphone%26sacat%3D0%26ast%3Dd','iphone'); this.searchForList[this.searchForList.length] = new AdsLink('http://rover.ebay.com/rover/1/711-37018-2978-1/1?PID=2103840&AID=10420678&SID=managed&loc=http%3A%2F%2Fsearch.ebay.com%2Fsearch%2Fsearch.dll%3Fsatitle%3Dipod+touch%26sacat%3D0%26ast%3Dd','ipod touch'); this.searchForList[this.searchForList.length] = new AdsLink('http://rover.ebay.com/rover/1/711-37018-2978-1/1?PID=2103840&AID=10420678&SID=managed&loc=http%3A%2F%2Fsearch.ebay.com%2Fsearch%2Fsearch.dll%3Fsatitle%3Dcoach%26sacat%3D0%26ast%3Dd','coach'); this.searchForList[this.searchForList.length] = new AdsLink('http://rover.ebay.com/rover/1/711-37018-2978-1/1?PID=2103840&AID=10420678&SID=managed&loc=http%3A%2F%2Fsearch.ebay.com%2Fsearch%2Fsearch.dll%3Fsatitle%3Dlaptop%26sacat%3D0%26ast%3Dd','laptop'); this.searchForList[this.searchForList.length] = new AdsLink('http://rover.ebay.com/rover/1/711-37018-2978-1/1?PID=2103840&AID=10420678&SID=managed&loc=http%3A%2F%2Fsearch.ebay.com%2Fsearch%2Fsearch.dll%3Fsatitle%3Dxbox+360%26sacat%3D0%26ast%3Dd','xbox 360'); this.searchForList[this.searchForList.length] = new AdsLink('http://rover.ebay.com/rover/1/711-37018-2978-1/1?PID=2103840&AID=10420678&SID=managed&loc=http%3A%2F%2Fsearch.ebay.com%2Fsearch%2Fsearch.dll%3Fsatitle%3Ddigital+camera%26sacat%3D0%26ast%3Dd','digital camera'); this.searchForList[this.searchForList.length] = new AdsLink('http://rover.ebay.com/rover/1/711-37018-2978-1/1?PID=2103840&AID=10420678&SID=managed&loc=http%3A%2F%2Fsearch.ebay.com%2Fsearch%2Fsearch.dll%3Fsatitle%3Dwii%26sacat%3D0%26ast%3Dd','wii'); this.searchForList[this.searchForList.length] = new AdsLink('http://rover.ebay.com/rover/1/711-37018-2978-1/1?PID=2103840&AID=10420678&SID=managed&loc=http%3A%2F%2Fsearch.ebay.com%2Fsearch%2Fsearch.dll%3Fsatitle%3Dralph+lauren%26sacat%3D0%26ast%3Dd','ralph lauren'); this.searchForList[this.searchForList.length] = new AdsLink('http://rover.ebay.com/rover/1/711-37018-2978-1/1?PID=2103840&AID=10420678&SID=managed&loc=http%3A%2F%2Fsearch.ebay.com%2Fsearch%2Fsearch.dll%3Fsatitle%3Diphone+3g%26sacat%3D0%26ast%3Dd','iphone 3g'); // shop at list this.shopAtList = new Array(); this.genImage = function(pImgType,pImgSrc, pImgSize) { var str = ""; if (!pImgSize) pImgSize='80'; if (pImgType == 2 || pImgType == 1) { if (pImgSize != '80') str += ''; else str += ''; } else { // display spacer image str += ''; } return str; } this.genLink = function(pLink, pText) { var op = ''; if (pLink.length > 0) op = ''+pText+''; else op = pText; return op; } this.genStripe = function(pHeight) { return this.stripeMulti?this.genStripeMulti(pHeight):this.genStripeSingle(pHeight); } this.genStripeMulti = function(pHeight) { var op = '
'; op += ''; op += ''; op += ''; op += ''; op += ''; op += ''; op += ''; op += ''; op += '
'; return op; } this.genStripeSingle = function(pHeight) { var op = '
'; op += ''; op += '
'; return op; } this.writeAd = function() { document.write(this.genPreviewTitle()); document.write(this.genAd()); document.write(this.genSniplet()); } this.genPreviewTitle = function() { var op = ""; return op; } this.genSniplet = function() { var op = ""; op += ''; return op; } this.getTitle = function(pTitle) { var charCount = 20; var lineCount = 1; if (pTitle.length>charCount) { var p = '...'; pTitle = pTitle.substring(0, charCount*lineCount-p.length-1); var r = '',line=1; for (var i = 0;i < pTitle.length;i++) { r += pTitle.charAt(i); if ((i+1) % charCount == 0) { r += '
'; line ++; } } r += line>=lineCount?'...':''; return r; } else return pTitle; } this.genAd = function() { // outer div var op = '
';//removed height:'+this.height+'px; op += ''; op += ''; op += ''; op += ''; op += ''; op += ''; // Keywords for (var i=0;i'; var keyword = this.searchForList[i]; if (keyword){ keyword.text = keyword.text.replace(/\b[a-z]/g, function(match){ return match.toUpperCase(); }); op += this.genItem(keyword, i); }else{ op += this.genItemNull(); } op += ''; //op += ''; } //logo op += ''; op += '
'+this.genLogo()+'
'; op += '
'; return op; } this.genItem = function(keyword, indx) { var op = ''; op += ''; op += ''; op += ''; op += ''; op += ''; op += '
'; op += ''+getTitle(keyword.text, this.titleCount)+'
'; op += this.genCreative(keyword.text, indx); op += '
'; op += ''; op += ''; return op; } this.genItemNull = function() { var op = ''; op += ''; op += ''; //op += ''; op += '
'; //op += 'null ad';//DEBUG //op += '
'; op += ''; op += ''; return op; } this.genCreative = function(pItemTitle, indx) { var op=''; var link = this.searchForList[indx]; if(indx % 3 == 0) { // Creative 1 op += ''; var line = ''; line = this.start_Line1A_CreativeText; if(this.countryId == 2 || this.countryId == 3) line += ''+getTitle(pItemTitle, this.titleCount)+''; line += this.mid_Line1A_CreativeText; if(this.countryId == 0 || this.countryId == 15 || this.countryId == 186 || this.countryId == 205) line += ''+getTitle(pItemTitle, this.titleCount)+''; line += this.end_Line1A_CreativeText; op += textTrunc(line, this.maxChars); op += '
'; op += ''; line = this.start_Line1B_CreativeText; if(this.countryId == 0 || this.countryId == 15) line += ''+getTitle(pItemTitle, this.titleCount)+''; line += this.mid_Line1B_CreativeText; line += this.end_Line1B_CreativeText; op += textTrunc(line, this.maxChars); op += '
'; op += ''; // op += this.start_Line1C_CreativeText; // op += this.mid_Line1C_CreativeText; //op += this.end_Line1C_CreativeText; // op += getTitle(pItemTitle, this.titleCount); op += getTitle(this.start_Line1C_CreativeText + this.mid_Line1C_CreativeText + this.end_Line1C_CreativeText + pItemTitle, this.maxSearchChars); op += '
'; } else if(indx % 3 == 1) { // Creative 2 op += ''; var line = this.start_Line2A_CreativeText; if((this.countryId == 0) || (this.countryId == 15) || (this.countryId == 205)) line += ''+getTitle(pItemTitle, this.titleCount)+''; line += this.mid_Line2A_CreativeText; if(this.countryId == 2 || this.countryId == 3 || this.countryId == 16 || this.countryId == 203 || this.countryId == 186 || this.countryId == 123) line += ''+getTitle(pItemTitle, this.titleCount)+''; //line += this.mid_Line2A_CreativeText; //if(this.countryId == 2 || this.countryId == 3 || this.countryId == 16 || this.countryId == 203 || this.countryId == 186 || this.countryId == 123) //line += ''+getTitle(pItemTitle, this.titleCount)+''; line += this.end_Line2A_CreativeText; op += textTrunc(line, this.maxChars); op += '
'; op += ''; line = this.start_Line2B_CreativeText; if(this.countryId == 0 || this.countryId == 15) line += ''+getTitle(pItemTitle, this.titleCount)+''; else line += ''; line += this.mid_Line2B_CreativeText; line += this.end_Line2B_CreativeText; op += textTrunc(line, this.maxChars); op += '
'; //link = this.searchForList; op += ''; /** +this.start_Line2C_CreativeText; op += this.mid_Line2C_CreativeText; op += this.end_Line2C_CreativeText; //as KW3 is removed 071307 - no anemitz op += getTitle(pItemTitle, this.titleCount)+'
'; op += '
'; */ op += getTitle(this.start_Line2C_CreativeText + this.mid_Line2C_CreativeText + this.end_Line2C_CreativeText + pItemTitle, this.maxSearchChars); op += '
'; } //else if(indx % 3 == 2) { // Creative 3 - removed 071307 no KW3 //op += ''+this.start_Line3A_CreativeText; //if(this.countryId == 3 || this.countryId == 203 || this.countryId == 71 ) // op += ''+getTitle(pItemTitle, this.titleCount)+''; //op += this.mid_Line3A_CreativeText; //op += this.end_Line3A_CreativeText+'
'; //op += ''+this.start_Line3B_CreativeText; //op += ' '+this.mid_Line3B_CreativeText; //op += this.end_Line3B_CreativeText+'
'; ////link = this.searchForList; //op += ''+this.start_Line3C_CreativeText; //op += this.mid_Line3C_CreativeText; //op += this.end_Line3C_CreativeText; //op += getTitle(pItemTitle, this.titleCount)+'
'; //} //op += ''; return op; } this.genLogo = function() { var op = ''; //op += ''; op += ''; op += ''; op += ''; op += ''; op += ''; op += '
'; op += ''+this.genLink(this.VMLink, this.logoText)+''; // @todo: logo font family style //op += ''; op += '
'; //op += ''; return op; } } adSource = new AdsTextOnly120_240(); adSource.writeAd();