﻿/* Modernizr 2.0.6 (Custom Build) | MIT & BSD
 * Build: http://www.modernizr.com/download/#-fontface-backgroundsize-borderimage-borderradius-boxshadow-multiplebgs-opacity-rgba-textshadow-cssgradients-csstransforms-csstransitions-audio-video-iepp-cssclasses-teststyles-testprop-testallprops-prefixes-domprefixes-load
 */
;window.Modernizr=function(a,b,c){function C(a,b){var c=a.charAt(0).toUpperCase()+a.substr(1),d=(a+" "+o.join(c+" ")+c).split(" ");return B(d,b)}function B(a,b){for(var d in a)if(k[a[d]]!==c)return b=="pfx"?a[d]:!0;return!1}function A(a,b){return!!~(""+a).indexOf(b)}function z(a,b){return typeof a===b}function y(a,b){return x(n.join(a+";")+(b||""))}function x(a){k.cssText=a}var d="2.0.6",e={},f=!0,g=b.documentElement,h=b.head||b.getElementsByTagName("head")[0],i="modernizr",j=b.createElement(i),k=j.style,l,m=Object.prototype.toString,n=" -webkit- -moz- -o- -ms- -khtml- ".split(" "),o="Webkit Moz O ms Khtml".split(" "),p={},q={},r={},s=[],t=function(a,c,d,e){var f,h,j,k=b.createElement("div");if(parseInt(d,10))while(d--)j=b.createElement("div"),j.id=e?e[d]:i+(d+1),k.appendChild(j);f=["&shy;","<style>",a,"</style>"].join(""),k.id=i,k.innerHTML+=f,g.appendChild(k),h=c(k,a),k.parentNode.removeChild(k);return!!h},u,v={}.hasOwnProperty,w;!z(v,c)&&!z(v.call,c)?w=function(a,b){return v.call(a,b)}:w=function(a,b){return b in a&&z(a.constructor.prototype[b],c)};var D=function(a,c){var d=a.join(""),f=c.length;t(d,function(a,c){var d=b.styleSheets[b.styleSheets.length-1],g=d.cssRules&&d.cssRules[0]?d.cssRules[0].cssText:d.cssText||"",h=a.childNodes,i={};while(f--)i[h[f].id]=h[f];e.fontface=/src/i.test(g)&&g.indexOf(c.split(" ")[0])===0},f,c)}(['@font-face {font-family:"font";src:url("https://")}'],["fontface"]);p.rgba=function(){x("background-color:rgba(150,255,150,.5)");return A(k.backgroundColor,"rgba")},p.multiplebgs=function(){x("background:url(https://),url(https://),red url(https://)");return/(url\s*\(.*?){3}/.test(k.background)},p.backgroundsize=function(){return C("backgroundSize")},p.borderimage=function(){return C("borderImage")},p.borderradius=function(){return C("borderRadius")},p.boxshadow=function(){return C("boxShadow")},p.textshadow=function(){return b.createElement("div").style.textShadow===""},p.opacity=function(){y("opacity:.55");return/^0.55$/.test(k.opacity)},p.cssgradients=function(){var a="background-image:",b="gradient(linear,left top,right bottom,from(#9f9),to(white));",c="linear-gradient(left top,#9f9, white);";x((a+n.join(b+a)+n.join(c+a)).slice(0,-a.length));return A(k.backgroundImage,"gradient")},p.csstransforms=function(){return!!B(["transformProperty","WebkitTransform","MozTransform","OTransform","msTransform"])},p.csstransitions=function(){return C("transitionProperty")},p.fontface=function(){return e.fontface},p.video=function(){var a=b.createElement("video"),c=!1;try{if(c=!!a.canPlayType){c=new Boolean(c),c.ogg=a.canPlayType('video/ogg; codecs="theora"');var d='video/mp4; codecs="avc1.42E01E';c.h264=a.canPlayType(d+'"')||a.canPlayType(d+', mp4a.40.2"'),c.webm=a.canPlayType('video/webm; codecs="vp8, vorbis"')}}catch(e){}return c},p.audio=function(){var a=b.createElement("audio"),c=!1;try{if(c=!!a.canPlayType)c=new Boolean(c),c.ogg=a.canPlayType('audio/ogg; codecs="vorbis"'),c.mp3=a.canPlayType("audio/mpeg;"),c.wav=a.canPlayType('audio/wav; codecs="1"'),c.m4a=a.canPlayType("audio/x-m4a;")||a.canPlayType("audio/aac;")}catch(d){}return c};for(var E in p)w(p,E)&&(u=E.toLowerCase(),e[u]=p[E](),s.push((e[u]?"":"no-")+u));x(""),j=l=null,a.attachEvent&&function(){var a=b.createElement("div");a.innerHTML="<elem></elem>";return a.childNodes.length!==1}()&&function(a,b){function s(a){var b=-1;while(++b<g)a.createElement(f[b])}a.iepp=a.iepp||{};var d=a.iepp,e=d.html5elements||"abbr|article|aside|audio|canvas|datalist|details|figcaption|figure|footer|header|hgroup|mark|meter|nav|output|progress|section|summary|time|video",f=e.split("|"),g=f.length,h=new RegExp("(^|\\s)("+e+")","gi"),i=new RegExp("<(/*)("+e+")","gi"),j=/^\s*[\{\}]\s*$/,k=new RegExp("(^|[^\\n]*?\\s)("+e+")([^\\n]*)({[\\n\\w\\W]*?})","gi"),l=b.createDocumentFragment(),m=b.documentElement,n=m.firstChild,o=b.createElement("body"),p=b.createElement("style"),q=/print|all/,r;d.getCSS=function(a,b){if(a+""===c)return"";var e=-1,f=a.length,g,h=[];while(++e<f){g=a[e];if(g.disabled)continue;b=g.media||b,q.test(b)&&h.push(d.getCSS(g.imports,b),g.cssText),b="all"}return h.join("")},d.parseCSS=function(a){var b=[],c;while((c=k.exec(a))!=null)b.push(((j.exec(c[1])?"\n":c[1])+c[2]+c[3]).replace(h,"$1.iepp_$2")+c[4]);return b.join("\n")},d.writeHTML=function(){var a=-1;r=r||b.body;while(++a<g){var c=b.getElementsByTagName(f[a]),d=c.length,e=-1;while(++e<d)c[e].className.indexOf("iepp_")<0&&(c[e].className+=" iepp_"+f[a])}l.appendChild(r),m.appendChild(o),o.className=r.className,o.id=r.id,o.innerHTML=r.innerHTML.replace(i,"<$1font")},d._beforePrint=function(){p.styleSheet.cssText=d.parseCSS(d.getCSS(b.styleSheets,"all")),d.writeHTML()},d.restoreHTML=function(){o.innerHTML="",m.removeChild(o),m.appendChild(r)},d._afterPrint=function(){d.restoreHTML(),p.styleSheet.cssText=""},s(b),s(l);d.disablePP||(n.insertBefore(p,n.firstChild),p.media="print",p.className="iepp-printshim",a.attachEvent("onbeforeprint",d._beforePrint),a.attachEvent("onafterprint",d._afterPrint))}(a,b),e._version=d,e._prefixes=n,e._domPrefixes=o,e.testProp=function(a){return B([a])},e.testAllProps=C,e.testStyles=t,g.className=g.className.replace(/\bno-js\b/,"")+(f?" js "+s.join(" "):"");return e}(this,this.document),function(a,b,c){function k(a){return!a||a=="loaded"||a=="complete"}function j(){var a=1,b=-1;while(p.length- ++b)if(p[b].s&&!(a=p[b].r))break;a&&g()}function i(a){var c=b.createElement("script"),d;c.src=a.s,c.onreadystatechange=c.onload=function(){!d&&k(c.readyState)&&(d=1,j(),c.onload=c.onreadystatechange=null)},m(function(){d||(d=1,j())},H.errorTimeout),a.e?c.onload():n.parentNode.insertBefore(c,n)}function h(a){var c=b.createElement("link"),d;c.href=a.s,c.rel="stylesheet",c.type="text/css";if(!a.e&&(w||r)){var e=function(a){m(function(){if(!d)try{a.sheet.cssRules.length?(d=1,j()):e(a)}catch(b){b.code==1e3||b.message=="security"||b.message=="denied"?(d=1,m(function(){j()},0)):e(a)}},0)};e(c)}else c.onload=function(){d||(d=1,m(function(){j()},0))},a.e&&c.onload();m(function(){d||(d=1,j())},H.errorTimeout),!a.e&&n.parentNode.insertBefore(c,n)}function g(){var a=p.shift();q=1,a?a.t?m(function(){a.t=="c"?h(a):i(a)},0):(a(),j()):q=0}function f(a,c,d,e,f,h){function i(){!o&&k(l.readyState)&&(r.r=o=1,!q&&j(),l.onload=l.onreadystatechange=null,m(function(){u.removeChild(l)},0))}var l=b.createElement(a),o=0,r={t:d,s:c,e:h};l.src=l.data=c,!s&&(l.style.display="none"),l.width=l.height="0",a!="object"&&(l.type=d),l.onload=l.onreadystatechange=i,a=="img"?l.onerror=i:a=="script"&&(l.onerror=function(){r.e=r.r=1,g()}),p.splice(e,0,r),u.insertBefore(l,s?null:n),m(function(){o||(u.removeChild(l),r.r=r.e=o=1,j())},H.errorTimeout)}function e(a,b,c){var d=b=="c"?z:y;q=0,b=b||"j",C(a)?f(d,a,b,this.i++,l,c):(p.splice(this.i++,0,a),p.length==1&&g());return this}function d(){var a=H;a.loader={load:e,i:0};return a}var l=b.documentElement,m=a.setTimeout,n=b.getElementsByTagName("script")[0],o={}.toString,p=[],q=0,r="MozAppearance"in l.style,s=r&&!!b.createRange().compareNode,t=r&&!s,u=s?l:n.parentNode,v=a.opera&&o.call(a.opera)=="[object Opera]",w="webkitAppearance"in l.style,x=w&&"async"in b.createElement("script"),y=r?"object":v||x?"img":"script",z=w?"img":y,A=Array.isArray||function(a){return o.call(a)=="[object Array]"},B=function(a){return Object(a)===a},C=function(a){return typeof a=="string"},D=function(a){return o.call(a)=="[object Function]"},E=[],F={},G,H;H=function(a){function f(a){var b=a.split("!"),c=E.length,d=b.pop(),e=b.length,f={url:d,origUrl:d,prefixes:b},g,h;for(h=0;h<e;h++)g=F[b[h]],g&&(f=g(f));for(h=0;h<c;h++)f=E[h](f);return f}function e(a,b,e,g,h){var i=f(a),j=i.autoCallback;if(!i.bypass){b&&(b=D(b)?b:b[a]||b[g]||b[a.split("/").pop().split("?")[0]]);if(i.instead)return i.instead(a,b,e,g,h);e.load(i.url,i.forceCSS||!i.forceJS&&/css$/.test(i.url)?"c":c,i.noexec),(D(b)||D(j))&&e.load(function(){d(),b&&b(i.origUrl,h,g),j&&j(i.origUrl,h,g)})}}function b(a,b){function c(a){if(C(a))e(a,h,b,0,d);else if(B(a))for(i in a)a.hasOwnProperty(i)&&e(a[i],h,b,i,d)}var d=!!a.test,f=d?a.yep:a.nope,g=a.load||a.both,h=a.callback,i;c(f),c(g),a.complete&&b.load(a.complete)}var g,h,i=this.yepnope.loader;if(C(a))e(a,0,i,0);else if(A(a))for(g=0;g<a.length;g++)h=a[g],C(h)?e(h,0,i,0):A(h)?H(h):B(h)&&b(h,i);else B(a)&&b(a,i)},H.addPrefix=function(a,b){F[a]=b},H.addFilter=function(a){E.push(a)},H.errorTimeout=1e4,b.readyState==null&&b.addEventListener&&(b.readyState="loading",b.addEventListener("DOMContentLoaded",G=function(){b.removeEventListener("DOMContentLoaded",G,0),b.readyState="complete"},0)),a.yepnope=d()}(this,this.document),Modernizr.load=function(){yepnope.apply(window,[].slice.call(arguments,0))};

/* jQuery color 2011-07-19 from github */
(function(n,c){var i="backgroundColor borderBottomColor borderLeftColor borderRightColor borderTopColor color outlineColor".split(" "),f=/^([\-+])=\s*(\d+\.?\d*)/,e=[{re:/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(?:,\s*(\d+(?:\.\d+)?)\s*)?\)/,parse:function(o){return[o[1],o[2],o[3],o[4]]}},{re:/rgba?\(\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*(?:,\s*(\d+(?:\.\d+)?)\s*)?\)/,parse:function(o){return[2.55*o[1],2.55*o[2],2.55*o[3],o[4]]}},{re:/#([a-fA-F0-9]{2})([a-fA-F0-9]{2})([a-fA-F0-9]{2})/,parse:function(o){return[parseInt(o[1],16),parseInt(o[2],16),parseInt(o[3],16)]}},{re:/#([a-fA-F0-9])([a-fA-F0-9])([a-fA-F0-9])/,parse:function(o){return[parseInt(o[1]+o[1],16),parseInt(o[2]+o[2],16),parseInt(o[3]+o[3],16)]}},{re:/hsla?\(\s*(\d+(?:\.\d+)?)\s*,\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*(?:,\s*(\d+(?:\.\d+)?)\s*)?\)/,space:"hsla",parse:function(o){return[o[1],o[2]/100,o[3]/100,o[4]]}}],d=n.Color=function(p,q,o,r){return new n.Color.fn.parse(p,q,o,r)},h={rgba:{cache:"_rgba",props:{red:{idx:0,type:"byte",empty:true},green:{idx:1,type:"byte",empty:true},blue:{idx:2,type:"byte",empty:true},alpha:{idx:3,type:"percent",def:1}}},hsla:{cache:"_hsla",props:{hue:{idx:0,type:"degrees",empty:true},saturation:{idx:1,type:"percent",empty:true},lightness:{idx:2,type:"percent",empty:true}}}},m={"byte":{floor:true,min:0,max:255},percent:{min:0,max:1},degrees:{mod:360,floor:true}},k=h.rgba.props,l=d.support={},a,j=n.each;h.hsla.props.alpha=k.alpha;function g(q,s,p){var o=m[s.type]||{},r=s.empty||p;if(r&&q==null){return null}if(s.def&&q==null){return s.def}if(o.floor){q=~~q}else{q=parseFloat(q)}if(n.isNaN(q)){return s.def}if(o.mod){q=q%o.mod;return q<0?o.mod+q:q}return o.min>q?o.min:o.max<q?o.max:q}d.fn=d.prototype={constructor:d,parse:function(v,t,o,u){if(v===c){this._rgba=[null,null,null,null];return this}if(v instanceof n||v.nodeType){v=v instanceof n?v.css(t):n(v).css(t);t=c}var s=this,q=n.type(v),p=this._rgba=[],r;if(t!==c){v=[v,t,o,u];q="array"}if(q==="string"){v=v.toLowerCase();j(e,function(B,C){var A=C.re.exec(v),z=A&&C.parse(A),y,x=C.space||"rgba",w=h[x].cache;if(z){y=s[x](z);s[w]=y[w];p=s._rgba=y._rgba;return false}});if(p.length!==0){if(Math.max.apply(Math,p)===0){n.extend(p,a.transparent)}return this}v=a[v]||a._default;return this.parse(v)}if(q==="array"){j(k,function(w,x){p[x.idx]=g(v[x.idx],x)});return this}if(q==="object"){if(v instanceof d){j(h,function(w,x){if(v[x.cache]){s[x.cache]=v[x.cache].slice()}})}else{j(h,function(w,x){j(x.props,function(z,A){var y=x.cache;if(!s[y]&&x.to){if(v[z]==null||z==="alpha"){return}s[y]=x.to(s._rgba)}s[y][A.idx]=g(v[z],A,true)})})}return this}},is:function(q){var p=d(q),r=true,o=this;j(h,function(s,u){var t=p[u.cache],v;if(t){v=o[u.cache]||u.to&&u.to(o._rgba)||[];j(u.props,function(w,x){if(t[x.idx]!=null){r=(t[x.idx]==v[x.idx]);return r}})}return r});return r},_space:function(){var o=[],p=this;j(h,function(q,r){if(p[r.cache]){o.push(q)}});return o.pop()},transition:function(p,u){var q=d(p),r=q._space(),s=h[r],t=this[s.cache]||s.to(this._rgba),o=t.slice();q=q[s.cache];j(s.props,function(y,A){var x=A.idx,w=t[x],v=q[x],z=m[A.type]||{};if(v===null){return}if(w===null){o[x]=v}else{if(z.mod){if(v-w>z.mod/2){w+=z.mod}else{if(w-v>z.mod/2){w-=z.mod}}}o[A.idx]=g((v-w)*u+w,A)}});return this[r](o)},blend:function(r){if(this._rgba[3]===1){return this}var q=this._rgba.slice(),p=q.pop(),o=d(r)._rgba;return d(n.map(q,function(s,t){return(1-p)*o[t]+p*s}))},toRgbaString:function(){var p="rgba(",o=n.map(this._rgba,function(q,r){return q==null?(r>2?1:0):q});if(o[3]===1){o.pop();p="rgb("}return p+o.join(",")+")"},toHslaString:function(){var p="hsla(",o=n.map(this.hsla(),function(q,r){if(q==null){q=r>2?1:0}if(r&&r<3){q=Math.round(q*100)+"%"}return q});if(o[3]==1){o.pop();p="hsl("}return p+o.join(",")+")"},toHexString:function(o){var p=this._rgba.slice(),q=p.pop();if(o){p.push(~~(q*255))}return"#"+n.map(p,function(r,s){r=(r||0).toString(16);return r.length==1?"0"+r:r}).join("")},toString:function(){return this._rgba[3]===0?"transparent":this.toRgbaString()}};d.fn.parse.prototype=d.fn;function b(s,r,o){o=(o+1)%1;if(o*6<1){return s+(r-s)*6*o}if(o*2<1){return r}if(o*3<2){return s+(r-s)*((2/3)-o)*6}return s}h.hsla.to=function(q){if(q[0]==null||q[1]==null||q[2]==null){return[null,null,null,q[3]]}var o=q[0]/255,v=q[1]/255,w=q[2]/255,y=q[3],x=Math.max(o,v,w),t=Math.min(o,v,w),z=x-t,A=x+t,p=A*0.5,u,B;if(t===x){u=0}else{if(o===x){u=(60*(v-w)/z)+360}else{if(v===x){u=(60*(w-o)/z)+120}else{u=(60*(o-v)/z)+240}}}if(p===0||p===1){B=p}else{if(p<=0.5){B=z/A}else{B=z/(2-A)}}return[Math.round(u)%360,B,p,y==null?1:y]};h.hsla.from=function(u){if(u[0]==null||u[1]==null||u[2]==null){return[null,null,null,u[3]]}var x=u[0]/360,B=u[1],w=u[2],A=u[3],t=w<=0.5?w*(1+B):w+B-w*B,v=2*w-t,o,y,z;return[Math.round(b(v,t,x+(1/3))*255),Math.round(b(v,t,x)*255),Math.round(b(v,t,x-(1/3))*255),A]};j(h,function(p,r){var q=r.props,o=r.cache,t=r.to,s=r.from;d.fn[p]=function(y){if(t&&!this[o]){this[o]=t(this._rgba)}if(y===c){return this[o].slice()}var x=n.type(y),u=(x==="array"||x==="object")?y:arguments,w=this[o].slice(),v;j(q,function(z,B){var A=u[x==="object"?z:B.idx];if(A==null){A=w[B.idx]}w[B.idx]=g(A,B)});if(s){v=d(s(w));v[o]=w;return v}else{return d(w)}};j(q,function(u,v){if(d.fn[u]){return}d.fn[u]=function(z){var B=n.type(z),y=(u==="alpha"?(this._hsla?"hsla":"rgba"):p),x=this[y](),A=x[v.idx],w;if(B==="undefined"){return A}if(B==="function"){z=z.call(this,A);B=n.type(z)}if(z==null&&v.empty){return this}if(B==="string"){w=f.exec(z);if(w){z=A+parseFloat(w[2])*(w[1]==="+"?1:-1)}}x[v.idx]=z;return this[y](x)}})});j(i,function(o,p){n.cssHooks[p]={set:function(s,t){t=d(t);if(!l.rgba&&t._rgba[3]!==1){var q,r=p==="backgroundColor"?s.parentNode:s;do{q=n.curCSS(r,"backgroundColor")}while((q===""||q==="transparent")&&(r=r.parentNode)&&r.style);t=t.blend(q&&q!=="transparent"?q:"_default")}t=t.toRgbaString();s.style[p]=t}};n.fx.step[p]=function(q){if(!q.colorInit){q.start=d(q.elem,p);q.end=d(q.end);q.colorInit=true}n.cssHooks[p].set(q.elem,q.start.transition(q.end,q.pos))}});n(function(){var p=document.createElement("div"),o=p.style;o.cssText="background-color:rgba(1,1,1,.5)";l.rgba=o.backgroundColor.indexOf("rgba")>-1});a=n.Color.names={aqua:"#00ffff",azure:"#f0ffff",beige:"#f5f5dc",black:"#000000",blue:"#0000ff",brown:"#a52a2a",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgrey:"#a9a9a9",darkgreen:"#006400",darkkhaki:"#bdb76b",darkmagenta:"#8b008b",darkolivegreen:"#556b2f",darkorange:"#ff8c00",darkorchid:"#9932cc",darkred:"#8b0000",darksalmon:"#e9967a",darkviolet:"#9400d3",fuchsia:"#ff00ff",gold:"#ffd700",green:"#008000",indigo:"#4b0082",khaki:"#f0e68c",lightblue:"#add8e6",lightcyan:"#e0ffff",lightgreen:"#90ee90",lightgrey:"#d3d3d3",lightpink:"#ffb6c1",lightyellow:"#ffffe0",lime:"#00ff00",magenta:"#ff00ff",maroon:"#800000",navy:"#000080",olive:"#808000",orange:"#ffa500",pink:"#ffc0cb",purple:"#800080",violet:"#800080",red:"#ff0000",silver:"#c0c0c0",white:"#ffffff",yellow:"#ffff00",transparent:[null,null,null,0],_default:"#ffffff"}})(jQuery);



function stop(e) {
    if (!e) e = window.event;
    (e.stopPropagation) ? e.stopPropagation() : e.cancelBubble = true;
    (e.preventDefault) ? e.preventDefault() : e.returnValue = false;
    return false;
}

function prevDef(e) {
    if (!e) e = window.event;
    (e.preventDefault) ? e.preventDefault() : e.returnValue = false;
    return false;
}

function log(message) {
    if (typeof console != 'undefined' && typeof console.log != 'undefined') { console.log(message) }
};
function info(message) {
    if (typeof console != 'undefined' && typeof console.info != 'undefined') { console.info(message) }
};
function warn(message) {
    if (typeof console != 'undefined' && typeof console.warn != 'undefined') { console.warn(message) }
};

(function($, document, window) {

  $(function() {
    $("body").removeClass("noJs").addClass("activeJs");
    $('a.print').printButton();
    $("#toplinks-one #english").languagebox();
    initGA();
    if ($.isFunction(window.initSite)) {
      window.initSite(); //initialize the site-specific js functions
    }
    $(".colorbox").getColorboxOptions();
    $(".thickbox").thickboxToColorbox(); //Legacy - must be replaced at some point
    
    //init lightbox
    if ($.fn.colorbox) {
      $("a[rel='cboximages']").colorbox({
        slideshow: true,
        width: "75%",
        height: "75%",
        slideshowAuto: false,
        opacity: 0.8,
        photo: true
      });
    }
    
    $(".opendag-sticker > span > span").text(function(index, text) { return text.toUpperCase(); }); //Voor HUsans font-facing
    $(".testimonials").testimonialvideo();
    $(".hunavigator").navigator();
    
    $("#tabs").each(function() {
      var pages = $(), tabs = $();
      $(this).find("> ul > li > a[href^=#]").each(function() {
        var page = $(document.getElementById($(this).attr("href").replace(/^#/, "")));
        if (page.length) {
          $(this).data("page", page);
          pages = pages.add(page);
          tabs = tabs.add($(this).parent("li"));
        }
      }).click(function() {
        var page = $(this).data("page"), tab = $(this).parent("li");
        pages.not(page.show()).hide();
        tabs.not(tab.addClass("selected")).removeClass("selected");
        return false;
      }).first().click();
    });
    
    if ($('#wordlist-accordion').length) {  initWordlist(); }
    
    $(".T04 ul.node").each(function(i) {
      if (((i + 1) % 3) === 0) {
        $(this).addClass("node-last");
      }
    });
    
    $(".inputtext", "#research,#searchform,.search").placeholder();
  });
  
  //A snippet of easings being used
  $.easing.jswing = $.easing.swing;
  $.extend($.easing, {
    def: "easeOutQuad",
    swing: function(x, t, b, c, d) {
      return jQuery.easing[jQuery.easing.def](x, t, b, c, d);
    },
    easeOutQuad: function(x, t, b, c, d) {
      return -c * (t /= d) * (t - 2) + b;
    },
    easeOutExpo: function(x, t, b, c, d) {
      return (t == d) ? b + c : c * (-Math.pow(2, -10 * t / d) + 1) + b;
    }
  });
  
  $.fn.printButton = function() {
		return this.click(function() { 
      window.print();
      return false;
    });
	};

  $.fn.getColorboxOptions = function() {
    return this.each(function() {
      var link = $(this), options = { }, i, l, cl,
          inline = (/#(.*)$/.exec(link.attr("href")) || [])[1] || "",
          classes = link.attr("class").toLowerCase().split(/\s+/);
          
      for (i = 0, l = classes.length; i < l; i++) {
        cl = classes[i];
        if (cl.substr(0, 15) === "colorbox-width-") {
          options.innerWidth = parseInt(cl.substr(15), 10);
        }
        if (cl.substr(0, 16) === "colorbox-height-") {
          options.innerHeight = parseInt(cl.substr(16), 10);
        }
        if (cl === "colorbox-iframe") {
          options.iframe = true;
        }
      }
      
      if (!options.iframe && document.getElementById(inline)) {
        options.iframe = false;
        options.inline = true;
        options.href = "#" + inline;
      }
      else if (options.iframe) {
        options.innerWidth = options.innerWidth ? options.innerWidth + 50 : options.innerWidth;
        options.innerHeight = options.innerHeight ? options.innerHeight + 50 : options.innerHeight;
      }
      
      link.colorbox(options);
    });
  };
  
  //Wrapper-plugin om links die gemaakt zijn voor thickbox om te zetten in colorbox.
  $.fn.thickboxToColorbox = function() {
    var parseurl = function(url) {
      var i, l, part, result = { },
          parts = ((/\?(.*)$/.exec(String(url || "")) || [])[1] || "").split("&");
      for (i = 0, l = parts.length; i < l; i++) {
        part = parts[i].split("=");
        if (part && part.length) {
          if (result[part[0]]) {
            result[part[0]] = [ result[part[0]], part[1] ];
          }
          else {
            result[part[0]] = part[1];
          }
        }
      }
      return result;
    };
    
    return this.each(function() {
      var link = $(this), params = parseurl(link.attr("href")),
          inline = $.trim(params.inlineId),
          options = {
            innerWidth: parseInt($.trim(params.width), 10) || false,
            innerHeight: parseInt($.trim(params.height), 10) || false,
            iframe: !inline && $.trim(params.TB_iframe).toLowerCase() === "true"
          };
      if (inline) {
        options.inline = true;
        options.href = "#" + inline;
      }
      if (options.iframe) {
        options.innerWidth = options.innerWidth ? options.innerWidth + 50 : options.innerWidth;
        options.innerHeight = options.innerHeight ? options.innerHeight + 50 : options.innerHeight;
      }
      link.colorbox(options);
    });
  };

  $.fn.testimonialvideo = function() {
    var createVideoShower = function(allvideos) {
      var close = function(videos) {
        videos.filter(":visible").each(function() {
          var t = $(this),
              preview = t.data("preview"),
              size = t.data("normalsize");
          t.fadeOut(function() {
            preview
              .animate({ width: size.w + "px", height: size.h + "px" }, 500, "swing")
              .children()
              .fadeIn();
          });
        });
      };
      var show = function(videos) {
        return videos.each(function() {
          var t = $(this),
              preview = t.data("preview"),
              size = t.data("videosize");
          preview
            .children()
              .fadeOut()
              .end()
            .animate({ width: size.w + "px", height: size.h + "px" }, 500, "swing", function() {
              t.fadeIn();
            });
        });
      };
      
      return function(showvideo) {
        close(allvideos.not(show($(showvideo))));
      };
    };
    
    return this.each(function() {
      var allvideos = $(this).find("li:has(.playbutton) .video"),
          shower = createVideoShower(allvideos);
      $(this)
        .find(".playbutton")
          .each(function() {
            var t = $(this),
                video = t.closest("li").find(".video"),
                object = video.find("object"),
                preview = t.closest(".videopreview");
            video.data({
              preview: preview,
              videosize: { w: Number(object.attr("width")), h: Number(object.attr("height")) + parseInt(video.css("padding-bottom"), 10) + 3 },
              normalsize: { w: preview.width(), h: preview.height() }
            });
            t.click(function() {
              shower(video);
              $(this).blur();
              return false;
            });
          })
          .end()
        .find(".close").click(function() {
          shower(); //Show nothing and hide the rest (i.e. every video)
          return false;
        })
        .end()
      .find(".video")
      .hide();
    });
  };
  
  function initGA() { //Google Analytics
    //custom jquery filters 
    //based on http://neutroncreations.com/blog/how-to-track-traffic-exiting-your-site/

    //external links 
    var topdomain = ".hu."; //leave empty if your site doesn't use subdomains
    jQuery.expr[':'].external = function(obj) {
        if (topdomain != "") {
            return !obj.href.match(/^mailto:/) && !obj.href.match(/^javascript:/)
      && ((obj.hostname != document.location.hostname) && !(obj.hostname.indexOf(topdomain) > -1));
        }
        else {
            return !obj.href.match(/^mailto:/) && !obj.href.match(/^javascript:/)
      && (obj.hostname != document.location.hostname);
        }
    };

    //_trackEvent(category, action, opt_label, opt_value)
    jQuery('a:external').click(function() {
        if (typeof _gaq != 'undefined') {
            _gaq.push(['_trackEvent', 'Hyperlinks', 'Clicked ' + jQuery(this).attr('href'), 'External link']);
        }
        else {
            info("no tracking code found");
        }
    });
  }
  
  //init english site listing pop-up
  $.fn.languagebox = function() {
    var createSlider = function() {
      var down = false;
      return function() {
        $(this)[down ? "removeClass" : "addClass"]("down").next()[down ? "slideUp" : "slideDown"]();
        down = !down;
        return false;
      };
    };

    this.each(function() {
      $(this).click(createSlider());
    });
  };
  
  $.fn.navigator = function() {
    var truthystring = function(s, _default) {
      if (typeof s === "boolean") {
        return s;
      }
      if (typeof s === "number") {
        return s > 0;
      }
      if (typeof s === "string") {
        var result = false;
        result = $.inArray($.trim(s).toLowerCase(), [ "true", "on", "yes" ]) >= 0;
        if (!result) {
          result = truthystring(parseInt(s, 10));
        }
        return result;
      }
      return _default || false;
    };
    
    var navigator = this,                                         //The navigtor object, the main container for everything
        visiblemenus = $(),                                       //The menus that are visible, in order of appearance
        bannerwidth = this.width() + 4,                           //Width of the banner that is visible when no menus are visible
        movebackby = $("> .hunavigator-menu", this).width() + 20, //The number of pixels to move everything back when more than 2 menus become visible
        movedback = 0,                                            //The number of menus that have been moved back
        automode = truthystring(this.data("auto"), false),        //Whether or not the navigator should open when the page has loaded
        autoclose = truthystring(this.data("autoclose"), true),   //Whether or not the navigator should open when the page has loaded
        startat = String(this.data("start") || "").toLowerCase(), //What the first menu should be, otherwise it will be the root menu
        autotimer = 0;
    
    //Initialize the startat variable and see if its reference exists
    if (startat.length > 0) {
      if (startat.substr(0, 1) !== "{") { startat = "{" + startat; }
      if (startat.substr(startat.length - 1, 1) !== "}") { startat += "}"; }
      startat = navigator
        .find("> .hunavigator-menu > ul > li > a")
        .filter(function() {
          var href = String($(this).attr("href") || "").toLowerCase();
          return href.substr(href.length - startat.length, startat.length) === startat;
        })
        .first();
    }
    else {
      startat = $();
    }
    
    //Initialize the detail template from a HTML comment (so don't delete that!)
    var template = this.contents().filter(function() { return this.nodeType === 8 && String(this.nodeValue).indexOf("##TEMPLATE##") >= 0; });
    if (template.length) {
      template = $($.trim(String(template.get(0).nodeValue || "").replace("##TEMPLATE##", "")));
    }
    
    //Clear the autotimer, to prevent the navigator from closing automatically
    var clearAutotimer = function() {
      if (autotimer !== 0) {
        window.clearTimeout(autotimer);
        autotimer = 0;
      }
    };
    
    //Convert newlines to linebreaks. Returns a jQuery set of text nodes and <br> elements.
    var splittext = function(s) {
      var parts = s.split(/\n\r|\r\n|\r|\n/g), i, l, result = $();
      for (i = 0, l = parts.length; i < l; i++) {
        if (i > 0) {
          result = result.add($("<br/>"));
        }
        result = result.add(document.createTextNode(parts[i]));
      }
      return result;
    };
    
    //For some reason, changing a link's href-attribute prevents it from being clickable
    var linkclicker = function() {
      document.location.href = this.href;
      return false;
    };
    
    //Puts values into the template initialized above. Clone it before using it or you will screw everything over. The values argument is a name/value object.
    var templatefiller = function(template, values, iserror) {
      if (!$.isArray(values.varianten)) {
        values.varianten = $.trim(values.varianten || "");
        if (values.varianten) {
          values.varianten = values.varianten.split("|");
        }
      }
      values.varianten = $.isArray(values.varianten) ? $($.map(values.varianten, function(val, i) { return $("<li/>", { text: val }).get(0); })) : $();
      template
        .find(".variations")
          .empty()
          .append(values.varianten)
          .end()
        .find(".hunavigator-detail-moreinfo")
          .attr("href", values["detail-url"] || "#")
          .click(linkclicker)
          .end()
        .find("img")
          .attr("src", values["image-url"] || "")
          .end()
        .find("h2, h3, .hunavigator-detail-block p, .hunavigator-detail-moreinfo span")
          .each(function() {
            var text = $(this).text().replace(/\{(.+?)\}/g, function($0, $1) { return values[$1] || ""; });
            $(this).empty().append(splittext(text));
          });
      template.find(".variations").each(function() {
        if ($.trim($(this).text()) === "") {
          $(this).parent().remove();
        }
      });
      if (iserror) {
        $(".hunavigator-detail-moreinfo, img", template).remove();
        $(".hunavigator-detail-blocks p:last", template).append(
          $("<br/>"),
          $("<br/>"),
          $("<a/>", { 
            href: "#",
            text: "Opnieuw proberen",
            click: function() {
              template.prev("a").click();
              return false;
            }
          })
        );
      }
    };
    
    //This is used to put the menus into their initial state (which is hidden).
    var initmenu = function() {
      var level = $(this).parents(".hunavigator-menu").length,
          hiddenmargin = -(level + 1) * movebackby - 10;
      return $(this)
        .data({ "hidden-margin": hiddenmargin, level: level })
        .css("margin-left", hiddenmargin);
    };
    
    //This is used to add elements to buttons to make them appear as an arrow. It's CSS-magic, so see the styles for more goodness.
    var initdiagonals = (function() {
      //I chose the <i> element here, because it usually doesn't have any style applied other than italic font, plus it has no semantic meaning. Perfect.
      var diagonals = "<i class=\"diagonal diagonal-1\"/><i class=\"diagonal diagonal-2\"/>";
      return function() {
        $(this).each(function() {
          var t = $(this), position = $.trim(t.css("position")).toLowerCase();
          if (position !== "static") {
            t.append(diagonals);
          }
        });
      };
    }());
    
    //Fallback for CSS-transitions. Note that this is not a generic polyfill - this is specific to the elements it applies to.
    var inittransitions = !window.Modernizr || window.Modernizr.csstransitions ? function() { } : function() {
      var colorsfrom = { border: "#bd1c17", background: "#d72019" },
          colorsto = { border: "#007eb0", background: "#00a4e3" },
          propsfrom = { "background-color": colorsfrom.background, "border-top-color": colorsfrom.border, "border-right-color": colorsfrom.border, "border-bottom-color": colorsfrom.border, "border-left-color": colorsfrom.border },
          propsto = { "background-color": colorsto.background, "border-top-color": colorsto.border, "border-right-color": colorsto.border, "border-bottom-color": colorsto.border, "border-left-color": colorsto.border };
      var menuhover = function(e) { 
        $(this).stop().animate(e.type === "mouseleave" ? propsfrom : propsto, e.type === "mouseleave" ? 1000 : 0, "swing");
      };
      var moreinfohover = function(e) {
        $(this).stop().animate(e.type === "mouseleave" ? propsfrom : propsto, 300, "swing");
      };
      $(this).each(function() {
        $(this).hover($(this).hasClass("hunavigator-detail-moreinfo") ? moreinfohover : menuhover);
      });
    };
    
    //Moves back the navigator to display 2 menus at most. Or supply the force argument to forcibly move back by that many menus.
    var performmoveback = function(force, instant) {
      var deepestlevel = visiblemenus.last().data("level") + 1; //First menu is level 1
      if (force || deepestlevel - movedback > 2 || movedback > 0 && deepestlevel - movedback < 2) {
        movedback = Number(force) || Math.max(0, deepestlevel - 2);
        visiblemenus.first()[instant ? "notanimate" : "animate"]({ "margin-left": bannerwidth - movedback * movebackby }, 500, "swing");
      }
    };
    
    //Closes the navigator and resets the whole tree to its initial state.
    var performclose = function(e, data) {
      var after = function() {
        //After animation, reset everything
        $(".hunavigator-menu", navigator).each(function() {
          var menu = $(this);
          menu.css("margin-left", menu.data("hidden-margin"));
        });
        navigator[instant ? "notanimate" : "animate"]({ "margin-left": 0 }, 500, "swing");
        visiblemenus.filter(".hunavigator-menu-detail").children().remove();
        visiblemenus.find("> ul > li > a").removeClass("selected");
        visiblemenus = $();
        navigator.trigger("afterclose");
      };
      //Animate everything back to initial state
      var programmatic = data && data.programmatic === true,
          instant = data && data.instant === true;
      if (!programmatic) {
        clearAutotimer();
      }
      visiblemenus
        .each(function(i) {
          var menu = $(this), pos = i === 0 ? menu.data("hidden-margin") + bannerwidth : -menu.width() - 20;
          menu[instant ? "notanimate" : "animate"]({ "margin-left": pos }, 500, "swing", i === visiblemenus.length - 1 ? after : null);
        });
      movedback = 0;
    };
    
    //Closes one level of menus. If the topmost level of menus is closed, it redirects to performclose(), because that would be same.
    //Also, don't call this function directly. This function returns a function that does all the work, but doesn't do anything by itself (because it needs to create a closure).
    var createperformback = function(level) {
      return function(e, data) {
        var after = function(hide) {
          return function() {
            hide.filter(".hunavigator-menu-detail").children().remove();
            hide.find("> ul > li > a").removeClass("selected");
          };
        };
        
        var programmatic = data && data.programmatic === true,
            instant = data && data.instant === true;
        if (!programmatic) {
          clearAutotimer();
        }
        if (level === 0) {
          //Clicked the back button on the first menu, this is the same as a close
          performclose(null, data);
        }
        else {
          var menustohide = visiblemenus.filter(function() { return $(this).data("level") >= level; });
          menustohide
            .each(function(i) {
              var menu = $(this), pos = menu.data("hidden-margin");
              menu[instant ? "notanimate" : "animate"]({ "margin-left": pos }, 500, "swing", i === menustohide.length - 1 ? after(menustohide) : null);
            })
            .parent()
              .children("a")
                .removeClass("selected");
          visiblemenus = visiblemenus.not(menustohide);
          performmoveback(0, instant);
        }
      };
    };
    
    //Controls behavior of clicking the banner that is visible when no menus are visible. It shows the first menu (or whatever the startat variable is) and hides the banner.
    //Also, don't call this function directly. This function returns a function that does all the work, but doesn't do anything by itself (because it needs to create a closure).
    var firstmenuclick = function(menu) {
      return function(e, data) {
        var t = $(this),
            isbanner = !$(e.target).closest(".hunavigator-menu").length,
            programmatic = data && data.programmatic === true,
            instant = data && data.instant === true,
            bannerwidth, menuwidth;
        if (isbanner) {
          //Clicked on the actual banner, not on any of its child menus
          if (!programmatic) {
            clearAutotimer();
          }
          bannerwidth = t.width() + 4;
          menuwidth = menu.width();
          t[instant ? "notanimate" : "animate"]({ "margin-left": -bannerwidth }, 500, "swing", function() {
            visiblemenus = visiblemenus.add(menu);
            if (startat.length) {
              performmoveback(1);
              startat.trigger("click", { force: 1, programmatic: true });
            }
            else {
              menu
                .data("visible", true)
                .css("margin-left", -menuwidth)
                .find("> ul > li > a").removeClass("selected");
              menu[instant ? "notanimate" : "animate"]({ "margin-left": bannerwidth }, 500, "swing")
            }
          });
        }
        return false;
      };
    };
    
    //Here be the main work horse. This is what happens when you click an item. Either it just opens the next menu, or it loads new data via AJAX into a clone of the detail template.
    $(".hunavigator-menu li > a", this).click(function(e, data) {
      var allitems = $(this).closest("ul").find("> li > .hunavigator-menu"),
          currentitem = $(this).parent().children(".hunavigator-menu"),
          otheritems = allitems.not(currentitem),
          programmatic = data && data.programmatic === true,
          instant = data && data.instant === true,
          href = $(this).attr("href"), pre, post;
      
      if (!programmatic) {
        clearAutotimer();
      }
      if (href.substr(0, 1) !== "#") {
        pre = function() {
          if (currentitem.length) {
            visiblemenus = visiblemenus.not(currentitem.remove());
          }
          $(this).parent().append(currentitem = template.clone(true));
          initmenu.call(currentitem).addClass("hunavigator-menu-detail-loading").children().hide();
        };
        post = function() {
          $.ajax({
            cache: true,
            dataType: "xml",
            ifModified: true,
            timeout: 5000,
            url: href,
            error: function(xhr, status, error) {
              var errors = {
                "parsererror": "Er zijn foutieve of verminkte gegevens van de website ontvangen, waardoor dit niet kan worden weergegeven. Waarschijnlijk is er een tijdelijk probleem met de website. Probeer het later nog eens.",
                "timeout": "Het opvragen van de gegevens van de website duurde te lang, en is daarom uit voorzorg afgebroken. Wellicht is er een tijdelijk probleem met de website. Probeer het later nog eens.",
                "abort": "Het opvragen van de gegevens van de website is onverwacht of door een onbekende oorzaak afgebroken. Mogelijk is er een probleem met uw verbinding of browser. U kunt het nogmaals proberen, maar als dit probleem zich blijft voordoen, overweegt u dan een andere browser te proberen.",
                "404": "De benodogde gegevens konden niet gevonden worden. Wellicht is er een tijdelijk probleem met de website waardoor er delen niet of nog niet online staan. Probeer het later nog eens.",
                "500": "Het opvragen van de benodigde gegevens is mislukt door een fout op de server. Dit kan een tijdelijk probleem zijn, maar is het momenteel onbekend wat het probleem precies is. Probeer het later nog eens.",
                "0": "Het adres dat geprobeerd is om op te vragen, wordt niet toegelaten om hier te tonen. Dit kan een tijdelijk probleem zijn, maar is het momenteel onbekend waarom dit precies gebeurt. Probeer het later nog eens."
              }
              var values = {
                "titel": "Probleem bij laden",
                "naam-thema-label": "Foutnaam",
                "naam-thema": status === "error" ? (xhr.status === 0 ? "forbidden" : xhr.status + " " + error) : status,
                "omschrijving-label": "Beschrijving",
                "omschrijving": errors[status === "error" ? xhr.status : status]
              }
              templatefiller(currentitem, values, true);
              currentitem.removeClass("hunavigator-menu-detail-loading").children().fadeIn(200);
            },
            success: function(data, status, xhr) {
              var values = { };
              $("data > *", data).each(function() {
                switch (this.nodeName) {
                  case "title":            values["titel"]                    = this.textContent || this.text; break;
                  case "image":            values["image-url"]                = this.textContent || this.text; break;
                  case "themelabel":       values["naam-thema-label"]         = this.textContent || this.text; break;
                  case "themevalue":       values["naam-thema"]               = this.textContent || this.text; break;
                  case "attentionlabel":   values["aandachtsgebieden-label"]  = this.textContent || this.text; break;
                  case "attentionvalue":   values["aandachtsgebieden"]        = this.textContent || this.text; break;
                  case "perspectivelabel": values["beroepsperspectief-label"] = this.textContent || this.text; break;
                  case "perspectivevalue": values["beroepsperspectief"]       = this.textContent || this.text; break;
                  case "variationslabel":  values["varianten-label"]          = this.textContent || this.text; break;
                  case "variationsvalue":  values["varianten"]                = this.textContent || this.text; break;
                  case "descriptionlabel": values["omschrijving-label"]       = this.textContent || this.text; break;
                  case "descriptionvalue": values["omschrijving"]             = this.textContent || this.text; break;
                  case "url":              values["detail-url"]               = this.textContent || this.text; break;
                }
              });
              templatefiller(currentitem, values);
              initdiagonals.call($(".hunavigator-detail-moreinfo", currentitem));
              inittransitions.call($(".hunavigator-detail-moreinfo", currentitem));
              currentitem.removeClass("hunavigator-menu-detail-loading").children().fadeIn(200);
            }
          });            
        };
      }
      
      var showingmenus = visiblemenus.filter(allitems),
          force = (data || {}).force,
          instant = (data || {}).instant;
      if (showingmenus.length) {
        
        //Is a next-level menu already showing? Then replace that instantly
        if ($.isFunction(pre)) {
          pre.call(this);
        }
        visiblemenus = visiblemenus.not(otheritems);
        otheritems
          .each(function() {
            var otheritem = $(this);
            otheritem
              .data("visible", false)
              .css("margin-left", otheritem.data("hidden-margin"));
          })
          .parent()
            .children("a")
              .add(otheritems.find("> ul > li > a"))
              .removeClass("selected");
        
        visiblemenus = visiblemenus.add(currentitem);
        currentitem
          .data("visible", true)
          .css("margin-left", 0)
          .find("> ul > li > a")
            .removeClass("selected")
            .end()
          .parent()
            .children("a")
              .addClass("selected");
        if ($.isFunction(post)) {
          post();
        }
      }
      else {
        
        //Otherwise do a fancy animation
        if ($.isFunction(pre)) {
          pre.call(this);
        }
        visiblemenus = visiblemenus.add(currentitem);
        currentitem.data("visible", true);
        performmoveback(force, instant);
        currentitem.parent().children("a").addClass("selected");
        currentitem[instant ? "notanimate" : "animate"]({ "margin-left": 0 }, 500, "swing", post);
      }
      
      return false;
    });
    
    //Initial state
    initdiagonals.call($(".hunavigator-menu li > a", this));
    inittransitions.call($(".hunavigator-menu li > a", this)); 
    this.show();
    $(".hunavigator-menu", this)
      .data("visible", false)
      .each(initmenu);
    
    //Button events
    this.click(firstmenuclick(this.children(".hunavigator-menu")));
    $(".hunavigator-nav-close", this).click(performclose);
    $(".hunavigator-nav-back", this).each(function() {
      var t = $(this), level = t.closest(".hunavigator-menu").data("level");
      t.click(createperformback(level));
    });
    
    var opendetail = function(detail, link) {
      link = $(link);
      if (detail) {
        if (link.length === 0) {
          link = navigator.find(".hunavigator-menu-deepest li a").filter(function() { return String(this.attr).toLowerCase().indexOf("detailid=" + detail) >= 0; }).first();
        }
        var openmenu = function() {
          var recursed = $(), current = link;
          while (current.length > 0) {
            recursed = recursed.add(current);
            current = current.closest(".hunavigator-menu").prev("a");
          }
          recursed
            .add(navigator)
            .trigger("click", { programmatic: true, instant: true });
        };
        
        if (visiblemenus.length > 0) {
          navigator.one("afterclose", openmenu);
          performclose(null, { programmatic: true, instant: true });
        }
        else {
          openmenu();
        }
      }
    };   
    
    //Automode
    if (automode) {
      $(window).load(function() {
        if (!visiblemenus.length) {
          navigator.trigger("click", { programmatic: true });
          
          if (autoclose) {
            autotimer = window.setTimeout(function() {
              performclose({ data: { programmatic: true } });
            }, 5000);
          }
        }
      });
    }
    
    //Rel-links
    var detaillinks = { }, menulinks = { }, finddetail = /detailid=(\{[0-9a-f-]+\})/i, findmenu = /#(\{[0-9a-f-]+\}_{[0-9a-f-]+\})/i;
    
    var rellinkclick = function(detail) {
      return function() {
        var link = detaillinks[detail];
        if (link) {
          opendetail(detail, link);
        }
        else {
          link = menulinks[detail];
          if (link) {
            opendetail(detail, link);
          }
        }
      };
    };
    
    navigator.find(".hunavigator-menu-deepest")
      .find("li a").each(function() {
        var detail = $.trim((finddetail.exec(this.href) || [])[1] || "").toLowerCase();
        if (detail) {
          detaillinks[detail] = this;
        }
      })
      .end()
      .prev("a").each(function() {
        var detail = $.trim((findmenu.exec(this.href) || [])[1] || "").toLowerCase();
        if (detail) {
          menulinks[detail] = this;
        }
      });
      
    $("a[rel]").each(function() {
      var a = $(this), detail = $.trim(a.attr("rel")).toLowerCase();
      if (detail in detaillinks || detail in menulinks) {
        a.click(rellinkclick(detail));
      }
    });
  };
  
  $.fn.notanimate = function(properties) {
    var i, l, arg, complete;
    for (i = 1, l = arguments.length; i < l; i++) {
      arg = arguments[i];
      if ($.isFunction(arg)) {
        complete = arg;
      }
      else if ($.isPlainObject(arg) && $.isFunction(arg.complete)) {
        complete = arg.complete;
      }
    }
    this.css(properties);
    if ($.isFunction(complete)) {
      complete.call(this);
    }
    return this;
  };

//photoGallery 
function initPhotoGallery() {
	
	// this function calls the PhotoGallery.ascx handler
	// the handler returns a string containing all the image URL's from the gallery
	// the URL's in the string are seperated by character ||
	// this function splits the URL's in the string, and generates and appends a new anchor element for each URL that isn't already present in the DOM
	// finally the colorbox is attached to both the existing anchors as the dynamically added anchors

	//pickup page id 
	var pageId = jQuery(".ctrPhotogallery").attr("rel");

	//call the handler and split the URL string
	jQuery.ajax({
		url: '/handlers/hu-global/photogallery.ashx?id='+pageId+'',
		success: function(data) {
			var hiddenImages = data.split("||");
			appendImages(hiddenImages);
		}
	});

	function appendImages(theimages) {
		
		//append images
		jQuery(theimages).each(function(){
			if (!jQuery("a[href='"+"/"+this.valueOf()+"']").length) {
				jQuery(".ctrPhotogallery").append(
					jQuery(document.createElement('a')).attr('href',this.valueOf()).attr('rel','cboximages')
				)
			}
		});
		
		//attach colorbox
		jQuery("a[rel='cboximages']").colorbox({
			slideshow:true,
			width:"75%",
			height:"75%",
			slideshowAuto:false,
			opacity:".8",
      photo: true
		});
	}
	
}
  
function initWordlist() {
   var targetAcc = jQuery('#wordlist-accordion');

   jQuery("li", targetAcc).css('height', "16px");

   //$("li",targetAcc).css('height',"16px");
   //$("a.open", targetAcc).attr('href', 'javascript:void(0);').bind("click", function (e) {

   jQuery("a.open", targetAcc).attr('href', 'javascript:void(0);').bind("click", function (e) {
       if (jQuery(this).parent().hasClass("opened")) {
           jQuery(this).text("+").parent().removeClass("opened").stop().animate({ height: "16px" }, 350);
           return false;
       }


       jQuery(this).text("-").parent().addClass("opened").stop().animate({ height: jQuery(this).next().outerHeight() }, 350);
   })        
		
	}  
  
$.fn.placeholder = function() {
  //helper function to check if browser supports placeholder attribute
  var phsupported = function() {
    var el = document.createElement('input');
    var supported = 'placeholder' in el;
    $(el).remove();
    return supported;
  };
    
  //abort function if placeholder attribute is already supported by browser
  if (phsupported()) {
    return this;
  }
  
  var createFocus = function(placeholder) {
    return function() {
      if (this.value === placeholder) {
        this.value = "";
      }
    };
  };
  var createBlur = function(placeholder) {
    return function() {
      if (this.value === "" && placeholder) {
        this.value = placeholder;
      }
    };
  };
  
  return this.each(function() {
    var input = $(this), placeholder = input.attr("placeholder");
    input
      .bind("focus", createFocus(placeholder))
      .bind("blur", createBlur(placeholder))
      .trigger("blur");
  });
};
  
  
  
  
  
}(this.jQuery.noConflict(), this.document, this));

