var bannersPos1 = new Array(); bannersPos1[0] = ["http://serve.williamhill.com/promoRedirect?member=wtinfo&campaign=DEFAULT&channel=ocr2uk&zone=1468065675&lp=1468066112","willhill2sport600x74a.gif","",""]; bannersPos1[1] = ["http://serve.21nova.com/promoRedirect?member=wtinfo&campaign=DEFAULT&channel=co2ukdef&zone=1087727575&lp=835384460","21nova600x74.gif","",""]; bannersPos1[2] = ["http://serve.eurogrand.com/promoRedirect?member=wtinfo&campaign=DEFAULT&channel=co2ukdef&zone=583539267&lp=0","eurogrand600bigUK.jpg","",""]; var bannersPos2 = new Array(); bannersPos2[0] = ["http://serve.williamhillcasino.com/promoRedirect?member=wtinfo&campaign=DEFAULT&channel=co2ukdef&zone=913608644&lp=13510080","willhillcasino150pound.gif","","online casino"]; bannersPos2[1] = ["http://serve.williamhill.com/promoRedirect?member=wtinfo&campaign=DEFAULT&channel=ocr2uk&zone=1468065675&lp=1468066112","willhillsport300x250a.gif","","Sports Betting"]; bannersPos2[2] = ["http://serve.eurogrand.com/promoRedirect?member=wtinfo&campaign=DEFAULT&channel=co2ukdef&zone=583539267&lp=0","eurogrand300gold.gif","","online casino"]; bannersPos2[3] = ["http://serve.williamhill.com/promoRedirect?member=wtinfo&campaign=DEFAULT&channel=co2ukdef&zone=66906304&lp=0","williamhillpoker2-300x250.gif","","online poker"]; bannersPos2[4] = ["http://serve.rubybingo.com/promoRedirect?member=wtinfo&campaign=DEFAULT&channel=co2ukdef&zone=734601858&lp=0","rubybingo300x250.gif","","online bingo"]; bannersPos2[5] = ["http://serve.williamhill.com/promoRedirect?member=wtinfo&campaign=DEFAULT&channel=co2uk2def&zone=869228605&lp=13510204","willhillbingo300x250.gif","","online bingo"]; bannersPos2[6] = ["http://serve.21nova.com/promoRedirect?member=wtinfo&campaign=DEFAULT&channel=co2ukdef&zone=1087727575&lp=835384460","21nova2300x250.gif","","casino"]; bannersPos2[7] = ["http://serve.williamhill.com/promoRedirect?member=wtinfo&campaign=DEFAULT&channel=co2ukdef&zone=739154487&lp=0","willhillsport300x250a.gif","","online sports"]; var bannersPos3 = new Array(); bannersPos3[0] = ["http://serve.21nova.com/promoRedirect?member=wtinfo&campaign=DEFAULT&channel=co2ukdef&zone=1087727575&lp=835384460","21nova300x250.gif","","online casino"]; bannersPos3[1] = ["http://serve.williamhill.com/promoRedirect?member=wtinfo&campaign=DEFAULT&channel=co2ukdef&zone=739154487&lp=0","willhill2sport300x250a.gif","","online sports"]; bannersPos3[2] = ["http://serve.williamhillcasino.com/promoRedirect?member=wtinfo&campaign=DEFAULT&channel=co2ukdef&zone=913608644&lp=13510080","willhillcasino150pound.gif","","online casino"]; bannersPos3[3] = ["http://serve.williamhill.com/promoRedirect?member=wtinfo&campaign=DEFAULT&channel=co2uk2def&zone=869228605&lp=13510204","williamhillbingo2-300x250.gif","","online bingo"]; bannersPos3[4] = ["http://serve.rubybingo.com/promoRedirect?member=ocrppc&campaign=DEFAULT&channel=Ukppc&zone=1280991288&lp=13510246","rubybingo-en-300x250.gif","","online bingo"]; bannersPos3[5] = ["http://serve.williamhill.com/promoRedirect?member=wtinfo&campaign=DEFAULT&channel=co2ukdef&zone=66906304&lp=0","willhillpoker300x250a.gif","","online poker"]; var bannersPos5 = new Array(); bannersPos5[0] = ["http://www.jackpotcity.co.uk/index.asp?s=aff82784¤cy=pound&a=affad228","JackpotCity468x60.gif","","Jackpot City"]; var bannersPos6 = new Array(); bannersPos6[0] = ["http://www.jackpotcity.co.uk/index.asp?s=aff82784¤cy=pound&a=affad228","JackpotCity120x240.gif","","Jackpot City"]; $(document).ready(function() { var totalAdsTypeArr = new Array(1,2,3,4,5,6); var pageTitle = document.title; // Get Page Meta Title pageTitle = pageTitle.substring(0,pageTitle.indexOf('onlinecasinosreports.co.uk')); jQuery.each(totalAdsTypeArr, function(index, adPosId){ var bannersForPosition = window["bannersPos"+adPosId]; // Bulding the array var bannersPos1/2/etc. if ($("#adPosition"+adPosId).length > 0 && (typeof bannersForPosition != "undefined")){ // Check if the page has the Ad Div Id and Banner Exist for that type var bannerSelected = 0; var bannerHTML = ''; // Check if we should look for keywords banner or not depending on the banner position if (adPosId != 1 && adPosId != 4) // Excluding index types { // Going throw each banner and then on each one of his keywords to look for matching banners for the page title var matchedBannersArr = new Array(); jQuery.each(bannersForPosition, function(index, bannerData){ if (bannerData[3].length > 0) { // If has keywords var bannerKeywordsArr = bannerData[3].split(","); jQuery.each(bannerKeywordsArr, function(index2, bannerKeyword){ bannerKeyword = bannerKeyword.replace(/^\s+|\s+$/g, ""); // Removing white space var regEx = new RegExp(bannerKeyword,"i"); if (pageTitle.search(regEx) >= 0) { matchedBannersArr.push(bannerData); return false; // Stop after one match so it can't add the same banner more then ones } }); } }); // If there are matched banners for this page - choose one randomly if (matchedBannersArr.length > 0) { var randomBannerNum = Math.floor((matchedBannersArr.length)*Math.random()); bannerSelected = matchedBannersArr[randomBannerNum]; } } // In case no banner was selected yet and banner position is not on product page - choose random one from all the banners if (bannerSelected == 0 && adPosId != 5 && adPosId != 6) { var randomBannerNum = Math.floor((bannersForPosition.length)*Math.random()); bannerSelected = bannersForPosition[randomBannerNum]; } // If finally banner was selected - print it! if (bannerSelected != 0) { // If banner type 5 (top banner on product page) adds border if (adPosId == 5) bannerHTML += '