function findObject(objectId) { if(window.document.getElementById && window.document.getElementById(objectId)) return window.document.getElementById(objectId); else if (window.document.all && window.document.all(objectId)) return window.document.all(objectId); else if (window.document.layers && window.document.layers[objectId]) return window.document.layers[objectId]; else return null; } function selectInput(item) { try { if (item != null && item.value != '') { item.select(); item.focus(); } } catch(e) {} } function checkCookies() { try { var today = new Date(); var expire = new Date(); expire.setTime(today.getTime() + 3600000*24); document.cookie = 'acceptcookie=true;expires='+expire.toGMTString(); var theCookie=''+document.cookie; var ind=theCookie.indexOf('acceptcookie'); return ind != -1; } catch(e) { return false; } } function getFormData(formName) { var _form = null; var _responseBody = ''; var _elm = null; if (typeof(findObject)=='function') { _form = findObject(formName); } else { alert('Form object ' + formName + ' could not be found'); } if (_form == null) return null; for(i=0;i<_form.elements.length;i++) { _elm = _form.elements[i]; switch(_elm.type) { case 'submit' : break; case 'checkbox' : case 'radio' : { if(_elm.checked == true) _responseBody += '&'+ encodeURIComponent(_elm.name)+'='+encodeURIComponent(_elm.value); break; } default : { _responseBody += '&'+ encodeURIComponent(_elm.name)+'='+encodeURIComponent(_elm.value); break; } } } return _responseBody; } window.onload = function() { if (typeof(pngFix) == 'function') { pngFix(); } if (typeof(initLightbox) == 'function') { initLightbox(); } window.setInterval("KeepAlive()", 300000); } function KeepAlive() { try { PageMethods.KeepAlive(function(response){}); } catch(e) { } } function AddToBasket(id) { if (!allowShop()) return false; var _formdata = (arguments[1]) ? getFormData(document.forms[0].id) : null; var _optiondata = (typeof(arguments[2]) != 'undefined') ? 'option=' + arguments[2] : null; var _arguments = (_optiondata != null) ? _optiondata : (_formdata != null) ? _formdata : null; PageMethods.AddToBasket(id, _arguments, _formdata != null, function(response) { if (response < 0) { if (confirm('Dit product is reeds aanwezig in uw winkelmandje. Wilt u dit product nog een keer toevoegen?')) { PageMethods.AddToBasket(id, _arguments, true, function(response) { window.location.href = './Webshop.aspx'; }); } } else { window.location.href = './Webshop.aspx'; } }); return false; } function changeOption(sUrl, oObj) { try { if (typeof(sUrl) != 'undefined' && typeof(oObj) != 'undefined' && typeof(oObj.value) != 'undefined' && !isNaN(parseInt(oObj.value))) { window.location.href = sUrl + '&option=' + oObj.value; } } catch(e) { } } function allowShop() { if (checkCookies()) { return true; } else { alert('Om gebruik te kunnen maken van deze webwinkel is het vereist dat uw browser cookies accepteert.'); return false; } } var _submitButtonClicked = false; function clickSubmitButton() { if (_submitButtonClicked) { return false; } else if (checkTerms()) { _submitButtonClicked = true; MoveToTop(); return true; } else { return false; } } function checkTerms() { if (!allowShop()) return false; var obj = findObject('terms'); if (obj != null && obj.checked) { return true; } else if (obj != null) { alert('U kunt de bestelling niet accorderen als u niet akkoord gaat met de algemene verkoopvoorwaarden'); return false; } return false; } function MoveToTop() { window.scroll(0,0); }