// BEWARE: blocking this file with adblock, noscript or other software will render the website useless

// check for alerts and show them for 15 seconds, disable on click
$(document).ready(function(){
var $alert = $('#alert'); if($alert.length) { 
$alert.focus(); $alert.fadeIn("slow");
var alerttimer = window.setTimeout(function () { $alert.trigger('click'); }, 15000); 
$alert.show().click(function () { window.clearTimeout(alerttimer); $("#alert").fadeOut("slow", function() { $(this).remove(); }); }); 
}
});


// function to check for adblock software
function checkblock() {
if ($(".ads").height() == "0") {
$('#warningblock').removeClass('hidejs');
$("#jobcontactwarn").removeClass('hidejs');
$("#jobcontact").remove();
}
}


// auto link urls and mails
$.fn.autolink = function () {
return this.each( function(){ 
var re = /((http|https|ftp):\/\/[\w?=&.\/-;#~%-]+(?![\w\s?&.\/;#~%"=-]*>))/g; 
$(this).html( $(this).html().replace(re, '<a target="_blank" href="$1">$1</a> ') );
var re = /(([a-z0-9*._+]){1,}\@(([a-z0-9]+[-]?){1,}[a-z0-9]+\.){1,}([a-z]{2,4}|museum)(?![\w\s?&.\/;#~%"=-]*>))/g;
$(this).html( $(this).html().replace( re, '<a href="mailto:$1">$1</a>') );  
}); 
}


/* minified plugins below */

// base 64 encoding and decoding: https://github.com/carlo/jquery-base64
"use strict";jQuery.base64=(function($){var _PADCHAR="=",_ALPHA="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",_VERSION="1.0";function _getbyte64(s,i){var idx=_ALPHA.indexOf(s.charAt(i));if(idx===-1){throw"Cannot decode base64"}return idx}function _decode(s){var pads=0,i,b10,imax=s.length,x=[];s=String(s);if(imax===0){return s}if(imax%4!==0){throw"Cannot decode base64"}if(s.charAt(imax-1)===_PADCHAR){pads=1;if(s.charAt(imax-2)===_PADCHAR){pads=2}imax-=4}for(i=0;i<imax;i+=4){b10=(_getbyte64(s,i)<<18)|(_getbyte64(s,i+1)<<12)|(_getbyte64(s,i+2)<<6)|_getbyte64(s,i+3);x.push(String.fromCharCode(b10>>16,(b10>>8)&255,b10&255))}switch(pads){case 1:b10=(_getbyte64(s,i)<<18)|(_getbyte64(s,i+1)<<12)|(_getbyte64(s,i+2)<<6);x.push(String.fromCharCode(b10>>16,(b10>>8)&255));break;case 2:b10=(_getbyte64(s,i)<<18)|(_getbyte64(s,i+1)<<12);x.push(String.fromCharCode(b10>>16));break}return x.join("")}function _getbyte(s,i){var x=s.charCodeAt(i);if(x>255){throw"INVALID_CHARACTER_ERR: DOM Exception 5"}return x}function _encode(s){if(arguments.length!==1){throw"SyntaxError: exactly one argument required"}s=String(s);var i,b10,x=[],imax=s.length-s.length%3;if(s.length===0){return s}for(i=0;i<imax;i+=3){b10=(_getbyte(s,i)<<16)|(_getbyte(s,i+1)<<8)|_getbyte(s,i+2);x.push(_ALPHA.charAt(b10>>18));x.push(_ALPHA.charAt((b10>>12)&63));x.push(_ALPHA.charAt((b10>>6)&63));x.push(_ALPHA.charAt(b10&63))}switch(s.length-imax){case 1:b10=_getbyte(s,i)<<16;x.push(_ALPHA.charAt(b10>>18)+_ALPHA.charAt((b10>>12)&63)+_PADCHAR+_PADCHAR);break;case 2:b10=(_getbyte(s,i)<<16)|(_getbyte(s,i+1)<<8);x.push(_ALPHA.charAt(b10>>18)+_ALPHA.charAt((b10>>12)&63)+_ALPHA.charAt((b10>>6)&63)+_PADCHAR);break}return x.join("")}return{decode:_decode,encode:_encode,VERSION:_VERSION}}(jQuery));


// minified collapsible plugin: http://blog.ramin-hossaini.com/2010/04/27/jquery-collapsible-plugin/
jQuery.collapsible=function(selector,identifier){$(selector).click(function(){$(this).next().slideToggle('fast',function(){if($(this).is(":hidden")){$.cookie($(this).prev().attr("id"),'hide');$(this).prev().children(".placeholder").removeClass("collapse").addClass("expand")}else{$.cookie($(this).prev().attr("id"),'show');$(this).prev().children(".placeholder").removeClass("expand").addClass("collapse")}});return false}).next();$(selector).hover(function(){$(this).css("cursor","pointer")});var idval=0;$.each($(selector),function(){$($(this)).attr("id","module_"+identifier+idval);if(!$($(this)).hasClass("collapsed")){$("#"+$(this).attr("id")).append("<span class='placeholder collapse'></span>")}else if($($(this)).hasClass("collapsed")){$("#"+$(this).attr("id")).append("<span class='placeholder expand'></span>")}if($($(this)).hasClass("collapsed")){$("#"+$(this).attr("id")).next().hide();$("#"+$(this).attr("id")).children("span").removeClass("collapse").addClass("expand")}else{$("#"+$(this).attr("id")).children("span").removeClass("expand").addClass("collapse")}if($.cookie($(this).attr("id"))=='hide'){$("#"+$(this).attr("id")).next().hide();$("#"+$(this).attr("id")).children("span").removeClass("collapse").addClass("expand")}else if($.cookie($(this).attr("id"))=='show'){$("#"+$(this).attr("id")).next().show();$("#"+$(this).attr("id")).children(".placeholder").removeClass("expand").addClass("collapse")}idval++})};


// minified chained select boxes plugin
(function($){$.fn.chained=function(parent_selector,options){return this.each(function(){var self=this;var backup=$(self).clone();$(parent_selector).each(function(){$(this).bind("change",function(){$(self).html(backup.html());var selected="";$(parent_selector).each(function(){selected+="\\"+$(":selected",this).val();});selected=selected.substr(1);var first=$(parent_selector).first();var selected_first=$(":selected",first).val();$("option",self).each(function(){if(!$(this).hasClass(selected)&&!$(this).hasClass(selected_first)&&$(this).val()!==""){$(this).remove();}});if(1==$("option",self).size()&&$(self).val()===""){$(self).attr("disabled","disabled");}else{$(self).removeAttr("disabled");}
$(self).trigger("change");});if(!$("option:selected",this).length){$("option",this).first().attr("selected","selected");}
$(this).trigger("change");});});};$.fn.chainedTo=$.fn.chained;})(jQuery);


// minified Simple modal dialog plugin
function ModalDialog(boxSpec){var OVERLAY_ELEMENT_ID="s--modalbox-overlay";var OVERLAY_Z_INDEX=20;var OVERLAY_OPACITY=0.5;var _boxSpec=boxSpec;function getViewport(){return{x:window.pageXOffset||document.documentElement&&document.documentElement.scrollLeft||document.body.scrollLeft,y:window.pageYOffset||document.documentElement&&document.documentElement.scrollTop||document.body.scrollTop,w:window.innerWidth||document.documentElement&&document.documentElement.clientWidth||document.body.clientWidth,h:window.innerHeight||document.documentElement&&document.documentElement.clientHeight||document.body.clientHeight}};var styleStr="top: 0; left: 0; z-index: "+OVERLAY_Z_INDEX+"; display: none;background-color: #000;";var vp=getViewport();var overlayHTML=null;var sizeSpec="width: 100%; height: 100%;";if(jQuery.browser.msie&&(jQuery.browser.version<7)){sizeSpec="width:"+(vp.x+vp.w)+"px;height:"+Math.max(vp.y+vp.h,jQuery(document.body).height())+"px;";styleStr+="filter: alpha(opacity="+((100*OVERLAY_OPACITY))+");position: absolute;"+sizeSpec;overlayHTML="<iframe  id='"+OVERLAY_ELEMENT_ID+"' style='"+styleStr+"'></iframe>"}else{styleStr+="position:fixed; opacity: "+OVERLAY_OPACITY+";"+sizeSpec;overlayHTML="<div src='javascript:false' id='"+OVERLAY_ELEMENT_ID+"' style='"+styleStr+"'></div>"}jQuery("body").append(overlayHTML);var overlayElt=jQuery("#"+OVERLAY_ELEMENT_ID);if(jQuery.browser.msie&&(jQuery.browser.version<7)){var eltDoc=document.getElementById(OVERLAY_ELEMENT_ID).contentWindow.document;eltDoc.open();eltDoc.write("<html><body style='background-color: black; filter:alpha(opacity="+(100*OVERLAY_OPACITY)+");'></body></html>");eltDoc.close()}this.show=function(){var vp=getViewport();overlayElt.css({display:"block"});var box=$(_boxSpec);box.css({display:"block",zIndex:OVERLAY_Z_INDEX+1,top:(vp.y+(vp.h-box.height())/2)+"px",left:(vp.x+(vp.w-box.width())/2)+"px"})};this.hide=function(){overlayElt.css({display:"none"});$(_boxSpec).css({display:"none"})}};


// minified cookie plugin
jQuery.cookie=function(name,value,options){if(typeof value!='undefined'){options=options||{};if(value===null){value='';options.expires=-1}var expires='';if(options.expires&&(typeof options.expires=='number'||options.expires.toUTCString)){var date;if(typeof options.expires=='number'){date=new Date();date.setTime(date.getTime()+(options.expires*24*60*60*1000))}else{date=options.expires}expires='; expires='+date.toUTCString()}var path=options.path?'; path='+(options.path):'';var domain=options.domain?'; domain='+(options.domain):'';var secure=options.secure?'; secure':'';document.cookie=[name,'=',encodeURIComponent(value),expires,path,domain,secure].join('')}else{var cookieValue=null;if(document.cookie&&document.cookie!=''){var cookies=document.cookie.split(';');for(var i=0;i<cookies.length;i++){var cookie=jQuery.trim(cookies[i]);if(cookie.substring(0,name.length+1)==(name+'=')){cookieValue=decodeURIComponent(cookie.substring(name.length+1));break}}}return cookieValue}};
