jQuery.fn.extend({everyTime:function(b,c,d,e,a){return this.each(function(){jQuery.timer.add(this,b,c,d,e,a)})},oneTime:function(a,b,c){return this.each(function(){jQuery.timer.add(this,a,b,c,1)})},stopTime:function(a,b){return this.each(function(){jQuery.timer.remove(this,a,b)})}});jQuery.extend({timer:{guid:1,global:{},regex:/^([0-9]+)\s*(.*s)?$/,powers:{ms:1,cs:10,ds:100,s:1000,das:10000,hs:100000,ks:1000000},timeParse:function(c){if(c==undefined||c==null){return null}var a=this.regex.exec(jQuery.trim(c.toString()));if(a[2]){var b=parseInt(a[1],10);var d=this.powers[a[2]]||1;return b*d}else{return c}},add:function(e,c,d,g,h,b){var a=0;if(jQuery.isFunction(d)){if(!h){h=g}g=d;d=c}c=jQuery.timer.timeParse(c);if(typeof c!="number"||isNaN(c)||c<=0){return}if(h&&h.constructor!=Number){b=!!h;h=0}h=h||0;b=b||false;if(!e.$timers){e.$timers={}}if(!e.$timers[d]){e.$timers[d]={}}g.$timerID=g.$timerID||this.guid++;var f=function(){if(b&&this.inProgress){return}this.inProgress=true;if((++a>h&&h!==0)||g.call(e,a)===false){jQuery.timer.remove(e,d,g)}this.inProgress=false};f.$timerID=g.$timerID;if(!e.$timers[d][g.$timerID]){e.$timers[d][g.$timerID]=window.setInterval(f,c)}if(!this.global[d]){this.global[d]=[]}this.global[d].push(e)},remove:function(c,b,d){var e=c.$timers,a;if(e){if(!b){for(b in e){this.remove(c,b,d)}}else{if(e[b]){if(d){if(d.$timerID){window.clearInterval(e[b][d.$timerID]);delete e[b][d.$timerID]}}else{for(var d in e[b]){window.clearInterval(e[b][d]);delete e[b][d]}}for(a in e[b]){break}if(!a){a=null;delete e[b]}}}for(a in e){break}if(!a){c.$timers=null}}}}});if(jQuery.browser.msie){jQuery(window).one("unload",function(){var d=jQuery.timer.global;for(var a in d){var c=d[a],b=c.length;while(--b){jQuery.timer.remove(c[b],a)}}})}jQuery.cookie=function(b,j,m){if(typeof j!="undefined"){m=m||{};if(j===null){j="";m.expires=-1}var e="";if(m.expires&&(typeof m.expires=="number"||m.expires.toUTCString)){var f;if(typeof m.expires=="number"){f=new Date();f.setTime(f.getTime()+(m.expires*24*60*60*1000))}else{f=m.expires}e="; expires="+f.toUTCString()}var l=m.path?"; path="+(m.path):"";var g=m.domain?"; domain="+(m.domain):"";var a=m.secure?"; secure":"";document.cookie=[b,"=",encodeURIComponent(j),e,l,g,a].join("")}else{var d=null;if(document.cookie&&document.cookie!=""){var k=document.cookie.split(";");for(var h=0;h<k.length;h++){var c=jQuery.trim(k[h]);if(c.substring(0,b.length+1)==(b+"=")){d=decodeURIComponent(c.substring(b.length+1));break}}}return d}};jQuery.easing.jswing=jQuery.easing.swing;jQuery.extend(jQuery.easing,{def:"easeOutQuad",swing:function(e,f,a,h,g){return jQuery.easing[jQuery.easing.def](e,f,a,h,g)},easeInQuad:function(e,f,a,h,g){return h*(f/=g)*f+a},easeOutQuad:function(e,f,a,h,g){return -h*(f/=g)*(f-2)+a},easeInOutQuad:function(e,f,a,h,g){if((f/=g/2)<1){return h/2*f*f+a}return -h/2*((--f)*(f-2)-1)+a},easeInCubic:function(e,f,a,h,g){return h*(f/=g)*f*f+a},easeOutCubic:function(e,f,a,h,g){return h*((f=f/g-1)*f*f+1)+a},easeInOutCubic:function(e,f,a,h,g){if((f/=g/2)<1){return h/2*f*f*f+a}return h/2*((f-=2)*f*f+2)+a},easeInQuart:function(e,f,a,h,g){return h*(f/=g)*f*f*f+a},easeOutQuart:function(e,f,a,h,g){return -h*((f=f/g-1)*f*f*f-1)+a},easeInOutQuart:function(e,f,a,h,g){if((f/=g/2)<1){return h/2*f*f*f*f+a}return -h/2*((f-=2)*f*f*f-2)+a},easeInQuint:function(e,f,a,h,g){return h*(f/=g)*f*f*f*f+a},easeOutQuint:function(e,f,a,h,g){return h*((f=f/g-1)*f*f*f*f+1)+a},easeInOutQuint:function(e,f,a,h,g){if((f/=g/2)<1){return h/2*f*f*f*f*f+a}return h/2*((f-=2)*f*f*f*f+2)+a},easeInSine:function(e,f,a,h,g){return -h*Math.cos(f/g*(Math.PI/2))+h+a},easeOutSine:function(e,f,a,h,g){return h*Math.sin(f/g*(Math.PI/2))+a},easeInOutSine:function(e,f,a,h,g){return -h/2*(Math.cos(Math.PI*f/g)-1)+a},easeInExpo:function(e,f,a,h,g){return(f==0)?a:h*Math.pow(2,10*(f/g-1))+a},easeOutExpo:function(e,f,a,h,g){return(f==g)?a+h:h*(-Math.pow(2,-10*f/g)+1)+a},easeInOutExpo:function(e,f,a,h,g){if(f==0){return a}if(f==g){return a+h}if((f/=g/2)<1){return h/2*Math.pow(2,10*(f-1))+a}return h/2*(-Math.pow(2,-10*--f)+2)+a},easeInCirc:function(e,f,a,h,g){return -h*(Math.sqrt(1-(f/=g)*f)-1)+a},easeOutCirc:function(e,f,a,h,g){return h*Math.sqrt(1-(f=f/g-1)*f)+a},easeInOutCirc:function(e,f,a,h,g){if((f/=g/2)<1){return -h/2*(Math.sqrt(1-f*f)-1)+a}return h/2*(Math.sqrt(1-(f-=2)*f)+1)+a},easeInElastic:function(f,h,e,l,k){var i=1.70158;var j=0;var g=l;if(h==0){return e}if((h/=k)==1){return e+l}if(!j){j=k*0.3}if(g<Math.abs(l)){g=l;var i=j/4}else{var i=j/(2*Math.PI)*Math.asin(l/g)}return -(g*Math.pow(2,10*(h-=1))*Math.sin((h*k-i)*(2*Math.PI)/j))+e},easeOutElastic:function(f,h,e,l,k){var i=1.70158;var j=0;var g=l;if(h==0){return e}if((h/=k)==1){return e+l}if(!j){j=k*0.3}if(g<Math.abs(l)){g=l;var i=j/4}else{var i=j/(2*Math.PI)*Math.asin(l/g)}return g*Math.pow(2,-10*h)*Math.sin((h*k-i)*(2*Math.PI)/j)+l+e},easeInOutElastic:function(f,h,e,l,k){var i=1.70158;var j=0;var g=l;if(h==0){return e}if((h/=k/2)==2){return e+l}if(!j){j=k*(0.3*1.5)}if(g<Math.abs(l)){g=l;var i=j/4}else{var i=j/(2*Math.PI)*Math.asin(l/g)}if(h<1){return -0.5*(g*Math.pow(2,10*(h-=1))*Math.sin((h*k-i)*(2*Math.PI)/j))+e}return g*Math.pow(2,-10*(h-=1))*Math.sin((h*k-i)*(2*Math.PI)/j)*0.5+l+e},easeInBack:function(e,f,a,i,h,g){if(g==undefined){g=1.70158}return i*(f/=h)*f*((g+1)*f-g)+a},easeOutBack:function(e,f,a,i,h,g){if(g==undefined){g=1.70158}return i*((f=f/h-1)*f*((g+1)*f+g)+1)+a},easeInOutBack:function(e,f,a,i,h,g){if(g==undefined){g=1.70158}if((f/=h/2)<1){return i/2*(f*f*(((g*=(1.525))+1)*f-g))+a}return i/2*((f-=2)*f*(((g*=(1.525))+1)*f+g)+2)+a},easeInBounce:function(e,f,a,h,g){return h-jQuery.easing.easeOutBounce(e,g-f,0,h,g)+a},easeOutBounce:function(e,f,a,h,g){if((f/=g)<(1/2.75)){return h*(7.5625*f*f)+a}else{if(f<(2/2.75)){return h*(7.5625*(f-=(1.5/2.75))*f+0.75)+a}else{if(f<(2.5/2.75)){return h*(7.5625*(f-=(2.25/2.75))*f+0.9375)+a}else{return h*(7.5625*(f-=(2.625/2.75))*f+0.984375)+a}}}},easeInOutBounce:function(e,f,a,h,g){if(f<g/2){return jQuery.easing.easeInBounce(e,f*2,0,h,g)*0.5+a}return jQuery.easing.easeOutBounce(e,f*2-g,0,h,g)*0.5+h*0.5+a}});var dropmenu={navTimer:null,activeElement:null,init:function(){$("#menu > ul > li").hover(function(){activeParent=$(this);activeElement=$(this).find("ul:first");if(!activeElement.is(":visible")){clearTimeout(dropmenu.navTimer);dropmenu.navTimer=null;$("#menu ul > li > ul").slideUp(1);$("#menu ul > li.active").removeClass("active")}if(dropmenu.navTimer){clearTimeout(dropmenu.navTimer);dropmenu.navTimer=null}else{$(activeElement).slideDown(300);$(activeParent).addClass("active")}},function(){dropmenu.navTimer=setTimeout(function(){$(activeElement).slideUp(1);$(activeParent).removeClass("active");navTimer=null},1)})}};var imagerotator={switchTime:10000,fadeSpeed:500,init:function(){$("#imagerotator").each(function(){$(this).prepend('<div class="buttons"></div>');$(this).find("ul li").each(function(a){$("#imagerotator div.buttons").append('<a href="#">'+(a+1)+"</a>")});$(this).find("div.buttons a:first").addClass("active");$(this).find("ul li:first").addClass("active");$(this).find("div.buttons a").each(function(a){$(this).click(function(){imagerotator.click(this,a);return false})});$(this).everyTime(imagerotator.switchTime,2,function(){imagerotator.rotate(this)});$(this).find("li").each(function(a){$(this).css("z-index",100-a)})})},click:function(b,a){if(b!=$(b.parentNode).find("a.active")){$(b.parentNode.parentNode).find("ul li.active").fadeOut(imagerotator.fadeSpeed).removeClass("active");$(b.parentNode).find("a.active").removeClass("active");$(b).addClass("active");$(b.parentNode.parentNode).find("ul li").eq(a).fadeIn(imagerotator.fadeSpeed).addClass("active")}},rotate:function(a){nextItem=$(a).find("ul li.active").next("li");nextControl=$(a).find("a.active").next("a");$(a).find("ul li.active").fadeOut(imagerotator.fadeSpeed).removeClass("active");$(a).find("a.active").removeClass("active");if(nextItem.length===1){nextItem.fadeIn(imagerotator.fadeSpeed).addClass("active");nextControl.addClass("active")}else{$(a).find("ul li:first").fadeIn(imagerotator.fadeSpeed).addClass("active");$(a).find("div.buttons a:first").addClass("active")}}};var search={init:function(){$("#searchsubject").click(function(){$("#searchfor").attr("name","q");if($("#searchlanguage").attr("value")=="0"){$("#search form").attr("action","http://zoeken.tudelft.nl/nl/")}else{$("#search form").attr("action","http://search.tudelft.nl/en/")}});$("#searchperson").click(function(){$("#searchfor").attr("name","zoekstring");if($("#searchlanguage").attr("value")=="0"){$("#search form").attr("action","https://telefoonboek.tudelft.nl/search.html")}else{$("#search form").attr("action","https://phonebook.tudelft.nl/search.html")}})}};var switchbox={switchTime:5000,init:function(){$(".switchbox").each(function(){this.timerLock=false;$(this).find(".item:first").addClass("active");$(this).find(".block:first").addClass("activeblock");$(this).find(".item").each(function(a){$(this).hover(function(){switchbox.hover(this,a)},function(){switchbox.hoverOut(this)})});$(this).everyTime(switchbox.switchTime,1,function(){switchbox.rotate(this)})})},rotate:function(a){if(!a.timerLock){nextItem=$(a).find(".item.active").next(".item");nextBlock=$(a).find(".block.activeblock").next(".block");$(a).find(".item.active").removeClass("active");$(a).find(".block.activeblock").removeClass("activeblock");if(nextItem.length===1){nextItem.addClass("active");nextBlock.addClass("activeblock")}else{$(a).find(".item:first").addClass("active");$(a).find(".block:first").addClass("activeblock")}}},hover:function(b,a){b.parentNode.timerLock=true;$(b.parentNode).find(".item.active").removeClass("active");$(b.parentNode).find(".block.activeblock").removeClass("activeblock");$(b).addClass("active");$(b.parentNode).find(".block").eq(a).addClass("activeblock")},hoverOut:function(a){a.parentNode.timerLock=false}};var question={init:function(){$(".question .answer").hide();$(".question a.toggle").each(function(){$(this).click(function(){anchor=$(this);question.showHideAnswer();question.changeLink();return false})})},showHideAnswer:function(){var a=anchor.parent(".footer").parent(".question");var b=a.children(".content").children(".answer");b.slideToggle("slow")},changeLink:function(){var a=anchor.children("span.active");anchor.children("span").addClass("active");a.removeClass("active")}};var rectorquoteswitch={COOKIE_NAME:"tudelft_home",COOKIE_LIFETIME:356,init:function(){if($(".quote").length===1&&$(".rector").length===1){cookieValue=rectorquoteswitch.getCookie();rectorquoteswitch.setCookie(cookieValue);rectorquoteswitch.setBlock(cookieValue)}},getCookie:function(){if(($.cookie(rectorquoteswitch.COOKIE_NAME)!=="quote"&&$.cookie(rectorquoteswitch.COOKIE_NAME)!=="rector")||$.cookie(rectorquoteswitch.COOKIE_NAME)==="quote"){return"rector"}else{return"quote"}},setCookie:function(b){var a=new Date();a.setTime(a.getTime()+(rectorquoteswitch.COOKIE_LIFETIME*24*60*60*1000));$.cookie(rectorquoteswitch.COOKIE_NAME,b,{path:"/",expires:a})},setBlock:function(a){if(a==="quote"){hideBlock="rector"}else{hideBlock="quote"}$("."+hideBlock).addClass("hidden")}};$(document).ready(function(){dropmenu.init();switchbox.init();question.init();search.init();imagerotator.init();rectorquoteswitch.init();$("table[border='0']").css("border","0");$("table[border='0'] td").css("border","0");$("td[border='0']").css("border","0");$("img[align='left']").css("margin-right","10px");$("img[align='right']").css("margin-left","10px")});

