var mode = "V"; var ads = [{"id": 42, "banners": [{"id": 53, "name": "CanalWhatsapp", "img": "http://www.liganortedesalto.com/descargas/prueba/2024_canalWhatsappSecEcuestres.gif", "url": "https://whatsapp.com/channel/0029Va9XZb23gvWdMs9gmq3W", "ads": 42}], "name": "2024_CanalWhatsapp", "waittime": 10, "active": true, "seq": false, "width": 300, "height": 300, "mode": "V", "tournament": null}, {"id": 34, "banners": [{"id": 44, "name": "Publi", "img": "http://www.liganortedesalto.com/descargas/prueba/2023_alquilerAplicacion.png", "url": "https://api.whatsapp.com/send?phone=34650226770", "ads": 34}], "name": "AlquilerAPP", "waittime": 10, "active": true, "seq": false, "width": 300, "height": 300, "mode": "V", "tournament": null}]; var start_ad = 0; function get_col(ad) { var col = 12; if (mode == 'H') { col = col / ad.banners.length; } return col; } function get_size(ad) { var size = ""; if (mode == 'H') { size += 'height="' + ad.height + '"'; } else if (mode == 'V') { size += 'width="' + ad.width + '"'; } return size; } function gen_ad(ad) { var html = ""; var col = get_col(ad); var size = get_size(ad); for (var banner in ad.banners) { html += '
'; html += ''; html += ''; html += ''; html += '
'; } var res = document.getElementById('ads'); res.innerHTML = html; if (ads.length > 1) { setTimeout(function() { start_ad = (start_ad + 1) % ads.length; gen_ad(ads[start_ad]); }, ads[start_ad].waittime * 1000); } } if (ads.length > 0) { gen_ad(ads[start_ad]); }