function expand(B,D,C,A){B=$(B);D=$(D);if(D.visible()){D.hide();B.update(B.readAttribute("org_value"));if(typeof(A)!="undefined"){if(Object.isArray(A)||Object.isHash(A)){A.invoke("show")}else{if(Object.isElement(A)){A.show()}}}}else{B.writeAttribute("org_value",B.innerHTML).update(C);D.show();if(typeof(A)!="undefined"){if(Object.isArray(A)||Object.isHash(A)){A.invoke("hide")}else{if(Object.isElement(A)){A.hide()}}}}}var Leftbox=new (Class.create({nbSend:function(B,A){A=$(A);if(A.form.onsubmit()){new Ajax.Request("/nieuwsbriefajax/type/"+B,{method:"post",parameters:$(A.form).serialize(),onComplete:function(C){if(C.responseJSON==null||!C.responseJSON){return}alert(C.responseJSON)}.bind(this),onFailure:function(C){}})}}}))();String.prototype.htmlEntities=function(){return this.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")};Element.addMethods({inViewport:function(E){E=$(E);var D;var G=E.getStyle("display");if(G=="none"||G==null){D={display:E.getStyle("display"),visibility:E.getStyle("visibility"),position:E.getStyle("position")};var D=E.setStyle({visibility:"hidden",position:"absolute",display:"block"})}var F=E.getDimensions();var B=E.viewportOffset();var I=document.viewport.getDimensions();if(G=="none"||G==null){E.setStyle(D)}var J=-B.top;var C=-B.left;var H=(F.height+B.top)-I.height;var A=(F.width+B.left)-I.width;return{top:!(J>0),right:!(A>0),bottom:!(H>0),left:!(C>0),visible:!((J>0)|(A>0)|(H>0)|(C>0))}},submitForm:function(B,A){B=$(B);if(!B){return false}if(B.nodeName!="form"){B=B.up("form")}if(B.onsubmit==null||B.onsubmit()!=false){A=$H(A||{});A.each(function(D){var C=$(D.key);if(C){C.value=D.value}});B.submit();return true}return false}});Element.addMethods("SELECT",{selectAll:function(B){B=$(B);for(var A=0;A<B.options.length;A++){B.options[A].selected=true}},deselectAll:function(B){B=$(B);for(var A=0;A<B.options.length;A++){B.options[A].selected=false}},selectedItem:function(A){A=$(A);if(A.selectedIndex>=0&&A.selectedIndex<A.options.length){return A.options[A.selectedIndex]}return false},selectedValue:function(A){A=$(A);if(A.selectedIndex>=0&&A.selectedIndex<A.options.length){return A.options[A.selectedIndex].value}return null},selectedValues:function(C){var A=[];C=$(C);for(var B=0;B<C.options.length;B++){if(C.options[B].selected){A.push(C.options[B].value)}}return A},selectedItems:function(C){var A=[];C=$(C);for(var B=0;B<C.options.length;B++){if(C.options[B].selected){A.push(C.options[B])}}return A},selectValue:function(B,C){B=$(B);for(var A=0;A<B.options.length;A++){B.options[A].selected=(B.options[A].value==C)}return null},selectValues:function(C,A){C=$(C);for(var B=0;B<C.options.length;B++){opt=C.options[B];opt.selected=(A.indexOf(opt.value)>=0)}return null}});
