PageSourceSearch

https://www.garden-lights-kopen.nl/views/library/lib_myshop.1.83.js

js garden-lights-kopen.nl collected 2026-10-06 06:08:15 UTC 52,135 bytes, 2,048 lines download raw bytes

1/**
2 * @(#)/views/library/lib_myshop.js
3 *
4 * Copyright 2000-2024(c) mijnWinkel B.V.
5 *
6 * Version 1.82
7 */
8
9function __onLoadPage(){}
10function w(s){document.write(s);}
11function hasMenu(s){return false;}
12
13
14function _i(v){return(v==null)?0:parseInt(v,10);}
15function getElementOnId(n,d){
16	var ref;
17	if(d==null)d=document;
18	if(d.layer)ref=layer[n];
19	else if(d.all==null)ref=d.getElementById(n);
20	else ref=d.all[n];
21	return ref;
22}
23function showDeliveryFields(n,ctl){
24	var e=getElementOnId("delivery_fields");
25	if(e!=null)e.style.display=(n)?"":"none";
26	if(ctl){
27		e=_myshopEvent.events.MYSHOP_EVENT_ADDRESS_TYPE;
28		if(_myshop.exist(e))cont=_myshop.trigger(e,ctl.value);
29
30	}
31}
32
33function myshopLoadingImage(){
34	return "data:image/gif;base64,R0lGODlh1AAQANUEAAAAAAAAhISEhMbGxgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH/C05FVFNDQVBFMi4wAwEAAAAh+QQFwgE/ACwAAAAA1AAQAAAGpUCBcEgsGo/IpHLJbDqf0Kh0Sh0Crtisdsvter/gsHhMLpvP6D
34RAABi43/C4fE6v2+/4vH7P7/v/f2ttAwGFhgGAiYqLjI2Oj3iCboeGkJaXmJmafZKElIiboaKjpIFsk5+lqquspJ2foK2ys7SAr6m1ubq7cbeUvMDBsr6HwsbHocSVyMzNjcqFztLTnKeev9TZ2nOd297fcoJq4+Tl5ufo6WNBAAAh+QQFwgE/ACwNAAMABwALAAAGDcCAcEgsGo/IpHK5DAIAIfkEBcIBPwAsFgADAAcACwAABg3AgHBILBqPyKRyuQwCACH5BAXCAT8ALB8AAwAHAAsAAAYNwIBwSCwaj8ikcrkMAgAh+QQFwgE/ACwoAAMABwALAAAGDcCAcEgsGo/IpHK5DAIAIfkEBcIBPwAsMQADAAcACwAABg3AgHBILBqPyKRyuQwCACH5BAXCAT8ALDoAAwAHAAsAAAYNwIBwSCwaj8ikcrkMAgAh+QQFwgE/ACxDAAMABwALAAAGDcCAcEgsGo/IpHK5DAIAIfkEBcIBPwAsTAADAAcACwAABg3AgHBILBqPyKRyuQwCACH5BAXCAT8ALFUAAwAHAAsAAAYNwIBwSCwaj8ikcrkMAgAh+QQFwgE/ACxeAAMABwALAAAGDcCAcEgsGo/IpHK5DAIAIfkEBcIBPwAsZwADAAcACwAABg3AgHBILBqPyKRyuQwCACH5BAXCAT8ALHAAAwAHAAsAAAYNwIBwSCwaj8ikcrkMAgAh+QQFwgE/ACx5AAMABwALAAAGDcCAcEgsGo/IpHK5DAIAIfkEBcIBPwAsggADAAcACwAABg3AgHBILBqPyKRyuQwCACH5BAXCAT8ALIsAAwAHAAsAAAYNwIBwSCwaj8ikcrkMAgAh+QQFwgE/ACyUAAMABwALAAAGDcCAcEgsGo/IpHK5DAIAIfkEBcIBPwAsnQADAAcACwAABg3AgHBILBqPyKRyuQwCACH5BAXCAT8ALKYAAwAHAAsAAAYNwIBwSCwaj8ikcrkMAgAh+QQFwgE/ACyvAAMABwALAAAGDcCAcEgsGo/IpHK5DAIAIfkEBcIBPwAsuAADAAcACwAABg3AgHBILBqPyKRyuQwCACH5BAXCAT8ALMEAAwAHAAsAAAYNwIBwSCwaj8ikcrkMAgAh+QQFwgE/ACzKAAMABwALAAAGDcCAcEgsGo/IpHK5DAIAOw==";
35}
36
37
38function MyShopRemoveHTMLTags(htmlString){
39    if(htmlString){
40        var mydiv = document.createElement("div");
41        mydiv.innerHTML = htmlString;
42        if (document.all){return unescape(mydiv.innerText);}
43        else{return unescape(mydiv.textContent);}
44    }
45}
46
47function MyShopState(){
48	var me=this,events=[],check=[],lock=false,list=[],r=[];
49
50	me.register=function(name,f){
51		if(events[name])events[name].push(f);
52		else events[name]=[f];
53		check[name]=true;
54	};
55	me.trigger=function(name,value){
56		var r=true,i;
57		if(events[name])for(i in events[name]){
58			if(!isNaN(i))r=events[name][i](value);
59		}
60		return r;
61	};
62	me.exist=function(name){
63		return check[name];
64	};
65	me.clear=function(name){
66		events[name]=null;
67		check[name]=false;
68	};
69
70	me.lock=function(){
71		lock=true;
72	};
73
74	me.locked=function(){
75		return lock;
76	};
77
78	me.set=function(k,v){
79		list[k]=v;
80	};
81
82	me.get=function(k,d){
83		var v=list[k];
84		return(null==v)?d:v;
85	};
86
87	me.setR=function(sk,v){r[sk]=v;};
88	me.getR=function(s,k){
89		if(-1!=(""+k).indexOf("::"))return r[k];
90		
91		return r[s+"::"+k];
92	};
93	me.sizeR=r.length;
94
95	me.doProceed=function(){
96		log("proceed is "+_proceed);
97		return _proceed;
98	};
99
100	var _proceed=false,_proceedLock=false;
101	me.proceed=function(mode){
102		if(!(typeof mode === 'undefined' || mode === null))_proceed=mode;
103
104		log("register proceed, mode "+mode);
105
106		return true;
107	};
108}
109var _myshop=new MyShopState(),_myshop_version="1.40",_myshop_popup=null,_myshop_event_block=-1,_myshop_event_block2=-1,_myshop_help,_myshop_part=-1,_myshop_plugin=[];
110
111function MyShopEvent(){
112	var me=this,pageLoaded=(new Date()).getTime(),_popup=null;
113	me.events={
114		"MYSHOP_EVENT_NEXT":"on_next",
115		"MYSHOP_EVENT_PREVIOUS":"on_previous",
116		"MYSHOP_EVENT_BACK":"on_back",
117		"MYSHOP_EVENT_GLOBALSEARCH":"on_globalsearch",
118		"MYSHOP_EVENT_ADDRESS_TYPE":"on_address_type",
119		"MYSHOP_EVENT_ON_NOTIFY":"on_notify",
120		"MYSHOP_EVENT_ORDER":"on_order",
121		"MYSHOP_EVENT_AFTER_ORDER":"on_afterorder",
122		"MYSHOP_EVENT_PREORDER":"on_preorder",
123		"MYSHOP_EVENT_UPDATE":"on_update"
124	};
125
126	function register(n,f){
127		if(n&&f)for(var k in me.events)if(me.events[k]==n){
128			log("register "+n);
129			_myshop.register(n,f);
130			break;
131		}
132	}
133
134	me.on=function(n,f){
135		register(("on_"+n).toLowerCase(),f);
136	};
137
138	me.onNext=function(f){register(me.events.MYSHOP_EVENT_NEXT,f);};
139	me.onPrevious=function(f){register(me.events.MYSHOP_EVENT_PREVIOUS,f);};
140	me.onBack=function(f){register(me.events.MYSHOP_EVENT_BACK,f);};
141	me.onSearch=function(f){register(me.events.MYSHOP_EVENT_GLOBALSEARCH,f);};
142	me.onAddressType=function(f){register(me.events.MYSHOP_EVENT_ADDRESS_TYPE,f);};
143	me.onNotify=function(f){register(me.events.MYSHOP_EVENT_ON_NOTIFY,f);};
144	me.onOrder=function(f){register(me.events.MYSHOP_EVENT_ORDER,f);};
145	me.onPreOrder=function(f){register(me.events.MYSHOP_EVENT_PREORDER,f);};
146	me.onAfterOrder=function(f){register(me.events.MYSHOP_EVENT_AFTER_ORDER,f);};
147	me.onUpdate=function(f){register(me.events.MYSHOP_EVENT_UPDATE,f);};
148
149	me.callbackRedirect=function(doc){
150		var l="";
151		if(doc){
152			var location=doc.getElementsByTagName('location');
153			if(location)l=location[0].childNodes[0].nodeValue;
154		}
155		if(l!="")window.location=l;
156	};
157
158	me.notify=function(){
159		var now=(new Date()).getTime(),periode=1000*60*60*2;
160		if((now-pageLoaded)>periode)myshop().expired(me.callbackRedirect);
161		else myshop().notify(me.callbackNotify);
162	};
163
164	me.callbackNotify=function(doc){
165		var ne=_myshopEvent.events.MYSHOP_EVENT_ON_NOTIFY;
166		if(_myshop.exist(ne))cont=_myshop.trigger(ne);
167	};
168
169	setInterval(me.notify,1000*60*4);
170
171	me.clearLock=function(){
172		_myshop.clear("lock_next");
173	};
174
175	me.proceed=function(mode){
176		return _myshop.proceed(mode);
177	};
178
179
180	me.home=function(){
181		myshop().expired(me.callbackRedirect);
182	};
183
184	me.popupCheckout=function(target,h,w){
185		if(_popup==null){
186			_popup=window.open("",target,'location=0,directories=0,toolbar=no,resizable=no,status=no,scrollbars=0,menubar=no,width='+w+',height='+h+',left='+((screen.width-w)*0.5)+',top='+((screen.height-h)*0.4));
187			var doc=_popup.document;
188			doc.open("text/html","replace");
189			doc.write('<html><body><center><br/><img style="myshp_button" border="0" src="'+myshopLoadingImage()+'" alt="Loading, one moment please..."/><br/></center></body></html>');
190			doc.close();
191			setInterval(me.home,1000*60*10);
192		}
193		if(_popup)_popup.focus();
194	};
195
196
197	me.callbackResource=function(doc){
198		var txt="";
199		if(doc){
200			var t=doc.getElementsByTagName('resource');
201			if(t)txt=t[0].childNodes[0].nodeValue;
202		}
203		me.text=txt;
204	};
205	me.text="";
206
207
208}
209var _myshopEvent=new MyShopEvent(),_myshopJq,_myshopRelease=3,_myshopG=false;
210
211
212function myshopEvent(){
213	return _myshopEvent;
214}
215
216var _myshopConsoleLogState=true;
217function myshopConsole(s){
218	if(_myshopConsoleLogState){
219		var f=document.forms["data"],ctl;
220		if(f)ctl=f["myshp-log"];
221		if(ctl&&"1"==ctl.value)try{if(self.console)console.log(s);}catch(e){}
222		else _myshopConsoleLogState=false;
223	}
224}
225
226function MyShop(){
227	var POPUP_NAME="myshoporderpopup";
228	var me=this,_location=null,_target=null,_width="440",_height="280",_quantity=null,_formName="data",_leave=false;
229	var _hasQuery=false,_onload=null,_validated=false,_scrollPos=false,_clearSelection=false;
230	var MAX_SEARCH_FIELD=30;
231	me.version=3;
232	me.valid=true;
233
234	function i(v){return(v==null)?0:parseInt(v,10);}
235
236	function clearSelection(id){
237		var c,index,last,selection="";
238		if(!isNaN(id)){
239			last=i(id);
240			index=last+1;
241			while(index<MAX_SEARCH_FIELD){
242				c=getElementOnId("myshp_search_field_"+index);
243				if(c){
244					if(c.value)c.value="";
245				}else break;
246				c=getElementOnId("myshp_search_field_max_"+index);
247				if(c&&c.value)c.value="";
248				index++;
249			}
250			selection=getSelection(last);
251		}
252		index=0;
253		while(index<MAX_SEARCH_FIELD){
254			c=getElementOnId("myshp_search_field_menu_"+index);
255			if(c)c.value="";
256			else break;
257			index++;
258		}
259		var f=getData(),t;
260		if(f)for(index=f.length-1;index>=0;index--){
261			c=f[index];
262			t=""+c.type;
263			if(t.toLowerCase().indexOf("select")!=-1&&c.name.indexOf("index:")==0)
264				c.selectedIndex=-1;
265		}
266		return selection;
267	}
268	function enc(s){
269		return encodeURIComponent(decodeURIComponent(s));
270	}
271
272	function getSelection(last){
273		var index=0,c,selection="",sep="";
274		for(;index<=last;index++){
275			c=getElementOnId("myshp_search_field_"+index);
276			if(c&&c.value){
277				selection+=sep;
278				selection+=enc(c.name)+"="+enc(c.value);
279				sep="&";
280			}
281			c=getElementOnId("myshp_search_field_max_"+index);
282			if(c&&c.value){
283				selection+=sep;
284				selection+=enc(c.name)+"="+enc(c.value);
285				sep="&";
286			}
287		}
288		var f=getData();
289		if(f){
290			c=f["_globalsearch"];
291			if(c&&c.value!='')selection+=sep+"_globalsearch="+enc(c.value);
292		}
293		if(selection!=""&&f["m"])f["m"].value="0";
294
295		return selection;
296	}
297
298	function showMessage(s){
299		var bodyId=document.getElementsByTagName("body")[0];
300		if(bodyId){
301
302			var msg=document.createElement('div');
303			msg.setAttribute('class', 'myshp_message myshp_upload');
304			var l=(getDocumentWidth()-300)*0.5,t=(screen.height-80)*0.3;
305			msg.setAttribute('style', 'background-color:yellow;position:absolute;top:'+t+'px;left:'+l+'px;width:300px;height:80px;text-align:center;border:3px black solid;');
306			msg.appendChild(document.createElement('br'));
307			msg.appendChild(document.createTextNode(s));
308			msg.appendChild(document.createElement('br'));
309			msg.appendChild(document.createElement('br'));
310			var img=document.createElement('img');
311			img.setAttribute('src', myshopLoadingImage());
312			img.setAttribute('style', 'width:212px;height:16;');
313			msg.appendChild(img);
314			bodyId.appendChild(msg);
315		}
316	}
317
318	function getDocumentWidth(){
319		var e=document.documentElement;
320		return(e&&e.offsetWidth&&e.offsetWidth>0)?e.offsetWidth:document.body.offsetWidth;
321	}
322
323	function endsWith(s,n){
324		var i=0,ret=false;
325		if(s){
326			i=s.length-1;
327			ret=(s.indexOf(n)==i);
328		}
329		return ret;
330	}
331	function trim(v){
332		if(v==null)v='';
333		else v=''+v;
334		return(v=='')?v:v.replace(/^\s+|\s+$|&nbsp;|&#160;/gi,'');
335	}
336	function encode(v,from,to){
337		if(v==null)v='';
338		else v=''+v;
339		return(v=='')?v:v.replace(new RegExp(from,"g"),to);
340	}
341	function getData(frm){
342		var f=document.forms[_formName];
343		log(f+" name"+_formName+" caller"+_caller);
344		if(!f&&frm)f=document.forms[frm];
345		if(!f&&_caller){
346			log("use caller"+_caller.form);
347			f=_caller.form;
348		}
349		log(f);
350		return f;
351	}
352
353	me.data=getData;
354
355	me.reload=function(){
356		_leave=true;
357		var f=getData();
358		if(f){
359			f.action=(_location)?_location:f["this"].value;
360			f.target="_self";
361			f.submit();
362		}
363		else window.location.reload();
364	};
365
366	me.help=function(shopId,lang,title){
367		if(_myshop_help)try{
368			_myshop_help.close();
369		}catch(e){}
370		if(!lang)lang="nl";
371		_myshop_help=window.open('http://www.mijnwinkel.nl/help/frame.html?page=hkassa_'+lang+'.html&language='+lang+'&_vid='+shopId,title,"height=450px,width=400px,left=10px,top=10px",true);
372	};
373
374	me.focus=function(c){
375		try{
376			if((typeof c != "undefined")){
377				if((typeof c) == "string")c=getData()[c];
378				if(c)c.focus();
379			}
380		}catch(e){}
381	};
382
383	function getQuantity(){
384		var q=1,f=getData(),ctl;
385		if(f){
386			ctl=f[get("i")+".quantity"];
387			if(ctl)q=ctl.value;
388		}
389		return q;
390	}
391
392	function isValid(a,id){
393		var oke=true,f=getData();
394		if(f&&("add"==a||(_myshopRelease==3&&_caller&&"change_update"==a))&&!_validated&&id){
395			_validated=true;
396			var q=f[get("i")+".quantity"];
397			oke=me.validate(id,((q)?q.value:"1")).valid;
398			if(!oke){
399				_location=null;
400				cont=false;
401				me.focus(q);
402			}
403		}
404		return oke;
405	}
406
407	function hasOrderFields(){
408		var n=0,oke=false,f=getData(),index=get("i");
409		if(f){
410			for(;n<20;n++){
411				oke=f["text"+n]||f[index+"text"+n];
412				if(oke)break;
413			}
414		}
415		return oke||hasOrderUploadFields();
416	}
417
418	function hasOrderUploadFields(){
419		var n=0,oke=false,f=getData(),index=get("i");
420		if(f){
421			for(;n<20;n++){
422				oke=f["upload"+n]||f[index+"upload"+n];
423				if(oke)break;
424			}
425		}
426		return oke;
427	}
428
429
430	var _caller=null;
431	me.caller=function(call){
432		// arguments.callee.caller.toString()
433		if(call)log("active:"+call.form+" parent");
434		_caller=call;
435		return me;
436	};
437
438	var _event;
439
440
441	me.c=function(call){
442		var e = window.event;
443		_event = (e)? e.target || e.srcElement: null;
444	    if (_event && _event.nodeType == 3) _event = _event.parentNode;
445
446		// arguments.callee.caller.toString()
447		if(_event)log("1active:"+_event.form);
448		_caller=call;
449		return me;
450	};
451
452
453	me.sp=function(e){
454		if(!e)e=window.event;
455		e.cancelBubble=true;
456		if(e.stopPropagation)e.stopPropagation();
457		return me;
458	};
459
460	me.ssp=function(){
461		_scrollPos=true;
462		return me;
463	};
464
465	me.cs=function(e){
466		_clearSelection=true;
467		me.sp(e);
468		return me;
469	};
470
471
472	me.action=function(a,id,next){
473		if(_myshop.locked())return false;
474
475		_leave=true;
476		var f=getData(),useLocation=false,selection="",aa,thisUri=true,multiPart=false;
477		var useLoadDoc=false;
478		log("action:"+a+" form:"+f);
479
480		if(!f&&("allow-tracking"==a||"hide-tracking-message"==a)){
481			var l=""+document.location;
482			if(l){
483				var sep='?',i=l.indexOf("#"),b="";
484				if(i!=-1){
485					b=l.substring(i);
486					l=l.substring(0,i);
487				}
488				if(l.indexOf("?")!=-1)sep=(l.charAt(l.length-1)=='?'||l.charAt(l.length-1)=='&')?'':'&';
489				l+=sep;
490				l+="a="+a;
491				window.location=l+b;
492			}
493		}
494		else if(f&&a){
495			log("process action:"+a+" form:"+f+" action field:"+f["a"]);
496
497			aa=f.action;
498
499			var delay=false,cont=true;
500
501			if('[object RadioNodeList]' == f["a"]){
502				f["a"][0].value=a;
503				log("node list set:"+f["a"][0].value);
504			}
505			else if(f["a"])f["a"].value=a;
506
507
508			log("set action:"+f["a"].value);
509
510			if(!("change"==a||"remove"==a||"start_add"==a||"add"==a||"add-related"==a||"add-related-basket"==a)){
511				f.target="_self";
512				if(_myshop_popup){
513					try{
514						_myshop_popup.close();
515					}catch(e){}
516					_myshop_popup=null;
517				}
518			}
519
520
521			if("orderdirect"==a){
522				if(_quantity!=null)id=_quantity;
523
524				if(id){
525					if(isNaN(id))id=id.value;
526					_location+="&quantity="+encodeURIComponent(id);
527					id="";
528				}
529				f.action=_location;
530				f.method="post";
531			}
532			else if("add-order"==a){
533				if(f["id"])f["id"].value=id;
534				f.action=_location;
535				f.method="post";
536			}
537
538			else if("favorite-add"==a||"favorite-remove"==a||"favorite-clear"==a||"allow-tracking"==a||"hide-tracking-message"==a){
539				if(f["id"])f["id"].value=id;
540				saveScrollPos(f);
541				f.method="post";
542
543				if(_location)f.action=_location;
544				else if(_myshop_part!="1"){
545					var l=f["this"].value;
546					if(l)f.action=l;
547				}
548				log("using location:"+f.action);
549
550			}
551			else if("change_update"==a||"change"==a||"remove"==a||"start-register"==a||"start_add"==a||"add"==a||"add-related"==a||"add-related-basket"==a){
552				var checkId=id;
553				if("change_update"==a){
554					saveScrollPos(f);
555					if(f["id"])f["id"].value=id;
556					if(f["product_id"])checkId=f["product_id"].value;
557				}
558
559				if(isValid(a,checkId)){
560					if(_location)f.action=_location+((endsWith(_location,"?"))?"":"&")+"jid="+(new Date()).getTime();
561					f.method="post";
562					if("start_add"==a)f["a"].value="";
563					multiPart=("add"==a&&hasOrderUploadFields());
564
565				}else cont=clear();
566
567			}
568			else if("continue_shopping"==a){
569				useLocation=true;
570				if(_myshopRelease==3)f.method="post";
571				else f.method="get";
572				/* clear the catalog id the URL should specify the catalog */
573				var ctl=f["cid"];
574				if(ctl)ctl.value="";
575				f.action=_location;
576				if(_target)f.target=_target;
577			}
578			else if("cancel"==a){
579				cont=false;
580				try{
581					window.close();
582				}catch(e){};
583			}
584			else if("change_update"==a){
585				if(f["id"])f["id"].value=id;
586			}
587			else if("select_shipping"==a){
588				f.action=f["this"].value;
589				delay=false;
590			}
591			else if("selection"==a){
592				_myshop.lock();
593				f.method="post";
594				if(f["id"]&&_caller)f["id"].value=decodeURIComponent(_caller.name);
595				if(_myshop_part==5&&f["this"])f.action=f["this"].value;
596				saveScrollPos(f);
597
598				if(me.pageId().oke)f.action=_myshop_plugin["myshop-action"];
599			}
600			else if("show_error"==a){
601				cont=false;
602				if(self.myshopShowError)myshopShowError();
603			}
604			else if("search"==a){
605				// reset search action
606				if(f["p"])f["p"].value="0";
607				if(f['myshp_input_search'])f["_globalsearch"].value=f["myshp_input_search"].value;
608				f.method="post";
609				thisUri=false;
610
611				if(("1"==get("range","0"))){
612					/* clear the action to keep the active menu selection */
613					if(f["a"])f["a"].value="";
614					selection=getSelection(MAX_SEARCH_FIELD);
615				}
616				else{
617					if(f["this"])f.action=f["this"].value;
618					selection=clearSelection(0);
619				}
620			}
621			else if("globalsearch"==a){
622				var search=_myshopEvent.events.MYSHOP_EVENT_GLOBALSEARCH;
623				if(_myshop.exist(search))cont=_myshop.trigger(search);
624				if(cont){
625					if(f["p"])f["p"].value=0;
626					f.method="post";
627					thisUri=false;
628					f.action=f["this"].value;
629					if(id)f["_globalsearch"].value="";
630					else if(f["myshp_search_field_globalsearch"])f["_globalsearch"].value=f["myshp_search_field_globalsearch"].value;
631
632					clearSelection(id);
633					selection=getSelection(MAX_SEARCH_FIELD);
634				}
635			}
636			else if("prev"==a){
637				var prev=_myshopEvent.events.MYSHOP_EVENT_PREVIOUS;
638				if(_myshop.exist(prev))cont=_myshop.trigger(prev);
639
640				if(cont){
641					clear();
642					if(_location)f.action=_location;
643					var l=""+f.action;
644					useLoadDoc=l.indexOf("basket")!=-1;
645					if(useLoadDoc){
646						var sid=f["list_ie_sid"].value,start=l.indexOf("?");
647						if(sid){
648							if(start!=-1)l=l.substring(0,start-1)+";jsessionid="+sid+l.substring(start);
649							else l=l+";jsessionid="+sid;
650							f.action=l;
651						}
652					}
653					f.method="post";
654				}
655			}
656			else if("back"==a){
657				var back=_myshopEvent.events.MYSHOP_EVENT_BACK;
658				if(_myshop.exist(back))cont=_myshop.trigger(back);
659				if(cont){
660					f.method="post";
661					if(_location)f.action=_location;
662				}
663			}
664			else if("save-user-info"==a){
665				var update=_myshopEvent.events.MYSHOP_EVENT_UPDATE;
666				if(_myshop.exist(update))cont=_myshop.trigger(update);
667			}
668			else if("previous"==a){
669				var prev=_myshopEvent.events.MYSHOP_EVENT_PREVIOUS;
670				if(_myshop.exist(prev))cont=_myshop.trigger(prev);
671
672				if(cont){
673					if(f["p"])f["p"].value=get("p");
674					f.method="post";
675					if(_location)f.action=_location;
676					selection=getSelection(MAX_SEARCH_FIELD);
677				}
678			}
679			else if("goto"==a||"change_moreinfo_update"==a){
680				if(_scrollPos)saveScrollPos(f);
681				clear();
682				thisUri=false;
683				if(f["p"])f["p"].value=get("p");
684				if(f["id"])f["id"].value=id;
685				f.method="post";
686				selection=getSelection(MAX_SEARCH_FIELD);
687				if(_location)f.action=_location;
688
689			}
690			else if(a.indexOf("plugin-")==0){
691				if(_scrollPos)saveScrollPos(f);
692				f.method="post";
693			}
694			else if(a.indexOf("update-selection")==0){
695				if(f["id"])f["id"].value=id;
696				saveScrollPos(f);
697				f.method="post";
698			}
699
700			else if("menu_filter"==a){
701				selection=getSelection(MAX_SEARCH_FIELD);
702				if(_scrollPos)saveScrollPos(f);
703				f.method="post";
704				f.action=f["this"].value;
705			}
706
707			if("next"==a){
708				if(self.PostNL_OP_Checkout&&"plugin-checkout-postnl_checkout"==id){
709					cont=false;
710					if(me.token().oke){
711						preLoad(_myshop_plugin["postnl-location"]);
712						PostNL_OP_Checkout.showCheckout(_myshop_plugin["postnl-token"]);
713					}
714				}
715				else{
716
717					if(self._myshop){
718						if(_myshop.exist("lock_next")){
719							_myshop.trigger("lock_next");
720							cont=false;
721						}
722						else {
723							_myshop.register("lock_next", function(){
724								alert("Processing, one moment please ...");
725								return false;
726							});
727						}
728					}
729
730log("Step 3");
731					if ("plugin-checkout-paypal_express_checkout"==id){
732						if(window.parent!=self){
733							try{
734								var h=height(),w=width(),bdy=document.body;
735								bdy.appendChild(make("div","myshp_overlay",null,null,null,"background-color: #000;opacity: .7;filter: alpha(opacity=70);position: absolute; top: 0; left: 0;width: 100%; height: "+h+"px;z-index: 10;"));
736
737								_target="myshoporderpopup";
738								myshopEvent().popupCheckout(_target,h,w);
739
740								bdy.appendChild(makeButton(h*.25,w));
741								bdy.appendChild(makeButton(h*.5,w));
742								bdy.appendChild(makeButton(h*.75,w));
743							}
744							catch(err){}
745						}
746					}
747
748
749					if(cont){
750						clear();
751						var nxt=_myshopEvent.events.MYSHOP_EVENT_NEXT;
752						if(_myshop.exist(nxt))cont=_myshop.trigger(nxt);
753
754						if(cont){
755							if(f["p"])f["p"].value=get("p");
756
757							f.method="post";
758							if(_clearSelection)clearSelection(0);
759							else selection=getSelection(MAX_SEARCH_FIELD);
760							if(_location)f.action=_location;
761
762							if(f["cmd"]&&'direct'==f["cmd"].value){
763								if(self._myshop)cont=_myshop.trigger("on_next_page");
764							}
765							else if(f["coupon_n"]&&f["coupon_n_current"]&&trim(f["coupon_n"].value)!=""&&f["coupon_n"].value!=f["coupon_n_current"].value){
766								if(f["a"])f["a"].value="coupon_n";
767								f.action=f["this"].value;
768							}
769							else if(f["voucher"]&&f["voucher_current"]&&f["voucher"].value!=f["voucher_current"].value){
770								if(f["a"])f["a"].value="voucher";
771								f.action=f["this"].value;
772							}
773							else{
774								if(self._myshop)cont=_myshop.trigger("on_next_page");
775							}
776
777							if(6==_myshop_part){
778								for(var i=f.length-1;i>=0;i--){
779									var c=f[i],t=""+c.type;
780									if(t.toLowerCase().indexOf("checkbox")!=-1&&c.name.indexOf("b_")==0&&''!=c.value){
781										if(!c.checked)c.value="";
782									}
783								}
784							}
785						}
786					}
787				}
788			}
789			log("Step 2 "+cont);
790			if(cont){
791
792				if(id&&f["id"])f["id"].value=decodeURIComponent(id);
793				if(next&&f["next"])f["next"].value=next;
794
795				if(multiPart){
796					f.encoding='multipart/form-data';
797					f.action+=((endsWith(f.action,"?"))?"":"&")+(new Remote()).fields(f,"this","url_rpc").getQueryString();
798					showMessage("  Loading documents, one moment please ...");
799					// alert(f.action);
800				}
801
802
803				if(_myshop_popup){
804					f.target=POPUP_NAME;
805					_target=POPUP_NAME;
806					try{_myshop_popup.focus();}catch(e){};
807				}
808				else if(_target)f.target=_target;
809				else f.target="_self";
810
811				var done=false;
812				if(useLoadDoc||(_hasQuery&&useLocation&&(!_target))){
813					window.location=f.action;
814					done=true;
815				}
816				else if(_hasQuery)f.method="post";
817
818				if(selection!=""){
819					if(thisUri)f.action="?"+selection;
820					else{
821						var start=f.action.indexOf("?");
822
823						if(start!=-1){
824							var qs=new QueryString("?"+selection),qsAction=new QueryString(f.action.substring(start));
825							for(var n=0;n<qsAction.keys.length;n++){
826								var key=qsAction.keys[n];
827								if(!qs.exist(key))qs.set(key,qsAction.get(key));
828							}
829							var s=qs.getQueryString();
830							if(endsWith(s,"&"))s=s.substring(0,s.length-1);
831							f.action=f.action.substring(0,start+1)+encode(s,"%3A",":");
832						}
833						else{
834							f.action=f.action+"?"+selection;
835						}
836
837					}
838				}
839				log("Step 1");
840				if(!done){
841
842					if(_myshopG)f.method="get";
843
844					if("add"==a||"add-related"==a||"add-related-basket"==a){
845						var e=_myshopEvent.events.MYSHOP_EVENT_ORDER,orderDone=false;
846						if(_myshop.exist(e)){
847							me.order(id,getQuantity(),true);
848							orderDone=true;
849							done=true;
850							_myshop.trigger(e);
851							if(_myshop.doProceed())done=false;
852						}
853						else{
854							var e=_myshopEvent.events.MYSHOP_EVENT_PREORDER;
855							if(_myshop.exist(e)){
856								var next=_myshop.trigger(e);
857								log("Next action from trigger "+next);
858								if(0==next)done=true;
859								else{
860									me.order(id,getQuantity(),true);
861									orderDone=true;
862									if(1==next)done=true;
863								}
864							}
865						}
866						if(orderDone&&!done){
867							f.action="/checkout/basket1";
868						}
869					}
870
871					if(!done){
872
873						if(delay)window.setTimeout("myshop().submitPage();",10);
874						else f.submit();
875					}
876				}
877			}
878
879			f.action=aa;
880		}
881		return false;
882	};
883	me.a=me.action;
884
885	function val(f,i){
886		var v=f[i].value;
887		if(v!=null&&v!="")v=v.replace("+","%2b");
888		return v;
889	}
890	function preLoad(l){
891		var ctl=getElementOnId("myshop_ie_preload");
892		if(!ctl){
893			var bodyId=document.getElementsByTagName("body")[0];
894			if(bodyId){
895				var f=getData(),i=0,q=new QueryString(),l;
896				if(f){
897					l=f.length;
898					for(;i<l;i++)q.set(f[i].name,val(f,i));
899					var frm=document.createElement('iframe');
900					frm.setAttribute('id', 'myshop_ie_preload');
901					frm.setAttribute('style', 'display:none;height:0');
902					frm.setAttribute('src', f.action+q.getQueryString());
903					bodyId.appendChild(frm);
904				}
905			}
906		}
907	}
908
909	function endsWith(s,chr){
910		return(s&&s!="")?s.lastIndexOf(chr)==(s.length-1):false;
911	}
912
913	function pluginSuccessCallback(){
914		if(_myshop_plugin["postnl-location"])
915			window.location=_myshop_plugin["postnl-location"];
916	}
917
918	function height(){
919		return (window.$)?Math.max(
920		        $(document).height(),
921		        $(window).height(),
922		        document.documentElement.clientHeight
923		    ):600;
924	}
925	function width(){
926		return (window.$)?Math.max($(document).width(),
927		        $(window).width(),
928		        document.documentElement.clientWidth
929		    ):800;
930	}
931
932	function makeButton(h,w){
933		return make("input","myshp_button myshp_overlay","button","  home  ","myshopEvent().home();","cursor:pointer;position: absolute;width:100px; top: "+(h)+"px; left:"+(w*.5-50)+"px;z-index: 11;");
934	}
935	function make(el,cl,type,val,click,style){
936		var o=document.createElement(el);
937		   if(cl)o.setAttribute("class", cl);
938		   if(type)o.setAttribute("type",type);
939		   if(val)o.setAttribute("value",val);
940		   if(click)o.setAttribute("onclick",click);
941		   if(style)o.setAttribute("style",style);
942		   return o;
943	}
944
945
946	function pluginCancelCallback(){}
947	function pluginCloseCallback(){}
948
949	function saveScrollPos(f){
950		if(f&&f["xy"]){
951			var xy="";
952			try{
953				if(document.all){
954					if(document.documentElement)xy=document.documentElement.scrollLeft+';'+document.documentElement.scrollTop;
955					else xy=document.body.scrollLeft+';'+document.body.scrollTop;
956				}
957				else xy=window.pageXOffset+';'+(window.pageYOffset);
958			}
959			catch(e){};
960			f["xy"].value=xy;
961		}
962	}
963
964	function clear(){
965		if(_caller&&_caller.href)_caller.href="javascript:void(0);";
966		return false;
967	}
968
969	me.open=function(){
970		clear();
971		window.open(_location,'_self');
972		return false;
973	};
974
975	me.submitPage=function(action,method){
976		_leave=true;
977		var f=getData();
978		if(f){
979			if(trim(action)!='')f.action=action;
980			if(method){
981				method=trim(method).toLowerCase();
982				if(method=="get")f.method="get";
983				else if(method=="post")f.method="post";
984			}
985			f.submit();
986		}
987	};
988
989	me.POST=function(){
990		var f=getData();
991		if(f)f.method="post";
992		return me;
993	};
994	me.GET=function(){
995		var f=getData();
996		if(f)f.method="get";
997		return me;
998	};
999
1000	me.r=function(v,g){
1001		_myshopRelease=v;
1002		_myshopG=(g)?true:false;
1003		return me;
1004	};
1005
1006	me.bind=function(zip,country){
1007		if("6"==_myshop_part){
1008			(function() {
1009
1010				_myshop.set("__myshp_33",$("[name='b_33']").val());
1011
1012				if(window.$){
1013					$("input[name='mshp_shipping']").on('click',function(){
1014						myshop().c(this).a('update-selection');
1015					});
1016					if("1"==country){
1017						log("bind country");
1018						$("[name='b_18']").on('change',function(){
1019							log("selection:"+$("[name='deliveryaddress']:checked").val());
1020							if(1!=$("[name='deliveryaddress']:checked").val()){
1021								log("country active");
1022								myshop().c(this).a('update-selection','b_18');
1023							}
1024						});
1025						$("[name='d_118']").on('change',function(){
1026							myshop().c(this).a('update-selection','d_118');
1027						});
1028
1029						$("[name='b_33']").on("blur",function(){
1030							var v=$(this).val();
1031							if(v!=_myshop.get("__myshp_33")){
1032								_myshop.set("__myshp_33",v);
1033								myshop().c(this).a('update-selection','b_33');
1034							}
1035						});
1036					}
1037					if("1"==zip){
1038						log("bind zip code");
1039						$("[name='b_6']").on('change', function(){
1040							if(1!=$("[name='deliveryaddress']:checked").val())myshop().c(this).a('update-selection','b_6');
1041						});
1042						$("[name='d_106']").on('change', function(){
1043							myshop().c(this).a('update-selection','d_106');
1044						});
1045					}
1046					$("[name='deliveryaddress']").on('change', function(){
1047						if(3==$(this).val())$("#delivery_fields").show();
1048						else myshop().c(this).a('update-selection');
1049					});
1050					$("[name='mshp_paymethod']").on('change', function(){
1051						myshop().c(this).a('update-selection');
1052					});
1053					$('*[id^="mypcl-home-"]').on('change', function(){
1054						myshop().c(this).a('update-selection');
1055					});
1056					$('*[id^="mypcl-deliver-"]:radio').on('change', function(){
1057						myshop().c(this).a('update-selection');
1058					});
1059
1060				}
1061			})();
1062		}
1063		return me;
1064	};
1065
1066	me.showExtraImage=function(el,i,count){
1067		var e=getElementOnId("myshp_info_image_large_"+i),n;
1068		if(e){
1069			e.style.display="";
1070			for(n=count;n>0;n--){
1071				if(n!=i){
1072					e=getElementOnId("myshp_info_image_large_"+n);
1073					if(e)e.style.display="none";
1074				}
1075			}
1076			e=getElementOnId("myshp_info_image_large");
1077			if(e)e.style.display="none";
1078		}
1079		return false;
1080	};
1081	me.init=function(part,scroll){
1082		_myshop_part=part;
1083		var f=getData(),v;
1084		if(f){
1085			try{
1086				var i=0,l=f.length;
1087				for(;i<l;i++){
1088					var type=""+f[i].type;
1089					if(type.toLowerCase()=="textarea"){
1090						var s=""+f[i].value;
1091						s=trim(s);
1092						if(s.charAt(0)<32&&s.length<2)s="";
1093						f[i].value=s;
1094					}
1095				}
1096			}
1097			catch(e){}
1098		}
1099		if(self.myshopDynamicSizing)myshopDynamicSizing(part);
1100		if(scroll)me.scroll();
1101		var c=getElementOnId("myshp_basket_value_count_id");
1102		if(c){
1103			try{
1104				var wod=window.opener.document,cc;
1105				if(wod){
1106					cc=wod.getElementById("basket_value_count");
1107					if(cc)cc.innerHTML=c.innerHTML;
1108				}
1109			}catch(e){};
1110		}
1111
1112		if(1==part){
1113			try{
1114			_myshopJq=(window.$)?window.$:null;
1115			if(_myshopJq){
1116				_myshopJq(function(){
1117					var n,list=_myshopJq('a[class^=myshp_zoom]');
1118					if(list)for(n=list.length-1;n>=0;n--){
1119						if(_myshopJq(list[n]).jqzoom){
1120							_myshopJq(list[n]).jqzoom(((self.jqZoomOptions)?jqZoomOptions:{zoomType:'custom',zoomTypeWidth:90,zoomTypeHeight:90,zoomWidth:350,zoomHeight:350,title:false}));
1121						}
1122					}
1123				});
1124				_myshopJq(function(){
1125					var n,list=_myshopJq('a[class^=myshp_link]');
1126					if(list)for(n=list.length-1;n>=0;n--)_myshopJq(list[n]).lightBox(((self.jqLightBoxOptions)?jqLightBoxOptions:null));
1127				});
1128			}
1129			}catch(e){}
1130		}
1131
1132		if(self.PostNL_OP_Checkout)PostNL_OP_Checkout.initCheckout( pluginSuccessCallback, pluginCancelCallback,pluginCloseCallback,PostNL_OP_Checkout.environment_production);
1133
1134		if("setsid"==_myshop_part){
1135			window.addEventListener('load', function() {
1136				new Remote(true).request("setsid",function(){});
1137			});	
1138		}
1139		else if("5"==_myshop_part){
1140			window.addEventListener('load', function() {
1141	  			new Remote(true).request("sync",function(){});
1142			});
1143		}
1144
1145		if(hasElm("b")){
1146			var bodyId=document.getElementsByTagName("body")[0];
1147			if(bodyId){
1148				var frm=document.createElement('iframe');
1149				frm.setAttribute('style', 'display:none;height:0');
1150				frm.setAttribute('src', f["b"].value);
1151				bodyId.appendChild(frm);
1152			}
1153		}
1154		if(self.myshop_onready)myshop_onready(me);
1155
1156		const list=document.querySelectorAll('[data-action]');
1157		if(list){
1158			list.forEach(function(el) { 
1159				const tag=""+el.tagName;
1160				if("A"==tag||"BUTTON"==tag)el.addEventListener("click", function(event){
1161					event.stopPropagation();
1162  	     		});
1163	 		});
1164		}
1165
1166		return me;
1167	};
1168
1169	function hasElm(n){
1170		var f=getData();
1171		return f&&f[n]&&f[n].value;
1172	}
1173
1174	me.trigger=function(id){
1175		clear();
1176		if(!_myshopJq)_myshopJq=(window.$)?window.$:null;
1177		if(id&&_myshopJq){
1178			var item=getElementOnId(id);
1179			if(item)_myshopJq(item).trigger('click');
1180		}
1181		return me;
1182	}
1183
1184
1185	me.scroll=function(){
1186		var f=getData('myshp_form_sitemap');
1187
1188		if(f&&f['xy']){
1189			var l=f['xy'].value.split(';');
1190			if(l.length>1){
1191				addLoadEvent( function(){
1192					var f=getData('myshp_form_sitemap'),l=f['xy'].value.split(';');
1193					if(l.length>1)window.scrollTo(l[0],l[1])
1194					f['xy'].value="";
1195				});
1196			}
1197		}
1198		return me;
1199	};
1200
1201
1202	function addLoadEvent(func){
1203	  _onload=window.onload;
1204	  if(typeof window.onload!='function')window.onload=func;
1205	  else window.onload=function(){
1206		  if(_onload)_onload();
1207		  func();
1208	  };
1209	}
1210
1211
1212	me.popup=function(l,w,h){
1213		_location=l;
1214		var r=(isValid(get("a"),get('id')))?me:new MyShopVoid();
1215		if(r.valid){
1216			if(_myshop_popup)try{
1217				_myshop_popup.close();
1218				_myshop_popup=null;
1219			}catch(e){};
1220
1221			if(w)_width=w;
1222			if(h)_height=h;
1223
1224			var settings="location=0,directories=0,toolbar=no,resizable=no,status=no,scrollbars=1,menubar=no,width=";
1225			settings+=_width+",height="+_height+",left="+((screen.width-_width)*0.5)+",top="+((screen.height-_height)*0.4);
1226			_myshop_popup=window.open("/views/clear.html",POPUP_NAME,settings);
1227		}
1228		return r;
1229	};
1230
1231	var _list=[];
1232	me.set=function(n,v){
1233		var f=getData();
1234		if(f&&f[n])f[n].value=v;
1235		try{
1236			var el=document.querySelector("input[name='"+n+"']");
1237			if(el)el.value=v;
1238		}catch(e){}
1239		_list[n]=v;
1240		return me;
1241	};
1242	me.s=function(n,v){
1243		var argl=me.s.arguments;
1244		if(argl){
1245			l=argl.length;
1246			if(l>2)for(var i=0;i<l;i+=2)try{
1247				me.set(argl[i],argl[i+1]);
1248			}catch(e){}
1249			else me.set(n,v);
1250		}else me.set(n,v);
1251		return me;
1252	};
1253
1254	function get(n,def){
1255		var r=_list[n];
1256		return(r)?r:def;
1257	}
1258
1259	me.duplicate=function(formName,from,to){
1260		var f=getData(),v=me.get(from,formName);
1261		if(f&&f[to])f[to].value=v;
1262		return me;
1263	};
1264
1265	me.get=function(n,formName){
1266		var f=(formName)?document.forms[formName]:getData(),value="";
1267		if(f&&f[n])value=f[n].value;
1268		return value;
1269	};
1270
1271	me.isMoreInfoEditMode=function(){
1272		return 'change_moreinfo_update'==me.get("e");
1273	};
1274
1275	me.form=function(n){
1276		_formName=n;
1277		return me;
1278	};
1279	me.f=me.form;
1280
1281	me.location=function(l,t){
1282
1283		if((typeof l)=="object"&&l.href){
1284			l=l.href;
1285		}
1286
1287		_hasQuery=false;
1288		if(l&&l!='?'){
1289			_location=l;
1290			_hasQuery=(l.indexOf('?')!=-1);
1291		}
1292		else _location=null;
1293
1294
1295		if(trim(t)!="")_target=t;
1296
1297		if(_myshop_popup)try{_myshop_popup.close();}catch(e){};
1298		_myshop_popup=null;
1299
1300		return me;
1301	};
1302	me.l=me.location;
1303
1304	me.confirm=function(id){
1305		var c=getElementOnId(id);
1306		return confirm((c)?MyShopRemoveHTMLTags(c.innerHTML):id)?me:new MyShopVoid();
1307	};
1308
1309	function getAttr(c,n){
1310		var v="";
1311		try{v=c.getAttribute(n);}
1312		catch(e){}
1313		return v;
1314	}
1315
1316	me.oke=false;
1317
1318	var _showError=true;
1319	function callbackValidateOrder(doc){
1320		return callbackValidate(doc,"1");
1321	}
1322	
1323	function callbackValidate(doc,after){
1324		var valid=true;
1325		if(doc){
1326			var i=0,pairs=doc.getElementsByTagName('pair');
1327			if(pairs){
1328				for(;i<pairs.length;i++){
1329					valid=false;
1330					if(_showError){
1331						alert(pairs[i].firstChild.nodeValue);
1332						var n=getAttr(pairs[i],"key");
1333						if(n)window.setTimeout("myshop().focus('"+n+"');",10);
1334						break;
1335					}
1336				}
1337			}
1338			
1339			if("1"==after){
1340				var e=_myshopEvent.events.MYSHOP_EVENT_AFTER_ORDER;
1341				if(_myshop.exist(e))_myshop.trigger(e,{
1342					"description":getEl(doc,'description'),
1343					"quantity":getEl(doc,'quantity'),
1344					"price":getEl(doc,'price'),
1345					"id":getEl(doc,'id'),
1346					"currency":getEl(doc,'currency')
1347				});
1348			}
1349		}
1350		_showError=true;
1351		me.oke=valid;
1352		return valid;
1353	}
1354
1355	function getEl(doc,name){
1356		let val="";
1357		if(doc){
1358			let pairs=doc.getElementsByTagName(name);
1359			if(pairs)val=pairs[0].firstChild.nodeValue;
1360		}
1361		return val;
1362	}
1363
1364
1365	me.validate=function(product,quantity,show){
1366		_showError=true;
1367		if("-1"==show)_showError=false;
1368		if(quantity){
1369			_quantity=(isNaN(quantity))?quantity.value:quantity;
1370			var f=getData();
1371			if(f)f["id"].value=_quantity;
1372		}
1373		me.oke=true;
1374		return (new Remote(false).get(true).request("validate",callbackValidate,"product",decodeURIComponent(product)))?me:new MyShopVoid();
1375	};
1376
1377	me.calculateCredits=function(product,quantity,count,callback){
1378		me.oke=true;
1379		return (new Remote(false).request("calculate-credits",callback,"product",decodeURIComponent(product),"product-quantity",quantity,"count",count))?me:new MyShopVoid();
1380	};
1381
1382	function callbackToken(doc){
1383		var valid=false;
1384		if(doc){
1385			var i=0,pairs=doc.getElementsByTagName('col');
1386			if(pairs){
1387				for(;i<pairs.length;i++){
1388					_myshop_plugin["postnl-token"]=getAttr(pairs[i],"id");
1389					_myshop_plugin["postnl-location"]=pairs[i].firstChild.nodeValue;
1390					valid=true;
1391					break;
1392				}
1393			}
1394		}
1395		me.oke=valid;
1396		return valid;
1397	}
1398
1399
1400	me.token=function(){
1401		me.oke=true;
1402		return (new Remote(false).request("token",callbackToken))?me:new MyShopVoid();
1403	};
1404
1405
1406	function callbackPageId(doc){
1407		var valid=false;
1408		if(doc){
1409			var i=0,pairs=doc.getElementsByTagName('col');
1410			if(pairs){
1411				for(;i<pairs.length;i++){
1412					_myshop_plugin["myshop-action"]=pairs[i].firstChild.nodeValue;
1413					valid=true;
1414					break;
1415				}
1416			}
1417		}
1418		me.oke=valid;
1419		return valid;
1420	}
1421
1422
1423	me.pageId=function(){
1424		me.oke=false;
1425		var r=new MyShopVoid(),l=""+document.location;
1426		if(l&&l.indexOf(".html")!=-1)r=(new Remote(false).request("catalog_item_data",callbackPageId,"page",l))?me:r;
1427		return r;
1428	};
1429
1430	me.product=function(cid,id,cb){
1431		$.getJSON("/rpc/product/"+cid+"/"+id,function(data){
1432	  		var items = [];
1433	  		$.each(data,function(key,val){items[key]=val});
1434	  		if(cb)cb(items);
1435 		});
1436	};
1437
1438	me.order=function(product,quantity,update){
1439		var f=getData();
1440		if(f)f["id"].value=product;
1441		me.oke=(new Remote(false).request("order",callbackValidateOrder,"quantity",decodeURIComponent(quantity)));
1442		if(me.oke&&update){
1443			var list=me.shoppingCart().storage;
1444			if(list){
1445				if(window.$){
1446					$("#basket_value_count").html(list.get("count"));
1447					$(".myshp_menu_basket_count").html(list.get("count-number"));
1448				}else{
1449					var ctl=getElementOnId("basket_value_count");
1450					if(ctl)ctl.innerHTML=list.get("count");
1451				}
1452			}
1453		}
1454		return me.oke?me:new MyShopVoid();
1455	};
1456
1457	me.register=function(email){
1458		me.message="";
1459		me.oke=false;
1460
1461		new Remote(false).request("register",function(doc){
1462			var valid=false;
1463			if(doc){
1464				var i=0,pairs=doc.getElementsByTagName('col');
1465				if(pairs){
1466					for(;i<pairs.length;i++){
1467						me.message=printf(pairs[i].firstChild.nodeValue,email);
1468						valid=("success"==getAttr(pairs[i],"type"));
1469						log(getAttr(pairs[i],"type")+" is valid " + valid);
1470						break;
1471					}
1472				}
1473			}
1474			me.oke=valid;
1475
1476		},"email",decodeURIComponent(email));
1477
1478		return me.oke?me:new MyShopVoid();
1479	};
1480
1481	me.poll=function(vid,ref,tid,cb){
1482		me.message="";
1483		me.oke=false;
1484		new Remote(false).request("poll",function(doc){
1485			if(doc){
1486				var pairs=doc.getElementsByTagName('col');
1487				if(pairs&&pairs.length>0)me.message=pairs[0].getAttribute("type");
1488			}
1489			me.oke=true;
1490			if(cb)cb(me);
1491		},"ref",ref,"vid",vid,"ticket_sha",tid);
1492
1493		return me.oke?me:new MyShopVoid();
1494	};
1495	me.clear=function(cb){
1496		me.oke=false;
1497		new Remote(false).request("clear-basket",function(){
1498			me.oke=true;
1499			if(cb)cb(me);
1500		});
1501		return me.oke?me:new MyShopVoid();
1502	};
1503
1504
1505	function printf(v) {
1506		var arg = printf.arguments, i = 1, re = new RegExp("%%", "i");
1507		for (; i < arg.length; i++)
1508			v = v.replace(re, arg[i]);
1509		return v;
1510	}
1511
1512	me.notify=function(cb){
1513		return (new Remote(false).request("notify",cb))?me:new MyShopVoid();
1514	};
1515
1516	me.expired=function(cb){
1517		return (new Remote(false).request("home",cb))?me:new MyShopVoid();
1518	};
1519
1520
1521	me.go=function(l){
1522		if("basket"==l)return(new Remote(false).request("shoppingcart",myshopEvent().callbackRedirect))?me:new MyShopVoid();
1523		return new MyShopVoid();
1524	};
1525
1526
1527	me.resource=function(s,n){
1528		new Remote(false).request("resource",myshopEvent().callbackResource,"section",s,"name",n);
1529		return myshopEvent();
1530	};
1531
1532	me.resources=function(call){
1533		if(0==_myshop.sizeR){
1534			var i,loc=""+$("[name=url_rpc]").val(),vid=""+$("[name=vid]").val();
1535			if(""===vid)vid="1";
1536			if(""===loc)loc="https://www.mijnwinkel.nl/rpc/resources/1/1.json?vid="+vid;
1537			else{
1538				if(-1!=loc.indexOf("/shop"))loc="https://www.mijnwinkel.nl/rpc";
1539				i=loc.indexOf(";");
1540				if(-1!=i)loc=loc.substring(0,i)+"/resources/1/1.json"+loc.substring(i)+"?vid="+vid;
1541				else loc+="/resources/1/1.json?vid="+vid;
1542			}
1543			$.getJSON(loc, {
1544			    format: "json"}).done(function(data){$.each(data,function(k,v){
1545			   		_myshop.setR(k,v);
1546		  		});
1547		  		if(call)call(me);
1548		 	});
1549		}else if(call)call(me);
1550	};
1551
1552	me.element=function(name,defVal){
1553		let val=defVal;
1554		const lst = document.getElementsByName(name);
1555		if(null!=lst&&lst.length>0){
1556			val=collection[0].value;
1557		}
1558		return val;
1559	};
1560
1561	me.getResource=function(s,k){
1562		return _myshop.getR(s,k);
1563	};
1564
1565
1566	function callbackRestore(doc){
1567		log(self._restoreCb);
1568		var list=new QueryString();
1569		if(doc){
1570			var t=doc.getElementsByTagName('storage');
1571			if(t){
1572				for(var n=t.length-1;n>=0;n--){
1573					var name=getAttr(t[n],"name"),v=t[n].childNodes[0].nodeValue;
1574					if(name)list.set(name,v);
1575				}
1576			}
1577		}
1578		me.storage=list;
1579		log(list);
1580		if(self._restoreCb)self._restoreCb(list);
1581	}
1582	me.storage=null;
1583
1584
1585	me.restore=function(s,cb){
1586		self._restoreCb=cb;
1587		new Remote(false).request("restore",callbackRestore,"section",s,"myshp_persist",_persist);
1588		_persist="0";
1589		return me;
1590	};
1591
1592	me.persist=function(){
1593		_persist="1";
1594		return me;
1595	};
1596	var _persist="0",_restoreCb=null;
1597
1598	me.shoppingCart=function(n,v){
1599		if(n&&v)new Remote(false).request("shoppingcart_store",callbackStore,"section","store","name",n,"value",v);
1600		else new Remote(false).request("shoppingcart",callbackRestore);
1601		return me;
1602	};
1603
1604	function callbackStore(){
1605	}
1606
1607	me.store=function(s,n,v){
1608		new Remote(false).request("store",callbackStore,"section",s,"name",n,"value",v,"myshp_persist",_persist);
1609		_persist="0";
1610		return me;
1611	};
1612
1613	me.call=function(n,cb){
1614		var par=[],argl=me.call.arguments,l=argl.length;
1615			for(i=0;i<l;i++){
1616				par.push(argl[i]);
1617			}
1618		new Remote(true).request.apply(null,par);
1619		return me;
1620	};
1621
1622
1623	me.load=function(lib,callback){
1624		var headId=document.getElementsByTagName("head")[0],loaded=false;
1625		if(headId){
1626			var newScript=document.createElement('script');
1627			newScript.type='text/javascript';
1628			newScript.onload=callback;
1629			newScript.src=lib;
1630			headId.appendChild(newScript);
1631			loaded=true;
1632		}
1633		return loaded;
1634	};
1635
1636	me.keypress=function(e,action,bubble,a,id,next){
1637		if(!e)e=window.event;
1638		if(!bubble)bubble=false;
1639		if(e.keyCode==13&&action){
1640			try{action(a,id,next);}
1641			catch(e){};
1642		}
1643		return(bubble||e.keyCode!=13);
1644	};
1645
1646	me.checked=function(n,state){
1647		var c=getElementOnId(n);
1648		if(c)c.checked=state;
1649		return me;
1650	};
1651
1652
1653	/* remote interface */
1654
1655	function QueryString(s){
1656		var me=this,_p=[],_n=[];
1657		me.set=function(k,v){
1658			var b=false,l=_n.length,i=0;
1659			for(;i<l;i++)if(_n[i]==k){
1660				b=true;
1661				break;
1662			}
1663			if(!b)_n[l]=k;
1664			_p[k]=v;
1665		};
1666		me.get=function(k){return(_p[k]==null)?"":_p[k];};
1667		me.exist=function(k){return _p[k]!=null;};
1668		me.getQueryString=function(){
1669			var s="",i=0;
1670			for(;i<_n.length;i++){
1671				s+=encodeURIComponent(_n[i])+"="+encodeURIComponent(_p[_n[i]])+"&";
1672			}
1673			return s;
1674		};
1675		if(s!=null&&s!=""){
1676			var list=s.substr(1).split("&"),l=list.length,i=0;
1677			for(;i<l;i++){
1678				var v=list[i].split("=");
1679				if(v.length>1)me.set(decodeURIComponent(v[0]),decodeURIComponent(v[1]));
1680			}
1681		}
1682		me.keys=_n;
1683	}
1684
1685	function Remote(async){
1686		if(null==async)async=true;
1687		var me=this,_req=null,_callback=null,_url=null,_get=false;
1688		function val(f,i){
1689			var v=f[i].value;
1690			if(v!=null&&v!="")v=v.replace("+","%2b");
1691			return v;
1692		}
1693		me.fields=function(f){
1694			var q=new QueryString(),argl=me.fields.arguments,i;
1695			if(f){
1696				var exclude=[];
1697				if(argl){
1698					l=argl.length;
1699					for(i=1;i<l;i++)exclude[argl[i]]=1;
1700				}
1701				for(i=f.length-1;i>=0;i--){
1702					var n=f[i].name;
1703					if(!exclude[n])q.set(n,val(f,i));
1704				}
1705			}
1706			return q;
1707		};
1708
1709		me.get=function(mode){
1710			_get=mode;
1711			return me;
1712		};
1713		me.request=function(type,cb){
1714			var f=getData(),i=0,l,argl=me.request.arguments,activex=null,q=new QueryString(),result=false;
1715			if(cb&&f){
1716				l=f.length;
1717				for(;i<l;i++){
1718					var n=f[i].name;
1719					if(!q.exist(n))q.set(n,val(f,i));
1720				}
1721
1722				l=argl.length;
1723				for(i=2;i<l;i+=2){
1724					q.set(argl[i],argl[i+1]);
1725				}
1726				q.set('type',type);
1727				var qs=q.getQueryString();
1728				_callback=cb;
1729				if(window.XMLHttpRequest)_req=new XMLHttpRequest();
1730			    else if(window.ActiveXObject){
1731			        activex="Microsoft.XMLHTTP";
1732			        _req=new ActiveXObject("Msxml2.XMLHTTP");
1733			        if(!_req)_req=new ActiveXObject(activex);
1734			    }
1735				if(_req&&((f["url_rpc"]&&f["url_rpc"].value)||_url)){
1736			        if(async)_req.onreadystatechange=processReqChange;
1737			        if(_get){
1738			        	_req.open('GET',((_url)?_url:f["url_rpc"].value)+"?jid="+(new Date()).getTime()+"&"+qs,async);
1739			        	_req.send();
1740			        }
1741			        else{
1742			        	_req.open('POST',((_url)?_url:f["url_rpc"].value)+"?jid="+(new Date()).getTime(),async);
1743			        	_req.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
1744			        	_req.send(qs);
1745			        }
1746					if(!async)result=processReqChange();
1747			    }else result=_callback(null);
1748			}
1749			return result;
1750		};
1751
1752		me.url=function(n){
1753			if(n)_url=n;
1754			return this;
1755		};
1756
1757		function processReqChange(){
1758			var result=false;
1759			if(4==_req.readyState){
1760		        if(200==_req.status){
1761					var doc=_req.responseXML.documentElement;
1762					/*log(_req.responseText+" "+doc);*/
1763					if(!doc){
1764						var xmlTxt=_req.responseText;
1765						if(typeof DOMParser!="undefined"){
1766							doc=(new DOMParser()).parseFromString(xmlTxt,"text/xml");
1767						}
1768						else if(typeof ActiveXObject!="undefined"){
1769							doc=new ActiveXObject("Microsoft.XMLDOM");
1770							if(doc){
1771								doc.async=false;
1772								doc.loadXML(xmlTxt);
1773							}
1774						}
1775						if(doc)doc=doc.documentElement;
1776					}
1777					if(doc)result=_callback(doc);
1778				}else result=_callback(null);
1779	        }
1780	    	return result;
1781	    }
1782	}
1783
1784}
1785function MyShopVoid(){
1786	var me=this;
1787	me.version=3;
1788	me.valid=false;
1789
1790	me.oke=false;
1791
1792	function myself(){return me;}
1793	function clear(){
1794		if(_caller&&_caller.href)_caller.href="javascript:void(0);";
1795		return false;
1796	}
1797
1798	me.action=clear;
1799	me.a=clear;
1800	me.open=clear;
1801	me.trigger=clear;
1802
1803	var _caller=null;
1804	me.caller=function(caller){
1805		_caller=caller;
1806		return me;
1807	};
1808	me.c=me.caller;
1809	me.keypress=function(e){
1810		if(!e)e=window.event;
1811		return(e.keyCode!=13);
1812	};
1813	me.reload=function(){};
1814	me.submitPage=function(){};
1815
1816	me.location=myself;
1817	me.l=myself;
1818	me.popup=myself;
1819	me.confirm=myself;
1820	me.set=myself;
1821	me.s=myself;
1822	me.duplicate=myself;
1823	me.validate=myself;
1824	me.form=myself;
1825	me.f=myself;
1826	me.checked=myself;
1827	me.get=myself;
1828	me.scroll=myself;
1829	me.init=myself;
1830	me.item=myself;
1831	me.sp=myself;
1832	me.ssp=myself;
1833	me.cs=myself;
1834	me.r=myself;
1835	me.notify=myself;
1836	me.expired=myself;
1837	me.restore=myself;
1838	me.go=myself;
1839	me.persist=myself;
1840	me.resources=myself;
1841
1842	me.data=function(){return document.forms['data'];};
1843	me.resource=function(s,n){return new MyShop().resource(s,n);};
1844	me.storage=null;
1845
1846	log("void()");
1847}
1848
1849function myshop(block){
1850	var blocked=false;
1851	if(null==block)block="yes";
1852
1853	if("yes"==block){
1854		var now=new Date().getTime();
1855		blocked=true;
1856		if(-1==_myshop_event_block){
1857			blocked=false;
1858			_myshop_event_block=now;
1859		}
1860		else if((Math.abs(now-_myshop_event_block))>500){
1861			_myshop_event_block=-1;
1862			blocked=false;
1863		}
1864
1865		if(-1==_myshop_event_block2){
1866			_myshop_event_block2=now;
1867		}
1868		else if((Math.abs(now-_myshop_event_block2))>9000){
1869			_myshop_event_block2=-1;
1870			_myshop.clear("lock_next");
1871		}
1872	}
1873
1874	log("blocked "+blocked);
1875
1876	return(blocked)?new MyShopVoid():new MyShop();
1877}
1878
1879function log(s){
1880	myshopConsole(s);
1881}
1882
1883
1884/********** */
1885
1886
1887function MyShopTrack(){
1888	let me=this;
1889	me.initDone=false;
1890	me.initSuccess = true;
1891	me.LOG=false;
1892
1893	function getElById(name){
1894       if(!me.initSuccess)return null;
1895       var el = document.getElementById(name);
1896       me.initSuccess = null!=el;
1897       
1898       if(me.LOG)console.log("getElById",name," ",me.initSuccess);
1899       
1900       return el;
1901	}
1902	function getElSelector(name){
1903       if(!me.initSuccess)return null;
1904       var el = document.querySelector(name);
1905       me.initSuccess = null!=el;
1906       
1907       if(me.LOG)console.log("getElSelector",name," ",me.initSuccess);
1908       
1909       return el;
1910	}
1911	function existElSelector(name){
1912       return null!=document.querySelector(name);
1913	}
1914	
1915	function updateTemplateIdInput(trackOptions) {
1916		localStorage.setItem(getKey(), trackOptions);
1917	}
1918	function getShopId(){
1919		if(window.myShopId)me.shopId=window.myShopId;
1920		if(!me.shopId||""==me.shopId){
1921			let vid = document.querySelector('input[name="vid"]');
1922			this.initSuccess = null!=vid;
1923	        me.shopId= this.initSuccess ? vid.value : null;
1924		}
1925		return me.shopId;
1926	}
1927
1928	function getKey(){
1929		return getShopId()+"_track_options";
1930	}
1931
1932	function load(){
1933		let settings = localStorage.getItem(getKey());
1934		if(!settings||""==settings){
1935			settings=getTrackOptionsDef();
1936			localStorage.setItem(getKey(), settings);
1937		}
1938		return settings;
1939	}
1940
1941	function save(){
1942		localStorage.setItem(getKey(), getTrackOptions());
1943	}
1944	function getTrackOptionsDef() {
1945		return (me.marketingCheckbox)?`N1;S1;M${me.marketingCheckbox.checked?"1":"0"}`:"N1:S1:M0";
1946	}
1947	
1948	function getTrackOptions() {
1949		return `N1;S${me.statisticsCheckbox.checked?"1":"0"};M${me.marketingCheckbox.checked?"1":"0"}`;
1950	}
1951	
1952	me.retry=function(shopId){
1953		me.initDone=false;
1954		me.initSuccess=true;
1955		me.init(shopId);
1956	}
1957	
1958	me.init=function(shopId){
1959		if(me.initDone)return;
1960		me.shopId="";
1961		if(shopId)me.shopId=shopId;
1962		
1963		
1964		me.necessaryCheckbox=getElById("shp-cookie-ncecessary");
1965		me.statisticsCheckbox=getElById("shp-cookie-statistics");
1966		me.marketingCheckbox=getElById("shp-cookie-marketing");
1967		me.allowAllButton=getElById("shp-cookie-allowall-btn");
1968		me.allowSelectionButton= getElById("shp-cookie-allow-selection-btn");
1969		if(!existElSelector('.cookie-banner-accept-button'))me.agreeToCookiesButton=getElSelector('.shp-cookie-banner-accept-button');
1970		else me.agreeToCookiesButton=getElSelector('.cookie-banner-accept-button');
1971		
1972		if(me.initSuccess){
1973			me.necessaryCheckbox.checked = true;
1974	
1975			let saveState=load();
1976			
1977			if(me.LOG)console.log("Active state ",saveState);
1978			
1979			if (saveState) {
1980	           me.statisticsCheckbox.checked = -1!=saveState.indexOf("S1");
1981	           me.marketingCheckbox.checked =-1!=saveState.indexOf("M1");
1982			}
1983	       
1984			me.allowAllButton.addEventListener("click", function() {
1985				me.necessaryCheckbox.checked = true;
1986				me.statisticsCheckbox.checked = true;
1987				me.marketingCheckbox.checked = true;
1988				save();
1989				me.closeModalAndRefresh();
1990				me.agreeToCookiesButton.click();
1991			});
1992
1993			me.allowSelectionButton.addEventListener("click", function() {
1994				save();
1995				me.closeModalAndRefresh();
1996				me.agreeToCookiesButton.click();
1997			});
1998
1999			me.closeModalAndRefresh=function() {
2000				let modal = document.getElementById('shp-cookie-switch');
2001				if(modal){
2002					if (typeof bootstrap !== 'undefined' && bootstrap.Modal) {
2003		                let modalInstance = bootstrap.Modal.getInstance(modal);
2004		                if (modalInstance) {
2005		                    updateTemplateIdInput(getTrackOptions());
2006		                }
2007		            } else if (typeof $ !== 'undefined' && $.fn.modal) {
2008		                updateTemplateIdInput(getTrackOptions());
2009		            }
2010				}
2011			};
2012			
2013			me.initDone = true;
2014	   }
2015	};
2016	
2017	me.allowMarketing=function(){
2018		me.init();
2019		return -1!=load().indexOf("M1");
2020	};
2021	me.allowStat=function(){
2022		me.init();
2023		return -1!=load().indexOf("S1");
2024	};
2025	me.show=function(){
2026		let modal = document.getElementById('shp-cookie-switch');
2027		if(modal){
2028			if (typeof bootstrap !== 'undefined' && bootstrap.Modal) {
2029                let modalInstance = bootstrap.Modal.getInstance(modal);
2030                if (modalInstance) {
2031                    modalInstance.show();
2032                }
2033            } else if (typeof $ !== 'undefined' && $.fn.modal) {
2034                $(modal).modal('show');
2035            }
2036		}
2037	};
2038}
2039var _myshopTrack=new MyShopTrack();
2040
2041function myshopTrack(){
2042	return _myshopTrack;
2043}
2044
2045
2046
2047/************** */
2048

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.