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=e74vptaen3orte7399289cuhhf&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?