var valid;Prototype.Browser.IE8=Prototype.Browser.IE&&parseInt(navigator.userAgent.substring(navigator.userAgent.indexOf("MSIE")+5))==8;Prototype.Browser.IE9=Prototype.Browser.IE&&parseInt(navigator.userAgent.substring(navigator.userAgent.indexOf("MSIE")+5))==9;ShopSpecialOffer=Class.create({initialize:function(container){this.container=$(container);this.totalNum=0;this.currentImageNumber=0;this.imageList=this.container.getElementsBySelector('.image-container .image-full img');this.descList=this.container.getElementsBySelector('.desc-container .description');this.init();this.createInterval();this.preloadImages(2500);this.container.getElementsBySelector('.feature-arrow-r').invoke('observe','mouseenter',function(event){var el=event.findElement();el.addClassName('arrowright-hover')}).invoke('observe','mouseleave',function(event){var el=event.findElement();el.removeClassName('arrowright-hover')}).invoke('observe','mousedown',function(event){var el=event.findElement();el.addClassName('arrowright-down')}).invoke('observe','mouseup',function(event){var el=event.findElement();el.removeClassName('arrowright-down')}).invoke('observe','click',function(event){this.removeInterval();var nNewImage=Math.abs((this.currentImageNumber+1)%this.totalNum);this.showImage(nNewImage);this.createInterval()}.bind(this));this.container.getElementsBySelector('.feature-arrow-l').invoke('observe','mouseenter',function(event){var el=event.findElement();el.addClassName('arrowleft-hover')}).invoke('observe','mouseleave',function(event){var el=event.findElement();el.removeClassName('arrowleft-hover')}).invoke('observe','mousedown',function(event){var el=event.findElement();el.addClassName('arrowleft-down')}).invoke('observe','mouseup',function(event){var el=event.findElement();el.removeClassName('arrowleft-down')}).invoke('observe','click',function(event){this.removeInterval();var nNewImage=((this.currentImageNumber-1)%this.totalNum);if(nNewImage<0){nNewImage=nNewImage+this.totalNum}this.showImage(nNewImage);this.createInterval()}.bind(this))},init:function(){var iImageLength=this.imageList.length;this.totalNum=iImageLength;for(var i=0;i<iImageLength;i++){if(this.imageList[i].hasClassName('.image-show')){this.currentImageNumber=i;this.imageList[i].setOpacity(1.0);break}}},createInterval:function(){this.removeInterval();var oThis=this;var intervalShowImage=function(){var nNewImage=(oThis.currentImageNumber+1)%oThis.totalNum;oThis.showImage(nNewImage)};oThis.intervalID=window.setInterval(intervalShowImage,6000)},removeInterval:function(){if(this.intervalID){window.clearInterval(this.intervalID)}},preloadImages:function(iTimeUntilLoad){var oThis=this;window.setTimeout(function(){var i;oThis.imageList[0].imageLoaded=!(oThis.imageList[0].imageLoaded);for(i=1;i<oThis.imageList.length;i++){if(!oThis.imageList[i].imageLoaded){oThis.imageList[i].writeAttribute('src',oThis.imageList[i].readAttribute('_src'));oThis.imageList[i].imageLoaded=true}}oThis.imagesLoaded=true},iTimeUntilLoad)},showImage:function(nImage){if(!this.imagesLoaded){return}if(nImage==this.currentImageNumber){return}if(!(this.imageList&&(this.currentImageNumber>=0)&&this.imageList[this.currentImageNumber]&&this.imageList[nImage])){return}var nCurrentImage=this.currentImageNumber;new Effect.Parallel([new Effect.Fade(this.imageList[nCurrentImage],{sync:true}),new Effect.Appear(this.imageList[nImage],{sync:true}),new Effect.Fade(this.descList[nCurrentImage],{sync:true}),new Effect.Appear(this.descList[nImage],{sync:true})],{duration:1.0,afterFinish:function(){this.imageList[nCurrentImage].removeClassName('image-show');this.imageList[nCurrentImage].setOpacity(0.0);this.descList[nCurrentImage].removeClassName('description-show');this.descList[nCurrentImage].setOpacity(0.0);this.imageList[nImage].addClassName('image-show');this.imageList[nImage].setOpacity(1.0);this.descList[nImage].addClassName('description-show');this.descList[nImage].setOpacity(1.0)}.bind(this)});this.currentImageNumber=nImage}});var Cart=Class.create({initialize:function(){this.url=SHOP_BASE_REL+'front/server_cart.php'},addRelated:function(div_id){var params=$H({action:'addRelated',cart_mode:'simple',sid:Math.random()}).toQueryString();params=params+"&"+$('form_related').serialize();$(div_id).ajaxUpdate(this.url,{method:'post',parameters:params,onComplete:this.showCompleteCart()})},addToCart:function(div_id,product_id,quantity){cart_mode='simple';if(div_id=='winkelmand_container'){cart_mode='extended'}var params=$H({action:'addToCart',product_id:product_id,cart_mode:cart_mode,quantity:quantity,sid:Math.random()}).toQueryString();if(div_id=='winkelmand_container'){$(div_id).ajaxUpdate(this.url,{method:'get',parameters:params,onComplete:this.showCompleteCart()})}else{$(div_id).ajaxUpdate(this.url,{method:'get',parameters:params,onComplete:this.showCompleteCart()})}},removeFromCart:function(id,product_id,cart_id){var params=$H({action:'remove',product_id:product_id,cart_id:cart_id,sid:Math.random()}).toQueryString();$(id).ajaxUpdate(this.url,{method:'get',parameters:params,onComplete:function(){$$('.resizing_textareas').each(function(el){new Texpand(el,{autoShrink:true})});resize()}})},checkUpdate:function(id,start_quantity,product_id,quantity,cart_id){if(start_quantity!=quantity){this.updateToCart(id,product_id,quantity,cart_id)}},updateToCart:function(id,product_id,quantity,cart_id){var params=$H({action:'update',product_id:product_id,cart_id:cart_id,quantity:quantity,sid:Math.random()}).toQueryString();$(id).ajaxUpdate(this.url,{method:'get',parameters:params,onComplete:function(){$$('.resizing_textareas').each(function(el){new Texpand(el,{autoShrink:true})});resize()}})},refreshCart:function(id){var params=$H({action:'refresh',sid:Math.random()}).toQueryString();$(id).ajaxUpdate(this.url,{method:'get',parameters:params,onComplete:function(){$$('.resizing_textareas').each(function(el){new Texpand(el,{autoShrink:true})})}})},clearCart:function(){var params=$H({action:'clearCart',sid:Math.random()}).toQueryString();$('winkelmand_container').ajaxUpdate(this.url,{method:'get',parameters:params,onComplete:function(){resize()}})},saveCart:function(id,name){var params=$H({action:'save_cart',cart_id:id,cart_name:name,sid:Math.random()}).toQueryString();$('winkelmandje-storebox').ajaxUpdate(this.url,{method:'get',parameters:params,onComplete:function(){alert(SHOP_SHOPPINGCART_STORED);$$('.resizing_textareas').each(function(el){new Texpand(el,{autoShrink:true})})}})},loadSavedCart:function(id){var params=$H({action:'load_saved_cart',cart_id:id,sid:Math.random()}).toQueryString();$('header_cart').ajaxUpdate(this.url,{method:'get',parameters:params,onComplete:function(){showCompleteCart()}})},deleteSavedCart:function(id){var params=$H({action:'delete_saved_cart',cart_id:id,sid:Math.random()}).toQueryString();$('order_list_overview').ajaxUpdate(this.url,{method:'get',parameters:params})},goto_checkout:function(step,substep,action){var form_elements="";f=$('form_winkelmand_cadeau');if(f){form_elements=f.serialize()}f2=$('form_shoppingcart_items');if(f2){if(form_elements.length>0){form_elements+="&"}form_elements+=f2.serialize()}var params=$H({action:action,step:step,substep:substep,sid:Math.random()}).toQueryString();if(form_elements){params=form_elements+"&"+params}$('popup_module-resultaat').ajaxUpdate(this.url,{method:'POST',parameters:params,onComplete:function(){if($('form_checkout')){valid=new Validation('form_checkout',{immediate:true,onFormValidate:formCallback,useTitles:true})}else{if($('form_user')&&$('user_choice_subscribe').visible()){valid=new Validation('form_user',{immediate:true,onFormValidate:formCallback,useTitles:true});Validation.addAllThese([['validate-url','Een correcte adres invullen a.u.b.',function(v){return(Validation.get('IsEmpty').test(v)||v=="http://"||/^(http|https|ftp):\/\/(([A-Z0-9][A-Z0-9_-]*)(\.[A-Z0-9][A-Z0-9_-]*)+)(:(\d+))?\/?/i.test(v))}],['validate-postcode','Postcode is niet correct',function(v,elm){return(Validation.get('IsEmpty').test(v)||/^[\d]{4,4}\s{0,1}[a-zA-Z]{2,2}$/.test(v))}]])}else if($('form_login')&&$('user_choice_login').visible()){valid=new Validation('form_login',{immediate:true,onFormValidate:formCallback,useTitles:true})}}$$('.resizing_textareas').each(function(el){new Texpand(el,{autoShrink:true})});resize()}})},checkout_goto:function(step){this.goto_checkout(step,'','show')},checkout_confirm_form:function(form,nextstep){$(form).request({onComplete:function(req){$('popup_module-resultaat').innerHTML=req.responseText;if($('form_checkout')){valid=new Validation('form_checkout',{immediate:true,onFormValidate:formCallback,useTitles:true})}else{if($('form_user')&&$('user_choice_subscribe').visible()){valid=new Validation('form_user',{immediate:true,onFormValidate:formCallback,useTitles:true});Validation.addAllThese([['validate-url','Een correcte adres invullen a.u.b.',function(v){return(Validation.get('IsEmpty').test(v)||v=="http://"||/^(http|https|ftp):\/\/(([A-Z0-9][A-Z0-9_-]*)(\.[A-Z0-9][A-Z0-9_-]*)+)(:(\d+))?\/?/i.test(v))}],['validate-postcode','Postcode is niet correct',function(v,elm){return(Validation.get('IsEmpty').test(v)||/^[\d]{4,4}\s{0,1}[a-zA-Z]{2,2}$/.test(v))}]])}else if($('form_login')&&$('user_choice_login').visible()){valid=new Validation('form_login',{immediate:true,onFormValidate:formCallback,useTitles:true})}}resize()}});return false},showCompleteCart:function(action){if(action&&action=='payment'){action=action}else{action='show';if($('header_cart').down('span.empty_cart')){return false}}var params=$H({action:action,sid:Math.random()}).toQueryString();this.req_parameters=params;Lightview.show({href:this.url,rel:'ajax',viewport:true,options:{menubar:false,innerPreviousNext:false,overflow:'hidden',topclose:true,autosize:false,fullscreen:true,ajax:{method:'get',parameters:this.req_parameters,onComplete:function(){$$('.resizing_textareas').each(function(el){new Texpand(el,{autoShrink:true})})}}}})}});var Payment=Class.create({initialize:function(){},checkAgree:function(){return $('agree2').checked},showPaymentDescription:function(){pchoice=$RF('pchoice');if(pchoice!=null){switch(pchoice){case'Buckaroo_ideal':$('payment_method_description').innerHTML=$('form_description_buckaroo_ideal').innerHTML;break;case'Buckaroo_incasso':$('payment_method_description').innerHTML=$('form_description_buckaroo_incasso').innerHTML;break;case'Vooruitbetalen':$('payment_method_description').innerHTML=$('form_description_vooruitbetalen').innerHTML;break;case'OpRekening':$('payment_method_description').innerHTML=$('form_description_oprekening').innerHTML;break;case'PayPal':$('payment_method_description').innerHTML=$('form_description_paypal').innerHTML;break;default:$('payment_method_description').innerHTML=$('form_description_'+pchoice).innerHTML;break}}},pay:function(){if(this.checkAgree()){checkout_only=false;if($('form_payment_checkout_only')){checkout_only=true}if(checkout_only){var pform=$('form_payment_checkout_only');pform.submit()}else{pchoice=$RF('pchoice');if(pchoice==null){alert(SHOP_PAYMENT_CHOSE_METHOD);return}switch(pchoice){case'Buckaroo_ideal':var pform=$('form_payment_buckaroo_ideal');$('payment_method_description').innerHTML=$('form_description_buckaroo_ideal').innerHTML;pform.submit();return true;break;case'Buckaroo_incasso':var pform=$('form_payment_buckaroo_incasso');$('payment_method_description').innerHTML=$('form_description_buckaroo_incasso').innerHTML;pform.submit();return true;break;case'Vooruitbetalen':var pform=$('form_payment_vooruitbetalen');$('payment_method_description').innerHTML=$('form_description_vooruitbetalen').innerHTML;pform.submit();break;case'OpRekening':var pform=$('form_payment_oprekening');$('payment_method_description').innerHTML=$('form_description_oprekening').innerHTML;pform.submit();break;case'PayPal':var pform=$('form_payment_paypal');$('payment_method_description').innerHTML=$('form_description_paypal').innerHTML;pform.submit();break;default:if(pchoice.indexOf('MSP_')==0){var url=SHOP_BASE_REL+'front/server_msp.php';var method=pchoice.substring(4);var params=$H({action:'start_request',method:pchoice.substring(4),session:$F('MSP_'+method+'_session'),id:$F('MSP_'+method+'_order_id'),step:$F('MSP_'+method+'_step'),sid:Math.random()}).toQueryString();new Ajax.Request(url,{method:'post',parameters:params,onSuccess:function(transport){var json=transport.responseText.evalJSON();if(json.success){window.location=json.url}else{alert(SHOP_PAYMENT_PROVIDER_ERROR)}}})}else{alert(SHOP_PAYMENT_NOT_POSSIBLE)}}}}else{alert(SHOP_ACCEPT_GENERAL_CONDITIONS)}},showGeneralConditions:function(buttons){if($('general_conditions')){if($(buttons+'_confirm')){$(buttons+'_confirm').toggle()}if($(buttons+'_previous')){$(buttons+'_previous').toggle()}$('payment_container').toggle();$('general_conditions').clonePosition($('lightview'));$('general_conditions').setStyle({'width':width-20+'px','height':height-100+'px'});$('general_conditions').toggle()}}});var Login=Class.create({initialize:function(){},password_forgotten:function(form_id,login_box_id,login_box_forgotten_id,name_id,name_forgotten_id){if($(login_box_id+'_confirm')){$(login_box_id+'_confirm').hide()}$(name_forgotten_id).value=$F(name_id);$(login_box_id).toggle();$(login_box_forgotten_id).toggle()},send_password:function(form_id,login_box_id,login_box_forgotten_id,name_id,name_forgotten_id){f_value=$F(name_forgotten_id);var url=SHOP_BASE_REL+'front/server_user.php';var params=$H({action:'send',id:f_value,sid:Math.random()}).toQueryString();$('passwordforgotten_response').ajaxUpdate(url,{method:'get',parameters:params,onComplete:function(){$(form_id).password.value='';$(name_id).value=$F(name_forgotten_id);if($(login_box_id+'_confirm')){$(login_box_id+'_confirm').show()}$(login_box_id).toggle();$(login_box_forgotten_id).toggle()}})},loginEnter:function(e){if(window.event&&e.keyCode==13){valid.validate()}else if(e.which&&e.which==13){valid.validate()}}});Array.prototype.removeItems=function(itemsToRemove){if(!/Array/.test(itemsToRemove.constructor)){itemsToRemove=[itemsToRemove]}var j;for(var i=0;i<itemsToRemove.length;i++){j=0;while(j<this.length){if(this[j]==itemsToRemove[i]){this.splice(j,1)}else{j++}}}};var ShopCategory=Class.create({initialize:function(container,active){this.container=container;this.active=active;var ct=$(this.container);$$('.list_column_1').invoke('hide');if(!active){}else{var active_item=$('list_'+this.active);active_item.addClassName('sub_active');active_item.up().show();active_item.up('.list_column_0').down('.item_main').addClassName('active')}$$('a.item_main').invoke('observe','click',function(){var next=$(this).up('div').next('div');if(next){if(next.visible()){this.removeClassName('active');Effect.BlindUp(next,{duration:2.0})}else{this.addClassName('active');Effect.BlindDown(next,{duration:2.0})}}return false});$$('a.item_sub').invoke('observe','click',function(){$$('a.item_sub').invoke('up','.list_item_sub').invoke('removeClassName','sub_active');this.up().addClassName('sub_active')})}});var ShopRequest=Class.create({initialize:function(url,options,filters){this.base_options={};this.options={action:'',column:'',direction:'',nav_page:'',nr_results:'',searchTerms:'',exact:''};Object.extend(this.options,options||{});this.filters={cat_id:new Array(),f_product_a1:new Array(),f_product_price_incl:new Array(),f_product_administration_discount:new Array()};Object.extend(this.filters,filters||{})},addParameters:function(options){this.options.sid=null;Object.extend(this.options,options||{})},removeParameters:function(toRemove){this.options.removeItems(toRemove)},setBaseParameters:function(options){this.base_options=options},setParameters:function(options){this.options=options},setFilter:function(key,value){var length=this.filters[key].length;this.filters[key][length]=value},removeFilter:function(key,value){this.filters[key].removeItems(value)},removeFilters:function(key){this.filters[key]=new Array()},removeAllFilters:function(){for(var filter in this.filters){this.filters[filter]=new Array()}},getBaseParameters:function(){return $H(this.base_options).toQueryString()},getQueryString:function(){if(!this.options.searchterms){if($('general_searchterms'))$('general_searchterms').value=''}var params=$H(this.base_options).toQueryString();params=params+'&'+$H(this.options).toQueryString();for(var filter in this.filters){for(i=0;i<this.filters[filter].length;i++){params=params+'&'+filter+'[]='+encodeURIComponent(this.filters[filter][i])}}return params}});var Shop=Class.create({initialize:function(options){this.url=SHOP_BASE_REL+'front/server.php';this.cart=new Cart();this.payment=new Payment();this.login=new Login();this.req_parameters="";this.product_detail_fullscreen=false;this.request=new ShopRequest(this.url,options);this.requestQueue=[]},setParameters:function(params){this.request.setParameters(params)},setBaseParameters:function(params){this.request.setBaseParameters(params)},showCompleteCart:function(action){this.cart.showCompleteCart(action)},getCart:function(){return this.cart},getLogin:function(){return this.login},getPayment:function(){return this.payment},showProductDetail:function(){if($('main_content_detail')){$('main_content_detail').remove()}if($('filters')){$('filters').hide()}if($('module-resultaat.resultaat')){$('module-resultaat.resultaat').hide()}if($('module-resultaat.breadcrumb')){$('module-resultaat.breadcrumb').hide()}if($('module-resultaat.detail')){if($('module-resultaat')){if(this.product_detail_fullscreen){$('module-resultaat.detail').absolutize();$('module-resultaat.detail').style.zIndex="4999";$('module-resultaat.detail').style.background="#000000 none repeat scroll 0 0";$('module-resultaat.detail').clonePosition($('document_body'));$('module-resultaat.detail').height=document.viewport.getHeight()+"px"}else{el=$('dit-page-contentcontentleft');if(Prototype.Browser.testIE){$('module-resultaat.detail').style.zIndex="4999";$('module-resultaat.detail').style.background="#ffffff";$('module-resultaat.detail').clonePosition(el,{setHeight:false});el.childElements().each(function(el){if(el.id!='module-resultaat'){$('module-resultaat').hide()}})}else{$('module-resultaat.detail').style.zIndex="4999";$('module-resultaat.detail').style.background="#ffffff";$('module-resultaat.detail').clonePosition(el,{setHeight:false});el.childElements().each(function(el){if(el.id!='module-resultaat'){$('module-resultaat').hide()}})}}}$('module-resultaat.detail').show();scroll(0,0)}},showProductSearch:function(){if($('main_content_detail')){$('main_content_detail').remove()}if($('product-details')){if($('product-details')!="undefined"){$('product-details').hide()}}if($('module-resultaat.breadcrumb')){$('module-resultaat.breadcrumb').show()}if($('filters')){$('filters').show()}if($('module-resultaat.detail')){$('module-resultaat.detail').hide()}if($('module-resultaat.resultaat')){$('module-resultaat.resultaat').show()}el=$('module-resultaat');if(el){el.show()}scroll(0,0)},closeProductDetail:function(){this.showProductSearch()},updateCategory:function(catid){if($('module-resultaat.resultaat')){if(catid==""){catid=0}if($('module-resultaat.breadcrumb')){$('module-resultaat.breadcrumb').show();this.updateCategoryForElement(catid,'breadcrumb','module-resultaat.breadcrumb')}if($('module-resultaat.resultaat')){this.updateCategoryForElement(catid,'gallery','module-resultaat.resultaat')}if($('product_bestsellers')){this.updateBestsellers(catid)}this.closeProductDetail();return false}return true},updateBestsellers:function(catid){var params=$H({action:'update',catid:catid,sid:Math.random()}).toQueryString();$('product_bestsellers_list').ajaxUpdate(SHOP_BASE_REL+'front/server_bestellers.php',{method:'get',parameters:params,onComplete:function(transport){if($('product_bestsellers_list')){if(transport.responseText.length>0){$('product_bestsellers').show()}else{$('product_bestsellers').hide()}}}})},changeTab:function(artikelCode,tab,tab_selected){},changeViewType:function(){this.showProductSearch();params={action:'typeSelection',type:$F('weergave'),sid:Math.random(),nav_page:1};this.request.addParameters(params);$('module-resultaat.resultaat').ajaxUpdate(this.url,{method:'get',parameters:this.request.getQueryString(),onComplete:function(){Lightview.updateViews()}})},changeSort:function(column,direction){this.showProductSearch();if(!column){pair=$F('sortering').split("|");column=pair[0];direction=pair[1]}params={action:'sort',column:column,direction:direction,sid:Math.random(),sort:''};this.request.addParameters(params);$('module-resultaat.resultaat').ajaxUpdate(this.url,{method:'get',parameters:this.request.getQueryString(),onComplete:function(){Lightview.updateViews()}})},subproductDetails:function(artikelCode,parentArtikelCode){this.productDetail(artikelCode,parentArtikelCode,1,0)},returnToParentProductDetails:function(artikelCode){this.productDetail(artikelCode,'',0,1)},productDetails:function(artikelCode){return this.productDetail(artikelCode,'',0,0)},productDetail:function(artikelCode,parentArtikelCode,sub,backfromsub){if($('module-resultaat.detail')){this.showProductDetail();var params=this.request.getBaseParameters();params=params+'&'+($H({action:'details',artikelCode:artikelCode,parentArtikelCode:parentArtikelCode,sub:sub,backfromsub:backfromsub,sid:Math.random()}).toQueryString());$('module-resultaat.detail').ajaxUpdate(this.url,{method:'get',parameters:params,evalScripts:true,onComplete:function(req){Lightview.updateViews()}});return false}return true},searchProducts:function(clean,general){this.showProductSearch();if(general){searchTerms=$F('general_searchterms');if($('general_exact')){exact=$F('general_exact')}else{exact=0}}else{searchTerms=$F('searchterms');if($('exact')){exact=$F('exact')}else{exact=0}}if(clean){this.request.setParameters({action:'search',searchTerms:searchTerms,exact:exact,sid:Math.random()})}else{this.request.setParameters({action:'search',searchTerms:searchTerms,exact:exact,sid:Math.random()})}this.request.removeAllFilters();$('module-resultaat.resultaat').ajaxUpdate(this.url,{method:'get',parameters:this.request.getQueryString(),onComplete:function(){Lightview.updateViews();if($('module-resultaat')){$('module-resultaat').removeClassName('module-resultaat');$('module-resultaat').addClassName('module-resultaat-full')}if($('menu_titel')){$('menu_titel').addClassName('menu_titel_collapse')}if($('module-info')){$('module-info').style.width='22px'}if($('module-infoContents')){$('module-infoContents').hide()}if($('module-resultaat.breadcrumb')){$('module-resultaat.breadcrumb').hide()}isExtended=0;if($('filters')){this.updateFilterList()}}})},updateProductListPage:function(page){this.showProductSearch();params={action:'navigate',nav_page:page,sid:Math.random()};this.request.addParameters(params);$('module-resultaat.resultaat').ajaxUpdate(this.url,{method:'get',parameters:this.request.getQueryString(),onComplete:function(){Lightview.updateViews()}})},updateCategoryForElement:function(catid,action,elementId){if(action=='gallery'){params={action:action,catid:catid,nav_page:1,sid:Math.random(),column:'',direction:'',searchTerms:''};this.request.addParameters(params);$(elementId).ajaxUpdate(this.url,{method:'get',parameters:this.request.getQueryString(),onComplete:function(){Lightview.updateViews()}})}else{params={action:action,catid:catid,nav_page:1,sid:Math.random(),column:'',direction:'',searchTerms:''};this.request.addParameters(params);$(elementId).ajaxUpdate(this.url,{method:'get',parameters:this.request.getQueryString(),onComplete:function(){Lightview.updateViews()}})}},switchPersonal:function(){if($('user_choice_subscribe').visible()){$('user_choice_login').show();$('user_choice_subscribe').hide();$('tabs_tab_subscribe').removeClassName('active');$('tabs_tab_login').addClassName('active');valid=new Validation('form_login',{immediate:true,onFormValidate:formCallback,useTitles:true})}else if($('user_choice_login').visible()){$('user_choice_subscribe').show();$('user_choice_login').hide();$('tabs_tab_subscribe').addClassName('active');$('tabs_tab_login').removeClassName('active');valid=new Validation('form_user',{immediate:true,onFormValidate:formCallback,useTitles:true});Validation.addAllThese([['validate-url','Een correcte adres invullen a.u.b.',function(v){return Validation.get('IsEmpty').test(v)||v=="http://"||/^(http|https|ftp):\/\/(([A-Z0-9][A-Z0-9_-]*)(\.[A-Z0-9][A-Z0-9_-]*)+)(:(\d+))?\/?/i.test(v)}],['validate-postcode','Postcode is niet correct',function(v,elm){return Validation.get('IsEmpty').test(v)||/^[\d]{4,4}\s{0,1}[a-zA-Z]{2,2}$/.test(v)}]])}},checkout_login:function(button){valid=new Validation('form_login',{immediate:true,onFormValidate:formCallback,useTitles:true});button.disabled=true;if(!valid.validate()){button.disabled=false}return false},checkout_subscribe:function(button){valid=new Validation('form_user',{immediate:true,onFormValidate:formCallback,useTitles:true});Validation.addAllThese([['validate-url','Een correcte adres invullen a.u.b.',function(v){return Validation.get('IsEmpty').test(v)||v=="http://"||/^(http|https|ftp):\/\/(([A-Z0-9][A-Z0-9_-]*)(\.[A-Z0-9][A-Z0-9_-]*)+)(:(\d+))?\/?/i.test(v)}],['validate-postcode','Postcode is niet correct',function(v,elm){return Validation.get('IsEmpty').test(v)||/^[\d]{4,4}\s{0,1}[a-zA-Z]{2,2}$/.test(v)}]]);button.disabled=true;if(!valid.validate()){button.disabled=false}return false},removeFilter:function(key,value){this.showProductSearch();if(value==''){$$("#"+key+" a.filter_active").each(function(el){el.removeClassName('filter_active')})}else{$(key+'_'+value).removeClassName('filter_active')}params={action:'removefilter',nav_page:1,sid:Math.random(),column:'',direction:''};if(value==''){this.request.removeFilters(key)}else{this.request.removeFilter(key,value)}this.request.addParameters(params);$('module-resultaat.resultaat').ajaxUpdate(this.url,{method:'get',parameters:this.request.getQueryString(),onComplete:function(){Lightview.updateViews()}})},addFilter:function(key,value){this.showProductSearch();var id=key+'_'+value;if($(id).hasClassName('filter_active')){this.removeFilter(key,value)}else{$(id).addClassName('filter_active');params={action:'addfilter',nav_page:1,sid:Math.random(),column:'',direction:''};this.request.setFilter(key,value);this.request.addParameters(params);$('module-resultaat.resultaat').ajaxUpdate(this.url,{method:'get',parameters:this.request.getQueryString(),onComplete:function(){Lightview.updateViews()}})}},showLargeImage:function(source_el){var el=$('img_groot_replace');$('img_groot').hide();if(el){el.src=(source_el.src.replace(/.thumb.png/,""));el.show()}},hideLargeImage:function(){$('img_groot').show();if($('img_groot_replace')){$('img_groot_replace').hide()}}});var PPage=Class.create({initialize:function(){this.url=SHOP_BASE_REL+'front/server_ppage.php'},changeValidation:function(val){valid.reset();switch(val){case'DE':$('company_btwnummer').removeClassName('required');break;case'NL':$('company_btwnummer').addClassName('required');break;case'BE':$('company_btwnummer').removeClassName('required');break}},sameCheckValue:function(){var boxStatus;boxStatus=eval($('place1').checked);if(boxStatus==true){if($('user_delivery_name')){if($F('user_infix'))$('user_delivery_name').value=$F('user_firstname')+' '+$F('user_infix')+' '+$F('user_lastname');else $('user_delivery_name').value=$F('user_firstname')+' '+$F('user_lastname')}$('user_delivery_address').value=$F('user_address');if($('user_housenumber'))$('user_delivery_housenumber').value=$F('user_housenumber');$('user_delivery_zipcode').value=$F('user_zipcode');$('user_delivery_city').value=$F('user_city')}},submitResultaat:function(form,action){$(form).request({onComplete:function(req){if(req.responseText=='refresh'){window.location.replace("/profiel/")}else{$('module-resultaat.resultaat').innerHTML=req.responseText}if($('form_ppage_user')){valid=new Validation('form_ppage_user',{immediate:true,onFormValidate:formCallback,useTitles:true})}}});return false},updateResultaatDeleteId:function(action,id){if(confirm('Gebruiker verwijderen?')){var params=$H({action:action,res_id:id,sid:Math.random()}).toQueryString();$('module-resultaat.resultaat').ajaxUpdate(this.url,{method:'get',parameters:params,onComplete:function(){if($('form_ppage_user')){valid=new Validation('form_ppage_user',{immediate:true,onFormValidate:formCallback,useTitles:true})}}})}},updateResultaatId:function(action,id){var params=$H({action:action,res_id:id,sid:Math.random()}).toQueryString();$('module-resultaat.resultaat').ajaxUpdate(this.url,{method:'get',parameters:params,onComplete:function(){if($('form_ppage_user')){valid=new Validation('form_ppage_user',{immediate:true,onFormValidate:formCallback,useTitles:true})}}})},updateResultaat:function(action){if(typeof $('module-resultaat.resultaat')=="undefined"){return true}else{if($('module-resultaat.breadcrumb')){$('module-resultaat.breadcrumb').hide()}var params=$H({action:action,sid:Math.random()}).toQueryString();$('module-resultaat.resultaat').ajaxUpdate(this.url,{method:'get',parameters:params,onComplete:function(){if($('form_ppage_user')){valid=new Validation('form_ppage_user',{immediate:true,onFormValidate:formCallback,useTitles:true})}if($('module-resultaat')&&$('module-resultaat.resultaat')){el=$('module-resultaat')}}});return false}}});var shop=new Shop();var ppage=new PPage();function checkNumber(elId,afname){v=$F(elId);if(isNaN(v)||/^\s+$/.test(v)){$(elId).value=afname}else{if(v==0){$(elId).value=afname;v=afname}if((v%afname)>0){alert('Minimale afname is '+afname+'. U kunt alleen hier meervouden van kiezen.');$(elId).value=afname}}}function addQuantity(elId,afname){$(elId).value=parseInt($F(elId))+afname;checkNumber(elId,afname)}function removeQuantity(elId,afname){temp=parseInt($F(elId))-afname;if(temp<afname){$(elId).value=afname}else{$(elId).value=temp}checkNumber(elId,afname)}Event.observe(document.onresize?document:window,"resize",function(){resize(document)});function resize(document){var height=parseInt(document.viewport.getHeight())-80;var width=parseInt(document.viewport.getWidth())-80;var el=$$('.lv_contentTop')[0];if(el){el.setStyle({'width':(width-4)+'px','height':(height-4)+'px'})}Lightview.resize({width:width,height:height})}function trigger(name){var element=$('subcat_'+name);var hrefElement=$('href_'+name);if(trim(hrefElement.innerHTML)=="+"){hrefElement.innerHTML="-";element.style.display='block'}else{hrefElement.innerHTML="+";element.style.display='none'}}function submitForm(form,action){if(form=='form_checkout'||form=='form_login'||form=='form_user'){shop.getCart().checkout_confirm_form(form,action)}else{ppage.submitResultaat(form,action)}}function formCallback(result,form){form_status=result;if(form_status){var id='';if(Prototype.Browser.IE7||Prototype.Browser.IE6){id=form.getAttribute('name')}else{id=form.identify()}if(id=='form_checkout'||id=='form_login'||id=='form_user'){submitForm(id,$F('step'))}else{submitForm(id,$F('action'))}}}document.observe('lightview:opened',function(event){if(!event.target.href){var body=document.body;body=$(body);body.down('div.website').hide()}});document.observe('lightview:hidden',function(event){if(!event.target.href){var body=document.body;body=$(body);body.down('div.website').show();if($('header_cart')){shop.getCart().refreshCart('header_cart')}if($('order_list_overview')!=null){ppage.updateResultaat('order_list_overview')}}});document.observe("dom:loaded",function(){if($('general_searchterms')){$('general_searchterms').observe('keydown',function(e){if(e.keyCode==13){$('general_search').submit()}})}},false);
