// ----------------------------------------------------------------- // FUNCTIES // ----------------------------------------------------------------- function toggleVisDiv(divIdStr) { if (getDivVis(divIdStr)) { setVisDivToInVis(divIdStr); } else { setVisDivToVis(divIdStr); } } function getDivVis(divIdStr) { var divobj = document.getElementById(divIdStr); if (typeof divobj == 'object' && divobj != null) { return(divobj.className.indexOf('ixlvisible') >= 0) } } function setVisDivToVis(divIdStr) { var divobj = document.getElementById(divIdStr); if (typeof divobj == 'object' && divobj != null) { divobj.className = divobj.className.replace('ixlinvisible', 'ixlvisible'); } } function setVisDivToInVis(divIdStr) { var divobj = document.getElementById(divIdStr); if (typeof divobj == 'object' && divobj != null) { divobj.className = divobj.className.replace('ixlvisible', 'ixlinvisible'); } } function togglesAllNone(allnoneToggle, namePrefixStr) { var frm = allnoneToggle.form; for (var i=0; i < frm.elements.length; i++) { var actToggle = frm.elements[i]; if (actToggle.checked != allnoneToggle.checked) { if (actToggle.name.substring(0, namePrefixStr.length) == namePrefixStr) { actToggle.checked = allnoneToggle.checked; } } } } function setRadioValue(radioHTMLNaamStr, valueStr, checkedBool) { var radiosArray = document.getElementsByName(radioHTMLNaamStr); for(var i = 0; i < radiosArray.length; i++) { if (radiosArray[i].value == valueStr) { radiosArray[i].checked = checkedBool; } } } function getRadioValue(radioHTMLNaamStr) { var radiosArray = document.getElementsByName(radioHTMLNaamStr); for(var i = 0; i < radiosArray.length; i++) { if (radiosArray[i].checked) { return radiosArray[i].value; } } return ''; } function setCookie(domain, name, value, days) { if (days) { var date = new Date(); date.setTime(date.getTime()+(days*24*60*60*1000)); var expires = "; expires="+date.toGMTString(); } else var expires = ""; document.cookie = name + "=" + value + expires + "; path=/; domain=" + domain; } function getCookie(name) { var nameEQ = name + "="; var ca = document.cookie.split(';'); for (var i = 0; i < ca.length; i++) { var c = ca[i]; while (c.charAt(0) == ' ') c = c.substring(1, c.length); if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length, c.length); } return null; } function eraseCookie(name) { createCookie(name, "", -1); } function validateEmail(obj, naam) { melding = "E-mail adres is niet geldig" if (languageKeyword == 'UK') { melding = "Email address is invalid" } var re = /^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/; if (!(re.test(obj.value))) { alert(melding); obj.focus(); return(false); } return(true); } function controleerNumberRangeMetMelding(obj, minVal, maxVal, naam) { melding1 = "Minimale waarde voor veld " + naam + " is " + minVal melding2 = "Maximale waarde voor veld " + naam + " is " + maxVal if (languageKeyword == 'UK') { melding1 = "Minimum value of " + naam + " is " + minVal melding2 = "Maximum value of " + naam + " is " + maxVal } if (eval(minVal) > eval(obj.value)) { alert(melding1); obj.focus(); return(false); } if (eval(obj.value) > eval(maxVal)) { alert(melding2); obj.focus(); return(false); } return(true); } function controleerVeldIngevuld(obj, naam) { melding1 = "Veld " + naam + " is verplicht" if (languageKeyword == 'UK') { melding1 = "Field " + naam + " is required" } if (obj.value == "") { alert(melding1); obj.focus(); return (false); } return(true); } function controleerVeldIngevuldNoFocus(obj, naam) { melding1 = "Veld " + naam + " is verplicht" if (languageKeyword == 'UK') { melding1 = "Field " + naam + " is required" } if (obj.value == "") { alert(melding1); return (false); } return(true); } function controleerLengteString(obj, minNumChars, maxNumChars, numChars, naam) { if (!controleerLengteStringByValue(obj.value, minNumChars, maxNumChars, numChars, naam)) { obj.focus(); return(false); } return (true); } function controleerLengteStringZonderMelding(obj, minNumChars, maxNumChars, numChars) { if (numChars != obj.value.length && 0 < numChars) { return(false); } if (minNumChars > obj.value.length && 0 <= minNumChars) { return(false); } if (maxNumChars < obj.value.length && 0 <= maxNumChars) { return(false); } return (true); } function controleerLengteStringByValue(objValue, minNumChars, maxNumChars, numChars, naam) { melding1 = "Het veld " + naam + " moet uit " + numChars + " karakters bestaan"; melding2 = "Het veld " + naam + " bevat te weinig karakters (minimaal: " + minNumChars + ")"; melding3 = "Het veld " + naam + " bevat te veel karakters (maximaal: " + maxNumChars + ")"; if (languageKeyword == 'UK') { melding1 = "This record has to consist of " + numChars + " characters"; melding2 = "This record requires a minimum number of characters of " + minNumChars; melding3 = "This record requires a maximum number of characters of " + maxNumChars; } if (numChars != objValue.length && 0 < numChars) { alert(melding1); return(false); } if (minNumChars > objValue.length && 0 <= minNumChars) { alert(melding2); return(false); } if (maxNumChars < objValue.length && 0 <= maxNumChars) { alert(melding3); return(false); } return (true); } function checkStringContentMetMelding(obj, allowedChars, naam) { melding1 = "In het veld " + naam + " komen karakters voor die niet zijn toegestaan (toegestaan: " + allowedChars + ")" if (languageKeyword == 'UK') { melding1 = "Characters in string that are not allowed (allowed: " + allowedChars + ")" } for (var i = 0; i < obj.value.length; i++) { var c = obj.value.charAt(i) if (allowedChars.indexOf(c) == -1) { alert(melding1); obj.select(); obj.focus(); return (false); } } return (true); } function controleerIntegerSyntaxMetMelding(obj, naam) { melding1 = "In veld " + naam + " mogen alleen getallen worden ingevoerd" if (languageKeyword == 'UK') { melding1 = "Field " + naam + " only allows numbers" } for (var i=0;i= "0" && digit <= "9")) && (!(digit == "-"))) { alert(melding1); obj.focus(); return (false); } } return(true); } function controleerFloatSyntaxMetMelding(obj, naam) { melding1 = "In veld " + naam + " mogen alleen decimale getallen worden ingevoerd" if (languageKeyword == 'UK') { melding1 = "Field " + naam + " only allows decimal numbers" } sepFound = 0; for (var i=0;i= "0" && digit <= "9") && ((!(digit == ",")) || (digit == "," && sepFound == 1)) && ((!(digit == ".")) || (digit == "." && sepFound == 1))) { alert(melding1); obj.focus(); return (false); } if (digit == "," || digit == ".") { sepFound = 1; } } return(true); } function controleerInteger(getal) { for (var i=0;i= "0" && digit <= "9")) { return (false); } } return(true); } function controleerFloat(getal) { for (var i=0;i= "0" && digit <= "9") && !(digit == ".") && !(digit == ",")) { return (false); } } return(true); } // ----------------------------------------------------------------- // PERSITS PROGRESSBAR // ----------------------------------------------------------------- var xmlHttpObj; var progressIdStr; var timeoutIdStr; function showPersitsProgress(pidStr) { try { xmlHttpObj = new XMLHttpRequest(); } catch (e) { try { xmlHttpObj = new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { xmlHttpObj = new ActiveXObject("Microsoft.XMLHTTP"); } } if (xmlHttpObj == null) { alert('Browser not supported.'); return; } document.getElementById('ixlpagina').className = 'ixlinvisible'; document.getElementById('ixlprogress').className = 'ixlvisible'; progressIdStr = pidStr; updatePersitsProgress(); } function updatePersitsProgress() { xmlHttpObj.open('GET','/_misc/persitsprogress.asp?pid=' + progressIdStr, (navigator.userAgent.indexOf('Chrome') >= 0 || navigator.userAgent.indexOf('Safari') >= 0)); xmlHttpObj.onreadystatechange = persitsProgressStateChanged; xmlHttpObj.send(null); } function persitsProgressStateChanged() { if (xmlHttpObj.readyState == 4) { if (xmlHttpObj.responseText == "") { clearTimeout(timeoutIdStr); timeoutIdStr = setTimeout('updatePersitsProgress()', 1000); return; } var xmlObj = xmlHttpObj.responseXML; if (!(xmlObj.getElementsByTagName('RemainingBytes')[0].firstChild.nodeValue == 0)) { document.getElementById('ixlprogresscontainer').className = "ixlprogresscontainer ixlvisible"; document.getElementById('ixlprogressloader').className = "ixlprogressloader ixlinvisible"; document.getElementById('ixlprogresscontainer').innerHTML = '
' + '
' + '
' + '
' + xmlObj.getElementsByTagName('UploadedBytes')[0].firstChild.nodeValue + ' / ' + xmlObj.getElementsByTagName('TotalBytes')[0].firstChild.nodeValue + '
' } else { document.getElementById('ixlprogresscontainer').className = "ixlprogresscontainer ixlinvisible"; document.getElementById('ixlprogressloader').className = "ixlprogressloader ixlvisible"; } clearTimeout(timeoutIdStr); timeoutIdStr = setTimeout('updatePersitsProgress()', 1000); } } // ----------------------------------------------------------------- // ONTWERPER // ----------------------------------------------------------------- function setConfiguratorStofvariant(stofvariantIdLng) { // id van de stofvariant in cookie setCookie(cookiedomain, 'cfgstofvariantid', stofvariantIdLng, 0); // javascript variabelen setten op basis van id van stofvariant // indien stofvariant 0 dan geenhoes, anders de actieve stof/variant opzoeken if (stofvariantIdLng == 0) { stofindex = stoffen.length - 1; stofvariantindex = -1; } else { for (s = 0; s < stoffen.length; s++) { for (v = 0; v < stoffen[s].varianten.length; v++) { if (stoffen[s].varianten[v].id == stofvariantIdLng) { stofindex = s; stofvariantindex = v; } } } } // in de configurator alle stoffen en varianten resetten naar originele class for (s = 0; s < stoffen.length; s++) { document.getElementById(stoffen[s].imgid).className = 'ixlconfiguratorstofimg'; for (v = 0; v < stoffen[s].varianten.length; v++) { document.getElementById(stoffen[s].varianten[v].imgid).className = 'ixlconfiguratorstofvariantimg'; } } // in de configurator actieve stof en variant alternatieve class geven document.getElementById(stoffen[stofindex].imgid).className = 'ixlconfiguratorstofimgact'; if (stofvariantindex >= 0) {document.getElementById(stoffen[stofindex].varianten[stofvariantindex].imgid).className = 'ixlconfiguratorstofvariantimgact';}; // in de configurator afbeelding stof aanpassen naar geselecteerde variant if (stofvariantindex >= 0) {document.getElementById(stoffen[stofindex].imgid).src = stoffen[stofindex].varianten[stofvariantindex].imggrooturl;}; // afwerking en positierits verbergen in configurator en in offerte wanneer geenhoes geselecteerd if (stofvariantIdLng == 0) { setVisDivToInVis('selectorafwerking'); setVisDivToInVis('offerteafwerking'); setVisDivToInVis('selectorpositierits'); setVisDivToInVis('offertepositierits'); } else { setVisDivToVis('selectorafwerking'); setVisDivToVis('offerteafwerking'); setVisDivToVis('selectorpositierits'); setVisDivToVis('offertepositierits'); } // in de offerte titel van de stof aanpassen var stofnaam = stoffen[stofindex].naam; if (stofvariantindex >= 0) { stofnaam += ', ' + stoffen[stofindex].varianten[stofvariantindex].naam; } document.getElementById('offertestoftitel').innerHTML = stofnaam; updateConfiguratorAmounts(); } function setConfiguratorVulling(vullingIdLng) { // id van de vulling in cookie setCookie(cookiedomain, 'cfgvullingid', vullingIdLng, 0); // javascript variabele setten op basis van id van vulling // indien vulling 0 dan geenvulling, anders de actieve vulling opzoeken if (vullingIdLng == 0) { vullingindex = vullingen.length - 1; } else { for (v = 0; v < vullingen.length; v++) { if (vullingen[v].id == vullingIdLng) { vullingindex = v; } } } // in de configurator alle vullingen resetten naar originele class for (v = 0; v < vullingen.length; v++) { document.getElementById(vullingen[v].imgid).className = 'ixlconfiguratorvullingimg'; } // in de configurator actieve vulling alternatieve class geven document.getElementById(vullingen[vullingindex].imgid).className = 'ixlconfiguratorvullingimgact'; // in de offerte titel van de vulling aanpassen document.getElementById('offertevullingtitel').innerHTML = vullingen[vullingindex].naam; updateConfiguratorAmounts(); } function setConfiguratorDikte(dikteCmLng, skpSliderUpdateBool) { if (dikteCmLng >= 4 && dikteCmLng <= 12) { // alleen hele centimeters dikteCmLng = Math.round(dikteCmLng); // dikte in cookie setCookie(cookiedomain, 'cfgdiktecm', dikteCmLng, 0); // in de configurator dikte instellen, slider niet indien de aanroep uit de onchange van de slider komt document.getElementById('dikteinput').value = dikteCmLng; if (!skpSliderUpdateBool) {$('#dikteslider').ionRangeSlider('update', {from: document.getElementById('dikteinput').value});}; updateOfferteAfmetingen(); updateConfiguratorAmounts(); } } function setConfiguratorBreedte(breedteCmLng, skpSliderUpdateBool) { if (breedteCmLng >= 30 && breedteCmLng <= 300) { // alleen hele centimeters breedteCmLng = Math.round(breedteCmLng); // breedte in cookie setCookie(cookiedomain, 'cfgbreedtecm', breedteCmLng, 0); // in de configurator breedte instellen, slider niet indien de aanroep uit de onchange van de slider komt document.getElementById('breedteinput').value = breedteCmLng; if (!skpSliderUpdateBool) {$('#breedteslider').ionRangeSlider('update', {from: document.getElementById('breedteinput').value});}; updateOfferteAfmetingen(); updateConfiguratorAmounts(); } } function setConfiguratorDieptehoogte(dieptehoogteCmLng, skpSliderUpdateBool) { if (dieptehoogteCmLng >= 30 && dieptehoogteCmLng <= 136) { // alleen hele centimeters dieptehoogteCmLng = Math.round(dieptehoogteCmLng); // dieptehoogte in cookie setCookie(cookiedomain, 'cfgdieptehoogtecm', dieptehoogteCmLng, 0); // in de configurator dieptehoogte instellen, slider niet indien de aanroep uit de onchange van de slider komt document.getElementById('dieptehoogteinput').value = dieptehoogteCmLng; if (!skpSliderUpdateBool) {$('#dieptehoogteslider').ionRangeSlider('update', {from: document.getElementById('dieptehoogteinput').value});}; updateOfferteAfmetingen(); updateConfiguratorAmounts(); } } function setConfiguratorAfwerking(afwerkingIdLng) { // id van de afwerking in cookie setCookie(cookiedomain, 'cfgafwerkingid', afwerkingIdLng, 0); // javascript variabele setten op basis van id van afwerking for (a = 0; a < afwerkingen.length; a++) { if (afwerkingen[a].id == afwerkingIdLng) { afwerkingindex = a; } } // in de configurator alle afwerkingen resetten naar originele class for (a = 0; a < afwerkingen.length; a++) { document.getElementById(afwerkingen[a].imgid).className = 'ixlconfiguratorafwerkingimg'; } // in de configurator actieve afwerking alternatieve class geven document.getElementById(afwerkingen[afwerkingindex].imgid).className = 'ixlconfiguratorafwerkingimgact'; // in de offerte titel van de afwerking aanpassen document.getElementById('offerteafwerkingtitel').innerHTML = afwerkingen[afwerkingindex].naam; updateConfiguratorAmounts(); } function setConfiguratorPositierits(positieritsAspIdLng) { // positierits in cookie setCookie(cookiedomain, 'cfgposritsaspid', positieritsAspIdLng, 0); // in de configurator positierits instellen document.getElementById('positierits').value = positieritsAspIdLng; // in de offerte positierits aanpassen if (positieritsAspIdLng == 1) { document.getElementById('offertepositieritstitel').innerHTML = 'Achterkant'; } else if (positieritsAspIdLng == 2) { document.getElementById('offertepositieritstitel').innerHTML = 'Zijkant'; } else if (positieritsAspIdLng == 3) { document.getElementById('offertepositieritstitel').innerHTML = 'Onderkant'; } } function setConfiguratorAantal(aantalLng) { // aantal in cookie setCookie(cookiedomain, 'cfgaantal', aantalLng, 0); // in de configurator aantal instellen document.getElementById('aantal').value = aantalLng; // in de offerte aantal aanpassen document.getElementById('offerteaantaltitel').innerHTML = aantalLng; updateConfiguratorAmounts(); } function initConfigurator(stofvariantIndienNogGeenLng, vullingIndienNogGeenLng, afwerkingIndienNogGeenLng) { if (!(getConfiguratorCookiesSet())) { setConfiguratorStofvariant(stofvariantIndienNogGeenLng); setConfiguratorVulling(vullingIndienNogGeenLng); setConfiguratorDikte(8, false); setConfiguratorBreedte(100, false); setConfiguratorDieptehoogte(70, false); setConfiguratorAfwerking(afwerkingIndienNogGeenLng); setConfiguratorPositierits(1); setConfiguratorAantal(1); } else { setConfiguratorStofvariant(getCookie('cfgstofvariantid')); setConfiguratorVulling(getCookie('cfgvullingid')); setConfiguratorDikte(getCookie('cfgdiktecm'), false); setConfiguratorBreedte(getCookie('cfgbreedtecm'), false); setConfiguratorDieptehoogte(getCookie('cfgdieptehoogtecm'), false); setConfiguratorAfwerking(getCookie('cfgafwerkingid')); setConfiguratorPositierits(getCookie('cfgposritsaspid')); setConfiguratorAantal(getCookie('cfgaantal')); } } function updateOfferteAfmetingen() { document.getElementById('offerteafmetingentitel').innerHTML = getCookie('cfgdiktecm') + 'cm/' + getCookie('cfgbreedtecm') + 'cm/' + getCookie('cfgdieptehoogtecm') + 'cm'; } function updateConfiguratorAmounts() { if (getConfiguratorCookiesSet() && stofindex != undefined && stofvariantindex != undefined && vullingindex != undefined && afwerkingindex != undefined) { var dikte = getCookie('cfgdiktecm'); var breedte = getCookie('cfgbreedtecm'); var diepte = getCookie('cfgdieptehoogtecm'); var stofm2 = (((2 * dikte * breedte) + (2 * breedte * diepte) + (2 * dikte * diepte)) / 10000); var stofbedrag = Math.round(stofm2 * (stoffen[stofindex].m2prijs / 100) * 100) / 100; document.getElementById('offertestofbedrag').innerHTML = stofbedrag.toFixed(2).replace(".", ","); var vullingm3 = ((dikte * breedte * diepte) / 1000000); var vullingbedrag = Math.round(vullingm3 * (vullingen[vullingindex].prijs) * 100) / 100; document.getElementById('offertevullingbedrag').innerHTML = vullingbedrag.toFixed(2).replace(".", ","); var afwerkingbedrag = 0; if (stofvariantindex >= 0) { afwerkingbedrag = Math.round(((stofbedrag + vullingbedrag) * (afwerkingen[afwerkingindex].prijsfactor / 10000) - (stofbedrag + vullingbedrag)) * 100) / 100; } document.getElementById('offerteafwerkingbedrag').innerHTML = afwerkingbedrag.toFixed(2).replace(".", ","); var stuksprijs = stofbedrag + vullingbedrag + afwerkingbedrag; document.getElementById('offertestuksprijsbedrag').innerHTML = stuksprijs.toFixed(2).replace(".", ","); setCookie(cookiedomain, 'cfgstpr', stuksprijs.toFixed(2) * 100, 0); var totaalprijs = getCookie('cfgaantal') * stuksprijs; document.getElementById('offertetotaalprijsbedrag').innerHTML = totaalprijs.toFixed(2).replace(".", ","); if (totaalprijs > 0) { setVisDivToVis('offertebutton'); } else { setVisDivToInVis('offertebutton'); } } } function getConfiguratorCookiesSet() { var setBool = true; if (setBool) {setBool = cookieSet('cfgstofvariantid')}; if (setBool) {setBool = cookieSet('cfgvullingid')}; if (setBool) {setBool = cookieSet('cfgdiktecm')}; if (setBool) {setBool = cookieSet('cfgbreedtecm')}; if (setBool) {setBool = cookieSet('cfgdieptehoogtecm')}; if (setBool) {setBool = cookieSet('cfgafwerkingid')}; if (setBool) {setBool = cookieSet('cfgaantal')}; if (setBool) {setBool = cookieSet('cfgposritsaspid')}; return (setBool); } function cookieSet(ck) { var setBool = false; if (getCookie(ck) != null) { if (getCookie(ck).length > 0) { setBool = true } } return (setBool); }