function runAfterElementExists(jquery_selector, callback) {var checker = window.setInterval(function() {if ($(jquery_selector).length) {clearInterval(checker);callback();}}, 500);} $(document).ready(function(){var oldArtNr = $('.art-no>span:nth-child(2)').html();var newArtNr = oldArtNr.split('-', 3);runAfterElementExists('select.custom-select', function() {if($("select.custom-select option").val() == '-1'){$('.info>li.av').hide();if (newArtNr.length > 2) {$('.art-no>span:nth-child(2)').after('' + newArtNr[0] +'-'+ newArtNr[1] +'').hide();} else{$('.art-no>span:nth-child(2)').after(''+ newArtNr[0] +'').hide();}};$("select.custom-select").change(function() {$('.newnr').remove();$('.art-no>span:nth-child(2)').delay( 1500 ).show();$('.add-to-basket-container').removeClass("disabled");$('.info>li.av').delay( 1500 ).show();});});$('input[name="variationid"]').val('431428');$(".ItemQuestionForm form > input[data-mail='subject']").val("Artikel-Nummer: " + oldArtNr); $('.ItemQuestionForm input[name="Artikelnr."]').attr('disabled', 'disabled').val(oldArtNr);$("select.custom-select").change(function() {$(".ItemQuestionForm form > input[data-mail='subject']").val("Artikel-Nummer: " + oldArtNr);}); runAfterElementExists('.img-container .bubble', function() { var oldUVP=46.95; var currentPrice = 59.95; function calculatePercent() {var percent = (oldUVP-currentPrice)/oldUVP*100;var percentRound = Math.round(percent);if(percentRound>2){$(".img-container .bubble").html("-"+percentRound+"%");} else {$(".img-container .bubble").hide();};}; calculatePercent(); }); var averageCount=$('.feedback-average-count').text();$('.sectionHeader .reviewCountTarget').html(averageCount);});