var gallery=function(){var O={groups:{},shops:[],shopsBig:{},options:{galleryPath:"/new/js/gallery/",imgPath:"images/",width:163,height:86,iconsPadding:29,animate:true,isOpen:false},init:function(AA,p,l){for(var s in p){this.groups[s]=p[s]}for(var s in l){this.options[s]=l[s]}this.gallery=this.createGallery();var x=document.getElementById(AA);if(!x){return }x.appendChild(this.gallery);var r=L();var AC=3,o=0;this.iconHeight=this.options.height+this.options.iconsPadding;var AC=this.showItems=Math.floor((r-180)/this.iconHeight);this.show_items=AC;var z=1;if(this.icons.hasChildNodes()){z=this.icons.childNodes.length}var u=AC*this.iconHeight;this.frame.style.height=u+"px";var n=AC*this.iconHeight+63;this.arrow.style.height=n+"px";this.showAll.style.top=(n/2-111)+"px";this.showSmall.style.top=n/2+"px";var k=this.wideFrame.style,AB=this.smallFrame;k.height=AC*this.iconHeight+60+"px";var m=e();k.width=(m-140)+"px";var j=R("i_menu");if(this.options.isOpen){AB.$isOpened=true;AB.style.display="block";j.style.display="block";this.showSmall.className="iShowOpened"}else{AB.$isOpened=true;AB.style.display="none";j.style.display="none";this.showSmall.className="iShowClosed"}this.showAll.className="i_maximize";var y=document.getElementsByTagName("body")[0];if(y){y.appendChild(this.popup=N("div",{id:"i_popup"},N("div",{id:"i_popup_content"}),N("div",{"class":"i_popup_footer"})))}var w=R("i_list");this.isMacFF=P();if(this.isMacFF){R("i_show_all").style.visibility="hidden"}else{AC=w.childNodes.length;R("i_scroll_cont").style.overflow="hidden"}for(var s=0;s<AC;s++){if(w.childNodes[s]){w.childNodes[s].style.display="block"}}var t=R("centralArea").offsetHeight;var v=A(R("centralArea"));var q=this.show_items*this.iconHeight+85;R("i_gallery").style.marginTop=v+Math.floor((t-q)/2)+"px";this.gallery.style.visibility="visible";K()},sortAlpha:function(){O.sort("alpha")},sortRating:function(){O.sort("rating")},sort:function(k){var r=R("i_list"),l=R("i_scrollable"),m=O.shopsBig,o=O.shops,s;if(k=="alpha"){s=I}else{if(k=="rating"){s=Y}else{s=C}}o.sort(s);for(var p=0,q=o.length;p<q;p++){if(o[p].num!==0){r.appendChild(o[p].elem)}}for(var p=l.childNodes.length;--p>-1;){l.childNodes[p].parentNode.removeChild(l.childNodes[p])}for(var p in m){m[p].sort(s);l.appendChild(N("h2",0,p));var h=N("ul",0);l.appendChild(h);for(var n=0,q=m[p].length;n<q;n++){h.appendChild(m[p][n].elem)}l.appendChild(N("br",{clear:"all"}))}if(O.isMacFF){for(var p=0,q=r.childNodes.length;p<q;p++){r.childNodes[p].style.display=p<O.show_items?"block":"none"}}else{for(var p=0,q=r.childNodes.length;p<q;p++){r.childNodes[p].style.display="block"}}},createGallery:function(){var x=this.icons=N("ul",{id:"i_list"});var u=this.wideFrame=N("div",{id:"i_scrollable"});var t=[];for(var v in this.groups){var o=[];for(var j in this.groups[v]){var k=allShops[j],m=this.groups[v][j];if(k==undefined){continue}if(typeof k.desc=="string"){var w=k.desc;var l="default"}else{var w=k.desc.popupText;var l="AMEX"}var r=N("div",{"class":"i_rating"}),q=N("div",{"class":"i_rating"});var n=k.rating||0;for(var p=0;p<n;p++){r.appendChild(N("img",{src:this.options.galleryPath+this.options.imgPath+"star.gif"}));q.appendChild(N("img",{src:this.options.galleryPath+this.options.imgPath+"star.gif"}))}t.push({name:j,num:parseInt(m),rating:n,elem:N("li",0,N("a",{"class":"i_item",href:k.link},N("img",{src:this.options.galleryPath+this.options.imgPath+k.img,width:this.options.width,height:this.options.height,longdesc:w,popupstyle:l,events:{mouseover:this.showPopup,mouseout:this.hidePopup}})),N("p",{"class":"i_title_bar"},j,r))});o.push({name:j,num:m,rating:n,elem:N("li",0,N("a",{"class":"i_item",href:k.link},N("img",{src:this.options.galleryPath+this.options.imgPath+k.img,width:this.options.width,height:this.options.height,longdesc:w,popupstyle:l,events:{mouseover:this.showPopup,mouseout:this.hidePopup}})),N("div",{"class":"i_title_bar"},j,q))})}u.appendChild(N("h2",0,v));var h=N("ul",0);u.appendChild(h);o.sort(I);for(var p=0,s=o.length;p<s;p++){h.appendChild(o[p].elem)}this.shopsBig[v]=o;u.appendChild(N("br",{clear:"all"}))}t.sort(C);for(var p=0,s=t.length;p<s;p++){if(t[p].num!==0){x.appendChild(t[p].elem)}}this.shops=t;var y=N("div",{id:"i_gallery"},N("div",{id:"i_menu","class":"i_menu_closed",events:{click:M}},N("span",0,"Sorteren"),N("div",{"class":"i_menu_block"},N("div",{"class":"i_menu_item",events:{click:this.sortAlpha}},"Alfabet"),N("div",{"class":"i_menu_item",events:{click:this.sortRating}},"Waardering"),N("div",{"class":"i_menu_item",events:{click:this.sort}},"Nieuwste"))),N("div",{id:"i_show"},N("div",{"class":"top"}),this.arrow=N("div",{id:"inner_arrow"},this.showAll=N("div",{id:"i_show_all","class":"i_maximize",events:{click:this.switchFrames}}),this.showSmall=N("div",{id:"i_show_small","class":"iShowOpened",events:{click:this.toggle,mouseover:this.i_hover,mouseout:this.i_unhover}})),N("div",{"class":"bottom"})),this.smallFrame=N("div",{id:"i_fore_list"},this.btnUp=N("div",{id:"i_list_up",events:{click:this.up}}),this.frame=N("div",{id:"i_scroll_cont"},x),this.btnDown=N("div",{id:"i_list_down",events:{click:this.down}})),this.wideFrame=N("div",{id:"i_big_list"},u));return y},toggle:function(){var l=O.smallFrame,i=O.smallFrame.style,h=O.wideFrame,k=O.showSmall,j=R("i_menu");h.style.display="none";h.$isOpened=false;if(!l.$isOpened){i.display=j.style.display="block";k.className="iShowOpened";l.$isOpened=true}else{i.display=j.style.display="none";k.className="iShowClosed";l.$isOpened=false}O.showAll.className="i_maximize"},switchFrames:function(i){var l=O.smallFrame.style,h=O.wideFrame.style,k=O.showSmall,j=R("i_menu");if(O.wideFrame.$isOpened){h.display=j.style.display="none";if(O.smallFrame.$isOpened){k.className="iShowOpened";l.display=j.style.display="block"}else{k.className="iShowClosed";l.display=j.style.display="none"}O.showAll.className="i_maximize";O.wideFrame.$isOpened=false}else{h.display=j.style.display="block";k.className="iShowOpened";l.display="none";O.wideFrame.$isOpened=true;O.showAll.className="i_minimize"}if(i&&i.stopPropagation){i.stopPropagation()}else{window.event.cancelBubble=true}},upMacFF:function(){var k=O.icons.childNodes;var h=k.length;if(O.showItems>=h){return }for(var j=h-1;j>=0;j--){if(k[j].style.display=="block"&&(j-O.showItems)>=0){k[j].style.display="none";k[j-O.showItems].style.display="block";break}}},downMacFF:function(){var k=O.icons.childNodes;var h=k.length;if(O.showItems>=h){return }for(var j=0;j<h;j++){if(k[j].style.display=="block"&&k[j+O.showItems]){k[j].style.display="none";k[j+O.showItems].style.display="block";break}}},up:function(){if(O.isMacFF){O.upMacFF();return }if(this.$disabled){return }var k=this;var j=O.icons;var l=O.frame.offsetHeight;var m=parseInt(j.style.marginTop||0);if(Math.abs(m)>=O.iconHeight){if(O.options.animate){this.$disabled=true;var i=new d(j,5,30);i.addThread("marginTop",m,m+O.iconHeight);i.addAction(function(){k.$disabled=false},4);i.run()}else{j.style.marginTop=(m+O.iconHeight)+"px"}}},down:function(){if(O.isMacFF){O.downMacFF();return }if(this.$disabled){return }var k=O.icons,j=this;var l=O.iconHeight*O.icons.childNodes.length-O.frame.offsetHeight;var m=parseInt(k.style.marginTop||0);if((l+m)>=O.iconHeight){if(O.options.animate){this.$disabled=true;var i=new d(k,5,30);i.addThread("marginTop",m,m-O.iconHeight);i.addAction(function(){j.$disabled=false},4);i.run()}else{k.style.marginTop=(m-O.iconHeight)+"px"}}},showPopup:function(j){j=j||window.event;var l=this.parentNode.nextSibling.innerHTML;l=l.replace(/\<.*\>/,"");var i=F(this,"longdesc");var n=j.clientX;var k=j.clientY;if(i.length>0){var m=200,h=O.popup,q=h.style;if(n<(m+30)){q.left=(n+10)+"px"}else{n=n-m-10;q.left=n+"px"}h.className="GL_popup_"+F(this,"popupstyle");q.top=(k+10)+"px";var o=h.innerHTML;h.firstChild.innerHTML="<h4>"+l+"</h4><p>"+i+"</p>";q.visibility="visible";T(this,"mousemove",O.followMouse);T(this,"mouseout",O.stopFollowMouse)}S(j)},hidePopup:function(){O.popup.style.visibility="hidden"},followMouse:function(l){l=l||window.event;var h=l.clientX;var m=l.clientY;var k=200,j=O.popup,i=j.style;if(h<(k+30)){i.left=(h+10)+"px"}else{h=h-k-10;i.left=h+"px"}i.top=(m+10)+"px"},stopFollowMouse:function(h){W(this,"mousemove",O.followMouse);W(this,"mouseout",O.stopFollowMouse)},i_hover:function(i){i=i||window.event;var h=i.target||i.srcElement;if(h.id==this.id){this.className=this.className+"_hover"}},i_unhover:function(i){i=i||window.event;var h=i.target||i.srcElement;if(h.id==this.id){this.className=this.className.replace("_hover","")}}};function P(){var h=navigator.userAgent.toLowerCase();return(h.indexOf("mac")!=-1&&h.indexOf("firefox")!=-1)?true:false}function B(h){return h.offsetParent?h.offsetLeft+B(h.offsetParent):h.offsetLeft}function A(h){return h.offsetParent?h.offsetTop+A(h.offsetParent):h.offsetTop}function R(h){return document.getElementById(h)}function L(){var h=document.documentElement;return self.innerHeight||(h&&h.clientHeight)||document.body.clientHeight}function e(){var h=document.documentElement;return self.innerWidth||(h&&h.clientWidth)||document.body.clientWidth}function B(h){return h.offsetParent?h.offsetLeft+B(h.offsetParent):h.offsetLeft}function A(h){return h.offsetParent?h.offsetTop+A(h.offsetParent):h.offsetTop}function C(i,h){if(i.num<h.num){return !i.num?1:-1}else{if(i.num>h.num){return !h.num?-1:1}else{return 0}}}function Y(i,h){if(i.rating<h.rating){return 1}else{if(i.rating>h.rating){return -1}else{return 0}}}function I(i,h){if(i.name<h.name){return -1}else{if(i.name>h.name){return 1}else{return 0}}}function M(){var h=this.lastChild.style;h.display=(h.display=="block")?"none":"block";this.className=h.display=="block"?"i_menu_opened":"i_menu_closed"}var T=(function(){if(window.addEventListener){return function(j,i,h){j.addEventListener(i,h,false)}}else{return function(j,i,h){j["e"+i+h]=h;j[i+h]=function(){j["e"+i+h](window.event)};j.attachEvent("on"+i,j[i+h])}}})();function W(){if(window.removeEventListener){return function(j,i,h){j.removeEventListener(i,h,false)}}else{return function(j,i,h){j.detachEvent("on"+i,j[i+h]);j[i+h]=null;j["e"+i+h]=null}}}function S(h){if(h.preventDefault){h.preventDefault()}else{h.returnValue=false}}function a(){a=arguments[0].filters?function(h,i){h.style.filter="progid:DXImageTransform.Microsoft.Alpha(opacity="+i+")"}:function(h,i){h.style.opacity=i/100}}function G(j,h){var k=document.defaultView;if(j.style[h]){return j.style[h]}else{if(j.currentStyle){return j.currentStyle[h]}else{if(k&&k.getComputedStyle){h=h.replace(/([A-Z])/g,"-$1");h=h.toLowerCase();var i=k.getComputedStyle(j,"");return i&&i.getPropertyValue(h)}}}return null}function F(h,i){return h[i]||h.getAttribute(i)||""}function N(l,k){if(l){var p=document.createElement(l);if(k){for(var n in k){switch(n){case"events":for(var m in k[n]){T(p,m,k[n][m])}break;default:var q=k[n];if(typeof q!="undefined"){if(n=="class"||n=="for"){n={"for":"htmlFor","class":"className"}[n]||n;p[n]=q}else{p.setAttribute(n,q)}}}}}if(arguments.length>2){for(var o=2,h=arguments.length;o<h;o++){switch(typeof arguments[o]){case"string":p.innerHTML+=arguments[o];break;case"object":p.appendChild(arguments[o])}}}return p}return null}function d(i,h,j){if(!i){return null}this.elem=i;this.numFrames=h||0;this.frames=[];this.speed=j||10}d.prototype={addThread:function(h,k,q,o,j){if(!h||q==="undefined"||q===null){return }if(h=="opacity"){if(k!==0){k=100*parseFloat(k||G(this.elem,h))}}else{k=parseFloat(G(this.elem,h))}o=o||0;j=j||this.numFrames;var m=this.elem,r=this.frames;var p=(j-o)||1;if(k>q){var l=Math.ceil((k-q)/p);for(var n=0;n<p;n++){k=((k-q)<=l)?q:Math.ceil(k-l);if(!r[n]){r[n]=new D()}r[n].addStyle([m,h,k])}}else{var l=Math.ceil((q-k)/p);for(var n=0;n<p;n++){k=((q-k)<=l)?q:Math.ceil(k+l);if(!r[n]){r[n]=new D()}r[n].addStyle([m,h,k])}}},createAction:function(i,h,j){return(h=="opacity")?function(){a(i,j)}:function(){i.style[h]=j+"px"}},addAction:function(h,i){this.frames[i].addAction(h)},step:function(){var h=this.frames.shift();if(h){h.exec()}else{clearInterval(this.interval)}},run:function(){clearInterval(this.interval);this.step();var h=this;if(this.numFrames>1){this.interval=setInterval(function(){h.step()},this.speed)}}};function D(){this.actions=[];this.styles=[]}D.prototype={addAction:function(h){this.actions.push(h)},addStyle:function(h){this.styles.push(h)},exec:function(){var h=this.actions,k=this.styles,l;for(var j=k.length;--j>-1;){if(k[j][1]=="opacity"){a(k[j][0],k[j][2])}else{k[j][0].style[k[j][1]]=k[j][2]+"px"}}while(l=h.shift()){l()}}};var Q=/(^|\s)(([^a]([^ ]+)?)|(a([^#.][^ ]+)+)):(hover|active)/i,f,g=window.document,X=[],b={onhover:{on:"onmouseover",off:"onmouseout"},onactive:{on:"onmousedown",off:"onmouseup"}};function K(){if(!/MSIE (5|6)/.test(navigator.userAgent)){return }window.attachEvent("onunload",E);var k=g.styleSheets,h=k.length;for(var j=0;j<h;j++){c(k[j])}}function c(p){if(p.imports){try{var k=p.imports,h=k.length;for(var o=0;o<h;o++){c(p.imports[o])}}catch(n){}}try{var q=(f=p).rules,h=q.length;for(var m=0;m<h;m++){Z(q[m])}}catch(n){}}function Z(n){var o=n.selectorText,j=n.style.cssText;if(!Q.test(o)||!j){return }var p=o.replace(/[^:]+:([a-z-]+).*/i,"on$1");var q=o.replace(/(\.([a-z0-9_-]+):[a-z]+)|(:[a-z]+)/gi,".$2"+p);var m=(/\.([a-z0-9_-]*on(hover|active))/i).exec(q)[1];var k=o.replace(/:(hover|active).*$/,"");var h=H(k);if(h.length==0){return }f.addRule(q,j);for(var l=0;l<h.length;l++){new V(h[l],m,b[p])}}function V(j,i,h){if(!j.hovers){j.hovers={}}if(j.hovers[i]){return }j.hovers[i]=true;U(j,h.on,function(){j.className+=" "+i});U(j,h.off,function(){j.className=j.className.replace(new RegExp("\\s+"+i,"g"),"")})}function U(j,i,h){j.attachEvent(i,h);X[X.length]={node:j,type:i,handler:h}}function E(){for(var j,h=0;h<X.length;h++){j=X[h];j.node.detachEvent(j.type,j.handler)}}function H(l){var k,h=[g];k=l.split(" ");for(var j=0;j<k.length;j++){h=J(k[j],h)}return h}function J(s,h){var u,m,k=[];var r=(/\#([a-z0-9_-]+)/i).exec(s);if(r){var q=g.getElementById(r[1]);return q?[q]:k}var n=(/\.([a-z0-9_-]+)/i).exec(s);var l=s.replace(/(\.|\#|\:)[a-z0-9_-]+/i,"");var t=n?new RegExp("\\b"+n[1]+"\\b"):false;for(var p=0;p<h.length;p++){u=l?h[p].all.tags(l):h[p].all;for(var o=0;o<u.length;o++){m=u[o];if(t&&!t.test(m.className)){continue}k[k.length]=m}}return k}return O}();function gallery_init(B,C,A){if(window.addEventListener){window.addEventListener("load",function(){gallery.init(B,C,A)},false)}else{if(window.attachEvent){window.attachEvent("onload",function(){gallery.init(B,C,A)})}else{window.onload=function(){gallery.init(B,C,A)}}}};
