var timer_schalen; var bezig; var afb_teller; function init_afb(){ afb = new Array(); url_ar = new Array(); nieuw_venster_ar = new Array(); afb_teller = 1; bezig = false; aantal_afb = 2; afb[1] = "pics/banner/109/thumbs/950x334_N-Gear_Flash_Banner.jpg"; url_ar[1]= "https://www.gearandaudio.com/n-gear?favoriet_pagina=0&clear_product_filter=1&full_clear_product_filter=1&product_filter_merk_162=1"; nieuw_venster_ar[1]= "_self"; afb[2] = "pics/banner/108/thumbs/950x334_banner_gear_and_audio.jpg"; url_ar[2]= "https://www.gearandaudio.com/n-gear?favoriet_pagina=0&clear_product_filter=1&full_clear_product_filter=1&product_filter_merk_162=1"; nieuw_venster_ar[2]= "_self"; } function change(nr_afb){ //console.log(nr_afb); if (bezig == false) { bezig = true; afb_teller = nr_afb; // pe.stop(); var bolletjes_html = ''; for (teller = 1;teller < (2 + 1);teller++) { if (nr_afb == teller) bolletjes_html = bolletjes_html + ''; else bolletjes_html = bolletjes_html + ''; } document.getElementById('slider_balletjes').innerHTML = bolletjes_html; var pijl_nr = nr_afb + 1; if (nr_afb == 2) { pijl_nr = 1; } var wissel = afb[nr_afb]; var url = url_ar[nr_afb]; var target = nieuw_venster_ar[nr_afb]; //alert(wissel); $foto = wissel; img = new Image(); img.onload = function(){ // image has been loaded $( "#flash_content1" ).fadeOut( "slow", function() { // Animation complete. $html_new = ""; $('#flash_content1').html($html_new); $('#flash_content1').fadeIn(); bezig = false; }); }; img.src = $foto; } afb_teller++; if(afb_teller > 2){ afb_teller = 1; } window.clearTimeout(timer_schalen); timer_schalen = window.setTimeout(function() { change(afb_teller);}, 12000); } $(document).ready(function() { init_afb(); afb_teller++; if(afb_teller > 2){ afb_teller = 1; } window.clearTimeout(timer_schalen); timer_schalen = window.setTimeout(function() { change(afb_teller);}, 12000); });