if (!JS_AB) { var JS_AB = new Object(); } JS_AB.general = { debug : false, init : function() { JS_AB.general._cookiesEnabled(); JS_AB.general._styleSwitcher(); JS_AB.general._hookLoginInTopBar(); JS_AB.general._hookAccessibilityTooltip(); JS_AB.general._setExternalFavicons(); JS_AB.general._hookModalBoxes(); JS_AB.general.accessibleYoutube(); }, _cookiesEnabled: function() { // try to grab the property var cookiesEnabled = (navigator.cookieEnabled) ? true : false; // unknown property? if(typeof navigator.cookieEanbled == 'undefined' && !cookiesEnabled) { // try to set a cookie document.cookie = 'testcookie'; cookiesEnabled = (document.cookie.indexOf('testcookie') != -1); } // show div if(!cookiesEnabled) $('#noCookies').show(); }, _styleSwitcher: function() { $('.styleswitch').click(function(){ JS_AB.general._switchStylestyle(this.getAttribute("rel")); return false; }); var c = JS_AB.general.readCookie('style'); if (c) JS_AB.general._switchStylestyle(c); }, _switchStylestyle: function(styleName) { $('link[@rel*=style][title]').each(function(i) { this.disabled = true; if (this.getAttribute('title') == styleName) this.disabled = false; if (styleName === 'accessibility') $('body').addClass('accessibility'); else $('body').removeClass('accessibility'); }); JS_AB.general.createCookie('style', styleName, 365); }, _hookAccessibilityTooltip: function() { if (!$('body').hasClass('accessibility')) { $('#styleAccessibility a').hover(function(evt) { $('#styleHelp').fadeIn(250); }, function(evt) { $('#styleHelp').fadeOut(250); }); }; $('#styleAccessibility a').bind('focus', function(evt) { evt.preventDefault(); evt.stopPropagation(); $('#styleHelp').fadeIn(250); }).bind('blur mouseout', function(evt) { evt.preventDefault(); evt.stopPropagation(); $('#styleHelp').fadeOut(250); }); }, _hookLoginInTopBar: function() { $('#activateLoginform').bind('click', function(evt) { evt.preventDefault(); evt.stopPropagation(); $('#topbarLoginForm').toggle(); if ($('#topbarLoginForm').is(':visible')) { $('#username').focus(); } }); $('#topbarLoginForm').bind('click', function(evt) { evt.stopPropagation(); }); $(document.body).bind('click', function(evt) { if ($('#topbarLoginForm').is(':visible')) { $('#topbarLoginForm').toggle(); } }); $(document.body).bind("keypress blur", function(evt) { if ($('#topbarLoginForm').is(':visible') && (evt.keyCode == 27)) { $('#topbarLoginForm').toggle(); } }); $(".tooltipContent input.input-submit").bind("keypress blur", function(evt) { if ($('#topbarLoginForm').is(':visible')) { $('#topbarLoginForm').toggle(); } }); }, _setExternalFavicons: function() { $('#external-links-list a[href^="http://"]').each(function() { var faviconIMG = $('' + $(this).attr('title') + '').prependTo($(this)); var extImg = new Image(); extImg.src = $(this).attr('href').replace(/^(http:\/\/[^\/]+).*$/, '$1') +'/favicon.ico'; extImg.onload = function() { faviconIMG.attr('src', extImg.src); } extImg.onerror = function() { faviconIMG.attr('src', '/modules/core/layout/images/externalLink.gif'); } extImg.onabort = function() { faviconIMG.attr('src', '/modules/core/layout/images/externalLink.gif'); } }); }, _hookOverlay: function(show) { if($('#overlay').length == 0) $('#container').prepend('
'); $('#overlay').height($(document).height()); $('#overlay').width($(document).width()); if(show) $('#overlay').show(); else $('#overlay').hide(); }, _hookModalBoxes: function() { $('.modal-box-close, .modal-box-close-link').bind('click', function(evt) { evt.preventDefault(); var id = $(this).attr('rel'); $('#' + id).hide(); JS_AB.general._hookOverlay(false); }); $('.modal-box-toggle').bind('click', function(evt) { var id = $(this).attr('rel'); JS_AB.general._hookOverlay(true); $('#' + id).show(); evt.stopPropagation(); evt.preventDefault(); $('#' + id).bind('click', function(evt) { evt.stopPropagation(); }); $(document.body).bind('click', function(evt) { $('#' + id).hide(); JS_AB.general._hookOverlay(false); }); $(document.body).bind("keypress", function(evt) { if (evt.keyCode == 27) { $('#' + id).hide(); JS_AB.general._hookOverlay(false); } }); }); }, accessibleYoutube: function() { // Check if this is IE 6-8; using browser object since we use jQuery 1.2.6 var isIE = jQuery.browser.msie; // If IE6 if(isIE == true) { // Do nothing } else { // If not IE6-IE8, use object instead of embed $('object:has(param[name=src][value*=youtube.com])').each(function(i) { var youtubeUrl = $(this).children('param[name=src]').attr('value'); var youtubeTag = youtubeUrl.replace(/^[^v]+v.(.{11}).*/,"$1"); $(this).after('

Heeft u moeite met de knoppen in deze video?

'); }); } }, // Cookie functions createCookie: function(name,value,days) { if (days) { var date = new Date(); date.setTime(date.getTime()+(days*24*60*60*1000)); var expires = "; expires="+date.toGMTString(); } else var expires = ""; document.cookie = name+"="+value+expires+"; path=/"; }, readCookie: function(name) { var nameEQ = name + "="; var ca = document.cookie.split(';'); for(var i=0;i < ca.length;i++) { var c = ca[i]; while (c.charAt(0)==' ') c = c.substring(1,c.length); if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length); } return null; }, eraseCookie: function(name) { createCookie(name,"",-1); }, _eoo: true } jQuery(function($) {JS_AB.general.init();});