var bannersPos1 = new Array();
bannersPos1[0] = ["aHR0cDovL3d3dy5qYWNrcG90Y2l0eS5jby51ay9pbmRleC5hc3A/cz1hZmY4Mjc4NCZjdXJyZW5jeT0kJmE9YWZmYWQyNjk=","","jpc600x74-hu.gif","1","-1","10",""];
bannersPos1[1] = ["aHR0cDovL2Fkc2VydmluZy51bmliZXQuY29tL3JlZGlyZWN0LmFzcHg/cGlkPTE3MjE4JmJpZD0zMjM2","unibet casino","unibet600.gif","1","-1","88",""];
bannersPos1[2] = ["aHR0cDovL3NlcnZlLjIxbm92YS5jb20vcHJvbW9SZWRpcmVjdD9tZW1iZXI9d3RpbmZvJmNhbXBhaWduPURFRkFVTFQmY2hhbm5lbD1IdW5nYXJ5JnpvbmU9ODUyOTQ3ODQ1JmxwPTA=","","21n600x74hu.gif","1","-1","98",""];
bannersPos1[3] = ["aHR0cDovL2Nhc2luby5iZXQzNjUuY29tL29ubGluZS1jYXNpbm8tcmVwb3J0cy8/YWZmaWxpYXRlPTM2NV8wNjA3NTY=","","bet365c600x74hu.gif","1","-1","224",""];
bannersPos1[4] = ["aHR0cDovL3d3dy5icmlnaHRzaGFyZS5jb20vY2xpY2tzY291bnRlci5waHA/Y29tcGFpZ249MTU3MiZncm91cGlkPTAmYlRhZz1hc2FmZjEzMTZfaHVuZ2FyeSZhZmZpZD0xNDgw","","asc-600x74-hungaria.gif","1","-1","99",""];
var bannersPos2 = new Array();
bannersPos2[0] = ["aHR0cDovL3d3dy5qYWNrcG90Y2l0eS5jby51ay9pbmRleC5hc3A/cz1hZmY4Mjc4NCZjdXJyZW5jeT0kJmE9YWZmYWQyNjk=","Jackpot City Casino","jpc468x60-hu.gif","2","-1","10",""];
bannersPos2[1] = ["aHR0cDovL3NlcnZlLjIxbm92YS5jb20vcHJvbW9SZWRpcmVjdD9tZW1iZXI9d3RpbmZvJmNhbXBhaWduPURFRkFVTFQmY2hhbm5lbD1IdW5nYXJ5JnpvbmU9ODUyOTQ3ODQ1JmxwPTA=","","21n468x60hu.gif","2","-1","98",""];
bannersPos2[2] = ["aHR0cDovL3NlcnZlLndpbGxpYW1oaWxsY2FzaW5vLmNvbS9wcm9tb1JlZGlyZWN0P21lbWJlcj13dGluZm8mY2FtcGFpZ249REVGQVVMVCZjaGFubmVsPUh1bmdhcnkmem9uZT0xMzc0MTMzMzE0JmxwPTA=","","whcc468x60hu.gif","2","-1","78",""];
bannersPos2[3] = ["aHR0cDovL2Nhc2luby5iZXQzNjUuY29tL29ubGluZS1jYXNpbm8tcmVwb3J0cy8/YWZmaWxpYXRlPTM2NV8wNjA3NTY=","","bet365c468x60hu.gif","2","-1","224",""];
bannersPos2[4] = ["aHR0cDovL3d3dy5icmlnaHRzaGFyZS5jb20vY2xpY2tzY291bnRlci5waHA/Y29tcGFpZ249MTU3MiZncm91cGlkPTAmYlRhZz1hc2FmZjEzMTZfaHVuZ2FyeSZhZmZpZD0xNDgw","","asc-468x60-hungaria.gif","2","-1","99",""];
var bannersPos3 = new Array();
bannersPos3[0] = ["aHR0cDovL3d3dy5qYWNrcG90Y2l0eS5jby51ay9pbmRleC5hc3A/cz1hZmY4Mjc4NCZjdXJyZW5jeT0kJmE9YWZmYWQyNjk=","Jackpot City Casino","jpc120x600-hu.gif","3","-1","10",""];
bannersPos3[1] = ["aHR0cDovL3NlcnZlLjIxbm92YS5jb20vcHJvbW9SZWRpcmVjdD9tZW1iZXI9d3RpbmZvJmNhbXBhaWduPURFRkFVTFQmY2hhbm5lbD1IdW5nYXJ5JnpvbmU9ODUyOTQ3ODQ1JmxwPTA=","","21n120x600hu.gif","3","-1","98",""];
bannersPos3[2] = ["aHR0cDovL3NlcnZlLndpbGxpYW1oaWxsY2FzaW5vLmNvbS9wcm9tb1JlZGlyZWN0P21lbWJlcj13dGluZm8mY2FtcGFpZ249REVGQVVMVCZjaGFubmVsPUh1bmdhcnkmem9uZT0xMzc0MTMzMzE0JmxwPTA=","","whcc120x600hu.gif","3","-1","78",""];
bannersPos3[3] = ["aHR0cDovL2Nhc2luby5iZXQzNjUuY29tL29ubGluZS1jYXNpbm8tcmVwb3J0cy8/YWZmaWxpYXRlPTM2NV8wNjA3NTY=","","bet365c120x600hu.gif","3","-1","224",""];
bannersPos3[4] = ["aHR0cDovL3d3dy5icmlnaHRzaGFyZS5jb20vY2xpY2tzY291bnRlci5waHA/Y29tcGFpZ249MTU3MiZncm91cGlkPTAmYlRhZz1hc2FmZjEzMTZfaHVuZ2FyeSZhZmZpZD0xNDgw","","asc-120x600-hungaria.gif","3","-1","99",""];
var bannersPos4 = new Array();
bannersPos4[0] = ["aHR0cDovL3d3dy5qYWNrcG90Y2l0eWJpbmdvLmNvLnVrL2luZGV4LmFzcD9zPWFmZjgyNzg0JmE9YWZmYWQyNjk=","online bingo","jc-banner-300x250-01-hun.gif","4","1","10",""];
bannersPos4[1] = ["aHR0cDovL3d3dy5qYWNrcG90Y2l0eS5jby51ay9pbmRleC5hc3A/cz1hZmY4Mjc4NCZjdXJyZW5jeT0kJmE9YWZmYWQyNjk=","online casinos","jpc300x250-hu.gif","4","4","10",""];
bannersPos4[2] = ["aHR0cDovL3NlcnZlLjIxbm92YS5jb20vcHJvbW9SZWRpcmVjdD9tZW1iZXI9d3RpbmZvJmNhbXBhaWduPURFRkFVTFQmY2hhbm5lbD1IdW5nYXJ5JnpvbmU9ODUyOTQ3ODQ1JmxwPTA=","","21n300x250hu.gif","4","1","98",""];
bannersPos4[3] = ["aHR0cDovL2Nhc2luby5iZXQzNjUuY29tL29ubGluZS1jYXNpbm8tcmVwb3J0cy8/YWZmaWxpYXRlPTM2NV8wNjA3NTY=","","bet365c300x250hu.gif","4","1","224",""];
bannersPos4[4] = ["aHR0cDovL2h1Ljg4OGNhc2luby5jb20vYWZmaWxpYXRlcy9vY3IuaHRtP3NyPTM0ODQ3OQ==","","888c-300x250-hu.gif","4","1","31",""];
bannersPos4[5] = ["aHR0cDovL3d3dy5icmlnaHRzaGFyZS5jb20vY2xpY2tzY291bnRlci5waHA/Y29tcGFpZ249MTU3MiZncm91cGlkPTAmYlRhZz1hc2FmZjEzMTZfaHVuZ2FyeSZhZmZpZD0xNDgw","","asc-300x250-hungaria.gif","4","1","99",""];
$(document).ready(function() {
var totalAdsTypeArr = new Array(1,2,3,4);
var pageTitle = document.title; // Get Page Meta Title
var pageURL = location.href;
var pagePath = pageURL.substr(jsBaseURL.length);
pageTitle = pageTitle.substring(0,pageTitle.indexOf('Onlinecasinoreports.hu'));
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 bannerSelected2 = 0; // for inner pages
var bannerHTML = '';
// Check if we should look for keywords banner or get by product type depending on the banner position and sub location
if (adPosId == 4) // only in inner pages (not index or products page)
{
// check if in one of the products sections
var subLocation = -1;
if (pagePath.indexOf('onlinecasinos') == 0) subLocation = 1;
else if (pagePath.indexOf('onlinebingo') == 0) subLocation = 2;
else if (pagePath.indexOf('onlinepoker') == 0) subLocation = 3;
else if (pagePath.indexOf('sportsbetting') == 0) subLocation = 4;
else if (pagePath.indexOf('lotteries') == 0) subLocation = 5;
else if (pagePath.indexOf('skillgames') == 0) subLocation = 6;
else if (pagePath.indexOf('financialbetting') == 0) subLocation = 7;
else if (pagePath.indexOf('mobilegaming') == 0) subLocation = 8;
if (subLocation != -1) // look for banners by product type (sub location)
{
// Going throw each banner and add the ones with the right sub location
var matchedBannersArr = new Array();
jQuery.each(bannersForPosition, function(index, bannerData){
if (bannerData[4] == subLocation) { // If banner match to sub location
matchedBannersArr.push(bannerData);
}
});
}
else // look for banners by keywords
{
// 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[1].length > 0) { // If has keywords
var bannerKeywordsArr = bannerData[1].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 2 randomly
if (matchedBannersArr.length > 0) {
matchedBannersArr.sort(function() {return 0.5 - Math.random()}) // suffle array
bannerSelected = matchedBannersArr.pop();
bannerSelected2 = matchedBannersArr.pop();
}
if (!bannerSelected || !bannerSelected2)
{
// Going throw each banner and add the ones with casino sub location
var matchedBannersArr = new Array();
jQuery.each(bannersForPosition, function(index, bannerData){
if (bannerData[4] == 1) { // If banner match to sub location
matchedBannersArr.push(bannerData);
}
});
matchedBannersArr.sort(function() {return 0.5 - Math.random()}) // suffle array
if (!bannerSelected)
bannerSelected = matchedBannersArr.pop();
if (!bannerSelected2)
bannerSelected2 = matchedBannersArr.pop();
}
}
if (adPosId == 1) // only front page
{
// Going throw each banner and add the ones with casino sub location
var matchedBannersArr = new Array();
jQuery.each(bannersForPosition, function(index, bannerData){
matchedBannersArr.push(bannerData);
});
matchedBannersArr.sort(function() {return 0.5 - Math.random()}) // suffle array
bannerSelected = matchedBannersArr.pop();
}
if (adPosId == 2 || adPosId == 3) // Product Page
{
productId = $("#adPosition"+adPosId).html();
var matchedBannersArr = new Array();
jQuery.each(bannersForPosition, function(index, bannerData){
if (bannerData[5] == productId) { // If banner match to product id
matchedBannersArr.push(bannerData);
}
});
matchedBannersArr.sort(function() {return 0.5 - Math.random()}) // suffle array
bannerSelected = matchedBannersArr.pop();
}
// If finally banner was selected - print it!
if (bannerSelected != 0)
{
if (bannerSelected[6]) // If has a flash code banner
bannerHTML += bannerSelected[6];
else // Image banner
bannerHTML += '
';
$("#adPosition"+adPosId).html(bannerHTML);
$("#adPosition"+adPosId).show();
if (bannerSelected2) {// additional banner to print
if (bannerSelected2[6]) // flash banner
banner2HTML = bannerSelected2[6];
else // image banner
banner2HTML = '
';
$("#adPosition"+adPosId+"sec").html(banner2HTML);
$("#adPosition"+adPosId+"sec").show();
}
}
}
});
});