function updatesecret(varenummer) { var antal = document.getElementById("antaltobasket").value;; alert(antal); document.getElementById('secretantal').value = antal; add_to_basket(varenummer); } //************************************************************* function show_efterbehandling (varenummer) { $("#efterbeh_div").empty(); var v=varenummer.split(":"); setTimeout(function () { var t=new Date(); $.get("https://www.sbofac.dk/show_efterbeh.php?varenummer=" + v[0]+ "&pid=" + v[1] + "&t="+t.getTime()+"", function (data) { console.log(data); var added = data; $.get('https://www.sbofac.dk', function (data) { //$('#basketcontainer').append(data); }); $("#efterbeh_div").append(added); basket_count(); }); }, 100); } //************************************************************* function add_choice_to_basket (varenummer) { var choice=$("input[type='radio'][name='varenummer_liste']:checked").val(); if ($("input[type='radio'][name='extra']:checked").val()!=null) { var c2=$("input[type='radio'][name='extra']:checked").val(); var choice2=c2.split(":"); console.log("main varenummer:"+choice+" efterbeh:"+c2+""); var efterbeh=choice2['0']; var varenummer=choice2['varenr']; } else { var c2=null; var efterbeh=c2; } setTimeout(function () { if (document.getElementById("antaltobasket")) { antal = document.getElementById("antaltobasket").value;; } else { antal = 1; } var url2="https://www.sbofac.dk/add_choice_to_basket.php?varenummer=" +choice+ "&antal=" + antal + "&efterbeh="+ efterbeh+""; console.log("1 kald:"+ choice2 + " \nurl : " +url2); $.get(url2, function (data) { var added = data; $.get('https://www.sbofac.dk', function (data) { //$('#basketcontainer').append(data); }); $("#basketcontainer").append(added); basket_count(); }); }, 150); //("
"); //$("#hover").css("visibility","visible"); //$("body").prepend("
"); setTimeout(function () { //$("#basketpopup").css("display","none"); }, 5000); } function add_efterbehandling_to_basket (parent,efterbeh,varenummer) { console.log("2. kald efterbeh - parent: "+ parent +" eftbehnr:" + efterbeh +" antal:" + antal +" Main varenummer:"+varenummer+""); setTimeout(function () { if (document.getElementById("antaltobasket")) { antal = document.getElementById("antaltobasket").value;; } else { antal = 1; } var url="https://www.sbofac.dk/add_choice_to_basket.php?type=efterbeh&efterbeh=" + efterbeh+ "&antal=" + antal + "&parent="+parent+"&varenummer="+varenummer+""; console.log(url); $.get(url, function (data) { var added = data; $.get('https://www.sbofac.dk', function (data) { //$('#basketcontainer').append(data); }); $("#basketcontainer").append(added); basket_count(); }); }, 550); } //************************************************************* function basket_count() { bcount = 0; var time2 = new Date(); url = "https://www.sbofac.dk/data.php?action=basket_status&session=uvruoavq5h9ukc27bvqd01is0j&time=" + time2 + ""; $.get(url, function (data) { bcount = JSON.parse(data).prodcount; // console.log("antal i basket",bcount) $('.mini_basket_text').text(bcount); }); } function add_to_basket(varenummer) { var antal; setTimeout(function () { if (document.getElementById("antaltobasket")) { antal = document.getElementById("antaltobasket").value;; } else { antal = 1; } $.get("https://www.sbofac.dk/add_to_basket.php?varenummer=" + varenummer + "&antal=" + antal + "", function (data) { var added = data; //$.get('https://www.sbofac.dk/basket_2.php', function(data) { //$('#basketcontainer').append(data); //}); $("#basketcontainer").append(added); basket_count(); }); }, 300); // $("body").prepend("
"); //$("#hover").css("visibility","visible"); // $("body").prepend("
"); setTimeout(function () { //$("#basketpopup").css("display","none"); }, 5000); } function update_basket(lineid) { var antal = $("#antal_" + lineid + "").val(); $.get("https://www.sbofac.dk/update_basket.php?antal=" + antal + "&lineid=" + lineid + "", function (data) { $("#basketcontainer").html(data); $.get("https://www.sbofac.dk/basket.php", function (data) { $('#basketcontainer').append(data); }); }); } function remove_from_basket(lineid) { $.get("https://www.sbofac.dk/remove_from_basket.php?lineid=" + lineid + "", function (data) { $("#basketcontainer").html(data); $.get("https://www.sbofac.dk/basket.php", function (data) { $('#basketcontainer').append(data); }); }); setTimeout(function () { $("#bhtext").fadeOut(599); }, 3000); } function remove_basket() { $("#basket").fadeOut(500); $("#basketcontainer").fadeOut(500); // setTimeout(function() { // document.location.reload(); // }, 600); } $(document).ready(function () { ////**** MENU FOLD OUT ******************** $("#mobileburger").click(function () { $("html, body").animate({ scrollTop: 0 }, "fast"); $("#foldmenu").slideToggle("slow", function () { // Animation complete. }); }); if (selectedmenuitem!=null) { markNav(selectedmenuitem, selectedmenuitem_parent); } /////****OVERLAY ************* basket_count(); $("body").append(`
`); $("body").append(` `); }); function thumbnails(picname, picid, org, pictext) { $("#ytplayer").remove(); $("#mainpicture").show(); //$("#mainpicture").attr('border','1px solid red'); $("#mainpicture").attr("src",picname); // if (pictext != null) { // document.getElementById("bigpictext").innerHTML = '' + pictext + ''; // } else { // document.getElementById("bigpictext").innerHTML = ''; // } mainpicture = org; } function enhance(picid, cursorstyle) { document.getElementById(picid).style.border = "2px solid #bbb"; if (picid === "mainpicture") { document.getElementById(picid).style.cursor = "zoom-in"; } else { document.getElementById(picid).style.cursor = "pointer"; } setTimeout(function () { document.getElementById(picid).style.border = "2px solid #fff"; }, 300); } function showfullscreen(picname) { $('#lg_pic_overlay').toggle(); $('#overlayimage').attr('src', mainpicture); //document.getElementById("overlay").style.display = "block"; //document.getElementById("overlaypictureframe").style.display = "block"; //document.getElementById("overlaypicture").style.display = "block"; //document.getElementById("overlaypicture").src=mainpicture; //$("#overlaypicture") // .on('load', function() { console.log("image loaded correctly"); }) // .on('error', function() {tryagain(picname); }) } function tryagain(picname) { counter1 = 0; if (counter1 < 6 && picname != null) { counter++; setTimeout(function () { showfullscreen(picname); }, 500); } else { hidefullscreen(picname); } } function hidefullscreen(picname) { $('#lg_pic_overlay').hide(); // document.getElementById("overlay").style.display = "none"; } function showhide(myid, useid, targetheight, startheight) { var height = $("#" + useid + "").height(); if (height < startheight + 1) { // $("#"+myid+"").slideToggle(100); $("#" + useid + "").animate({ height: targetheight }, 400); console.log(startheight + " " + targetheight + " now: " + height); } if (height > startheight) $("#" + useid + "").animate({ height: startheight }, 400); console.log(); } function playvideo(src) { console.log(src); document.getElementById("bigpictext").innerHTML = ''; $("#mediadiv").append('
'); $("#mainpicture").hide(); $('#ytplayer').attr('src', src) } function showmysubs(parent) { console.log(parent + $("#" + parent + "_subgroup").css('display')); console.log(selectedmenuitem); if ($("#" + parent + "_subgroup").css('display') == 'none') { $(".left_subgroup").hide('fast'); $("#" + parent + "_subgroup").show('fast'); sidenav_animate_drop_down(parent + "_icon", parent + "_header"); } else { $("#" + parent + "_subgroup").hide('fast'); } } function openNav() { document.getElementById("mobilemenu").style.width = "100%"; document.getElementById("mobilemenu").style.height = "100%"; var m = $("#mobilemenu").last(); var offset = m.offset(); //alert(offset.top); $("#mobilemenu").css("position", "fixed"); } function closeNav() { $("#mobilemenu").css("position", "sticky"); document.getElementById("mobilemenu").style.width = "0"; document.getElementById("mobilemenu").style.height = "20px"; } function markNav(selectedmenuitem, selectedmenuitem_parent) { if (selectedmenuitem_parent > 0) { // console.log("marking ID:" + selectedmenuitem + " PARENT_ID:" + selectedmenuitem_parent); if (selectedmenuitem_parent == 0) { document.getElementById(selectedmenuitem + "_header").style.color = "#01aeef"; } else { showmysubs(selectedmenuitem_parent); document.getElementById(selectedmenuitem_parent + "_header").style.color = "#01aeef"; } } else { //console.log("marknav error not found"); } } function sidenav_animate_drop_down(id, header) { console.log("animate from mysubs:" + id + "header:" + header); if ($("#" + id + "").hasClass('drop_down_icon_180') == false) { $(".menuarrow").removeClass('drop_down_icon_180'); $(".sidenav_header").css("color", "white"); $("#" + id + "").addClass('drop_down_icon_180'); $("#" + header + "").css("color", "#01aeef"); } else { $("#" + id + "").removeClass('drop_down_icon_180'); } } $(document).ready(function () { var kpid = 0; var returpath = null; //**** show alle produkter ************ $(".alle_produkter").hover(function () { var p; var h; p = $(this).offset().top h = $("#middlemenu").height(); var newpos = (p + 54); // console.log(newpos + ' P ' + p.top + ' H ' + h + ' from this' + $(this).offset().top + ' alle produkter'); $(".submenu").hide(); $("#" + $(this).attr('show') + "").css('position', 'absolute'); $("#" + $(this).attr('show') + "").css('top', '' + newpos + 'px'); $("#" + $(this).attr('show') + "").show(); }); $(".topitem").hover(function () { var p; var h; p = $(this).offset().top h = $("#middlemenu").height(); var newpos = (p + 54); // console.log(newpos + ' P ' + p.top + ' H ' + h + ' from this' + $(this).offset().top + ''); $(".submenu").hide(); $("#" + $(this).attr('show') + "").css('position', 'absolute'); $("#" + $(this).attr('show') + "").css('top', '' + newpos + 'px'); $("#" + $(this).attr('show') + "").show(); }); $(".submenu").hover(function () { }, function () { // console.log("blurred"); $(".submenu").hide(); }); $(".submenu").click(function () { }, function () { // console.log("blurred"); // $(".submenu").hide(300); }); $(".drop_down_container").click(function () { animate_drop_down(this); }); function animate_drop_down(id) { console.log($(this).height()); if ($(id).height() == '45') { $(".drop_down_container").height(45); $(id).animate({ height: 400 }, 150); $(id).removeClass('drop_down_gradient'); $(id).addClass('drop_down_container-full'); $(id).find(".drop_down_icon").addClass('drop_down_icon_180'); } else { $(id).removeClass('drop_down_container-full'); $(id).addClass('drop_down_gradient'); $(id).find(".drop_down_icon").removeClass('drop_down_icon_180'); $(id).height(45); } } $(document).mouseup(function (e) { var container = $(".drop_down_container"); // if the target of the click isn't the container nor a descendant of the container if (!container.is(e.target) && container.has(e.target).length === 0) { $(container).removeClass('drop_down_container-full'); $(container).height(45); } }); $('#topitem_178').on('click', function (e) { console.log('login clicked'); $.get("https://www.sbofac.dk/func_login.php?action=check_login", function (data) { data = $.parseJSON(data); if (data.logged_in) window.location.href = "https://www.sbofac.dk/kundecenter/"; else { $('#pincodewhere').html('Vil du logge på som Stjernekunde?
Vi sender vi en PIN-kode til dit mobilnummer
Vælg nedenfor for at fortsætte'); $('#login_container').show(); $('#Email').focus(); } }); e.preventDefault(); }); $('#SendPinButton').on('click', function () { console.log('SendPinButton clicked:https://www.sbofac.dk'); var EmailRegex = /^([a-zA-Z0-9_.+-])+\@(([a-zA-Z0-9-])+\.)+([a-zA-Z0-9]{2,4})+$/; if (EmailRegex.test($('#Email').val())) { $.get("https://www.sbofac.dk/func_login.php?action=sendpin&email=" + $('#Email').val() + "&time=" + Date.now(), function (data) { console.log(data, data.hasOwnProperty('kpid')); data = $.parseJSON(data); if (data != null) { kpid = data.kpid; $('#loginerror').html(''); $('#login_container').hide(); $('#login_pin_container').show(); } else { $('#loginerror').html('Den tastede emailadresse findes ikke'); } // console.log("test", data.kpid, " ", data.code); }); } else $('#loginerror').html('Den tastede emailadresse er ikke korrekt'); }); function noknownuser() { var form = document.createElement('form'); form.style.visibility = 'hidden'; form.method = 'POST'; form.action = window.location.href; var input = document.createElement('input'); input.name = 'checkout_element'; input.value = 'req_email'; form.appendChild(input) var input2 = document.createElement('input'); input2.name = 'pers_email'; input2.value = $('#pers_email').val(); form.appendChild(input2) document.body.appendChild(form); form.submit(); document.getElementById('theForm').submit() } $('#CheckEmailbtn').on('click', function () { $.get("https://www.sbofac.dk/func_login.php?action=check_email&email=" + $('#pers_email').val() + "&time=" + Date.now(), function (data) { data = $.parseJSON(data); if (data.found) { $('#Email').val(data.pers_email) returpath = window.location.href; $('#pincodewhere').html('Vil du logge på som Stjernekunde?
Vi sender vi en PIN-kode til dit mobilnummer
Vælg nedenfor for at fortsætte'); $('#loginmessage').html('
Du er Stjernekunde hos Gymnashop!
Hvis du logger på kan du se om du har bonus
du kan fratrække denne bestilling.'); $('#login_container').show(); $('#Email').focus(); } else { noknownuser(); } }); }); $('#CheckEmailbtnnewuserlogin').on('click', function () { console.log("https://www.sbofac.dk/func_login.php?action=check_email&email=" + $('#check_email').val() + "&time=" + Date.now()); $.get("https://www.sbofac.dk/func_login.php?action=check_email&email=" + $('#check_email').val() + "&time=" + Date.now(), function (data) { data = $.parseJSON(data); console.log(data); if (data.found) { $('#checkmessage').html(''); $('#Email').val(data.pers_email) $('#pincodewhere').html('Vil du logge på som Stjernekunde?
Vi sender vi en PIN-kode til dit mobilnummer
Vælg nedenfor for at fortsætte'); $('#loginmessage').html('
Du er Stjernekunde hos Gymnashop!
Hvis du logger på kan du se om du har bonus
du kan fratrække denne bestilling.'); $('#login_container').show(); $('#Email').focus(); } else { $('#checkmessage').html('Vi kunne desværre ikke finde din email.

'); } }); }); $('#CheckEmailbtnnewuser').on('click', function (e) { curelement = $('#' + this.id); actiondata = curelement.data; console.log("hvor er date", curelement.data('valuefield'), this.id); $.get("https://www.sbofac.dk/func_login.php?action=check_email&email=" + $('#' + curelement.data('valuefield')).val() + "&time=" + Date.now(), function (data) { console.log(data); data = $.parseJSON(data); if (data.found) { $('#Email').val(data.pers_email) //open login $('#knownuser').show(); // $('#Email').focus(); } else { $('#' + curelement.data('showfield')).show(); $("input[name=" + curelement.data('nextfield') + "]").focus(); $("input[name=" + curelement.data('copyfield')).val($('#' + curelement.data('valuefield')).val()); } // console.log("test", data.kpid, " ", data.code); }); }); $('#gotologin').on('click', function () { $('#pincodewhere').html('Vil du logge på som Stjernekunde?
Vi sender vi en PIN-kode til dit mobilnummer
Vælg nedenfor for at fortsætte'); $('#loginmessage').html('
Du er Stjernekunde hos Gymnashop!
Hvis du logger på kan du se om du har bonus
du kan fratrække denne bestilling.'); // $('#loginservicemessage').html('
Stjernekunder har mange fordele:
- Du optjener bonus på hver ordre.
- Du kan fratrække optjent bonus ved bestilling.
- Adgang til ordre og faktura historik

Og meget andet... se mere her
'); $('#knownuser').hide(); $('#login_container').show(); $('#Email').focus(); }) $('#Email').keypress(function (event) { var keycode = (event.keyCode ? event.keyCode : event.which); if (keycode == '13') { event.preventDefault(); event.stopPropagation(); $('#SendPinButton').click(); $('#LoginPin').focus(); } }); $('#LoginPin').keypress(function (event) { var keycode = (event.keyCode ? event.keyCode : event.which); if (keycode == '13') { event.preventDefault(); event.stopPropagation(); $('#LoginPinButton').click(); } }); $('#LoginPinButton').on('click', function () { //console.log('SendPinButton clicked:https://www.sbofac.dk'); console.log('RETRUPATH', returpath); $.get("https://www.sbofac.dk/func_login.php?action=login&kpid=" + kpid + "&pin=" + $('#LoginPin').val() + "&time=" + Date.now(), function (data) { // console.log("test", data); data = $.parseJSON(data); // kpid=data.kpid; if (data.hasOwnProperty('success')) { $('#login_pin_container').hide(); // console.log('redirect to: https://www.sbofac.dk/kundecenter'); console.log('1', returpath); if (!data.kunder) { if (returpath == null) { window.location.href = "https://www.sbofac.dk/kundecenter/"; } else { window.location.href = returpath; } } else { if (returpath == null) { window.location.href = "https://www.sbofac.dk/kundecenter/kunde.html"; } else { window.location.href = "https://www.sbofac.dk/kundecenter/kunde.html?returpath=" + encodeURI(returpath); } } } }); }); $('#closeLogin').on('click', function () { $('#login_container').hide(); noknownuser(); }); $('#closePin').on('click', function () { $('#login_pin_container').hide(); $('#knownuser').hide(); }); $('#closeknownuser').on('click', function () { $('#knownuser').hide(); }); }); function mobile_fold_out_toggle(id, parent) { console.log(id + " " + parent); if ($("#" + parent + "").hasClass('foldout_mobile_content_big') == true) { $(".fokusgruppe_flex").css('height', '380px'); $(".fokus_right").css('height', '200px;'); $("#" + parent + "").removeClass('foldout_mobile_content_big'); $("#" + parent + "").addClass('foldout_mobile_content'); } else { $(".fokusgruppe_flex").css('height', 'initial'); $(".fokus_right").css('height', 'initial'); $("#" + parent + "").addClass('foldout_mobile_content_big'); $("#" + parent + "").removeClass('foldout_mobile_content'); } } function closethismenu(id) { $("#" + id + "").hide(200); } $( document ).ready(function() { $(window).scroll(function () { if ($(document).scrollTop() < 325) { // $("#bottommenu").fadeIn(300); $("#bottommenu").slideDown(200); } else { // $("#bottommenu").fadeOut(300); $("#bottommenu").slideUp(200); } }); });