function bookmarksite(title,url){ if (window.sidebar){ // firefox window.sidebar.addPanel(title, url, ""); } else if(window.opera && window.print){ // opera var elem = document.createElement('a'); elem.setAttribute('href',url); elem.setAttribute('title',title); elem.setAttribute('rel','sidebar'); elem.click(); } else if(document.all){ // ie window.external.AddFavorite(url, title); } } function checkFields( goodCss, badCss , arg1 , arg2 ){ var ok = true; elm = document.getElementById( arg1 ); if(elm){ if(elm.value.length < 4){ elm.className = badCss; elm.focus(); ok = false; } else { elm.className = goodCss; } } elm = document.getElementById( arg2 ); if(elm){ if(elm.value.length < 4){ elm.className = badCss; elm.focus(); ok = false; } else { elm.className = goodCss; } } return ok; } var sliders; function OnMouseDown(e) { if (!e){ var e = window.event; } if (e.target){ targ = e.target; } else if (e.srcElement){ targ = e.srcElement; } //defeat Safari bug if (targ.nodeType == 3){ targ = targ.parentNode; } if (targ.className){ if (targ.className == 'slider_min' || targ.className == 'slider_max'){ var slider = sliders.getSlider(targ); sliders.activeSlider = slider; slider.mousedown(e,targ); document.onmousemove = OnMouseMove; } } } function OnMouseUp(e) { if (!e){ var e = window.event; } if (e.target){ targ = e.target; } else if (e.srcElement){ targ = e.srcElement; } //defeat Safari bug if (targ.nodeType == 3){ targ = targ.parentNode; } document.onmousemove = null; sliders.activeSlider = null; } function OnMouseMove(e) { if (!e){ var e = window.event; } if (e.target){ targ = e.target; } else if (e.srcElement){ targ = e.srcElement; } //defeat Safari bug if (targ.nodeType == 3){ targ = targ.parentNode; } if (targ.className){ if (targ.className == 'slider_min' || targ.className == 'slider_max'){ var slider = sliders.getSlider(targ); slider.mousemove(e,targ); } } } function getStyle(el, cssprop){ if (el != null){ if (el.currentStyle){ //IE return el.currentStyle[cssprop] } else if (document.defaultView && document.defaultView.getComputedStyle){ //Firefox return document.defaultView.getComputedStyle(el, "")[cssprop] } else {//try and get inline style return el.style[cssprop] } } else { return ""; } } function getXpos(elem) { var coords = findPos(elem); return coords[0]; } function getYpos(elem) { var coords = findPos(elem); return coords[1]; } function findPos(obj) { var curleft = curtop = 0; if (obj.offsetParent) { do { curleft += obj.offsetLeft; curtop += obj.offsetTop; } while (obj = obj.offsetParent); } return [curleft,curtop]; } function mouseOverImage( elmNode , img ){ var elm = document.getElementById( "productFotoKleinHolder0" ); if(elm){ elm.className = "productFotoKleinHolder"; } var elm = document.getElementById( "productFotoKleinHolder1" ); if(elm){ elm.className = "productFotoKleinHolder"; } var elm = document.getElementById( "productFotoKleinHolder2" ); if(elm){ elm.className = "productFotoKleinHolder"; } var elm = document.getElementById( "productFotoKleinHolder3" ); if(elm){ elm.className = "productFotoKleinHolder"; } var elm = document.getElementById( elmNode ); if(elm){ elm.className = "productFotoKleinHolderSelected"; } var elm = document.getElementById( "productFoto" ); if(elm){ elm.innerHTML = ''; } } function zoekfilter(critid,critob) { var zoekob = document.getElementById("zoekcrit"+critid); var collectie = zoekob.value; if (collectie.length == 0){ collectie = []; } else { collectie = zoekob.value.split(","); } var val = critob.value; if (val.length > 0){ if (critob.checked){ if (collectie.length > 0){ if (!in_array(val, collectie)){ collectie[collectie.length] = val; } } else { collectie = [val]; } } else { if (collectie.length > 0){ collectie = strip_array(val, collectie); } } } if (collectie.length == 0){ zoekob.value = ""; } else { zoekob.value = collectie.join(","); } var zf = document.getElementById('zoekform'); if (zf){ zf.submit(); } } function ExtractNumber(value) { var n = parseInt(value); return n == null || isNaN(n) ? 0 : n; } function Slider(id,min,max,count) { id = "#"+id; $( id ).slider( {min:min, max:max, range: true, step: 500,values: [min,max], slide: function( event, ui ) { $( "#amount" ).html( "€" + Math.ceil(ui.values[ 0 ]/100) + " - €" + Math.ceil(ui.values[ 1 ]/100) ); }, stop: function(event,ui){ clickZoekFilter(this,0,ui.values[0],ui.values[1]); } } ); } //------------------------ array functies ------------------------ /** * controleer of een bepaalde waarde in de array zit * @param mixed mValue de waarde die in de array zou kunnen staan * @return bool found true als de waarde is gevonden, anders false * TODO: proberen dit via prototype te implementeren **/ function in_array(mValue, aCollect){ var found = false; if (aCollect != null){ var iLen = aCollect.length; var i = 0; while (!found && i < iLen){ found = (aCollect[i] == mValue); i++; } } return found; } /** * verwijdert een bepaalde waarde uit de array en geeft de opgeschoonde * array terug * @param mixed mValue waarde die verwijderd moet worden * @param array aCollect array waaruit we willen verwijderen * @return array **/ function strip_array(mValue, aCollect){ var aRes = new Array(); for (var i in aCollect){ el = aCollect[i]; if (el != mValue){ aRes[aRes.length] = el; } } return aRes; } function urlencode (str) { // URL-encodes string // // version: 1109.2015 // discuss at: http://phpjs.org/functions/urlencode // + original by: Philip Peterson // + improved by: Kevin van Zonneveld (http://kevin.vanzonneveld.net) // + input by: AJ // + improved by: Kevin van Zonneveld (http://kevin.vanzonneveld.net) // + improved by: Brett Zamir (http://brett-zamir.me) // + bugfixed by: Kevin van Zonneveld (http://kevin.vanzonneveld.net) // + input by: travc // + input by: Brett Zamir (http://brett-zamir.me) // + bugfixed by: Kevin van Zonneveld (http://kevin.vanzonneveld.net) // + improved by: Lars Fischer // + input by: Ratheous // + reimplemented by: Brett Zamir (http://brett-zamir.me) // + bugfixed by: Joris // + reimplemented by: Brett Zamir (http://brett-zamir.me) // % note 1: This reflects PHP 5.3/6.0+ behavior // % note 2: Please be aware that this function expects to encode into UTF-8 encoded strings, as found on // % note 2: pages served as UTF-8 // * example 1: urlencode('Kevin van Zonneveld!'); // * returns 1: 'Kevin+van+Zonneveld%21' // * example 2: urlencode('http://kevin.vanzonneveld.net/'); // * returns 2: 'http%3A%2F%2Fkevin.vanzonneveld.net%2F' // * example 3: urlencode('http://www.google.nl/search?q=php.js&ie=utf-8&oe=utf-8&aq=t&rls=com.ubuntu:en-US:unofficial&client=firefox-a'); // * returns 3: 'http%3A%2F%2Fwww.google.nl%2Fsearch%3Fq%3Dphp.js%26ie%3Dutf-8%26oe%3Dutf-8%26aq%3Dt%26rls%3Dcom.ubuntu%3Aen-US%3Aunofficial%26client%3Dfirefox-a' str = (str + '').toString(); // Tilde should be allowed unescaped in future versions of PHP (as reflected below), but if you want to reflect current // PHP behavior, you would need to add ".replace(/~/g, '%7E');" to the following. return encodeURIComponent(str).replace(/!/g, '%21').replace(/'/g, '%27').replace(/\(/g, '%28'). replace(/\)/g, '%29').replace(/\*/g, '%2A').replace(/%20/g, '+'); }