if (!console) { var console = {}; console.log = function(data) { } } var definitions = {}; definitions.smallFontSize = '12px'; definitions.defaultFontSize = '14px'; definitions.bigFontSize = '16px'; definitions.tabSpeed = 250; definitions.tabEase = 'easeInOutQuad'; definitions.sliderSpeed = 500; definitions.sliderEase = 'easeInOutQuad'; definitions.headerSpeed = 500; definitions.headerEase = 'easeInOutQuad'; // util functions function detectBrowserVersion(){ var userAgent = navigator.userAgent.toLowerCase(); $.browser.chrome = /chrome/.test(navigator.userAgent.toLowerCase()); var version = 0; // Is this a version of IE? if($.browser.msie){ userAgent = $.browser.version; userAgent = userAgent.substring(0,userAgent.indexOf('.')); version = userAgent; } // Is this a version of Chrome? if($.browser.chrome){ userAgent = userAgent.substring(userAgent.indexOf('chrome/') +7); userAgent = userAgent.substring(0,userAgent.indexOf('.')); version = userAgent; // If it is chrome then jQuery thinks it's safari so we have to tell it it isn't $.browser.safari = false; } // Is this a version of Safari? if($.browser.safari){ userAgent = userAgent.substring(userAgent.indexOf('safari/') +7); userAgent = userAgent.substring(0,userAgent.indexOf('.')); version = userAgent; } // Is this a version of Mozilla? if($.browser.mozilla){ //Is it Firefox? if(navigator.userAgent.toLowerCase().indexOf('firefox') != -1){ userAgent = userAgent.substring(userAgent.indexOf('firefox/') +8); userAgent = userAgent.substring(0,userAgent.indexOf('.')); version = userAgent; } // If not then it must be another Mozilla else{ } } // Is this a version of Opera? if($.browser.opera){ userAgent = userAgent.substring(userAgent.indexOf('version/') +8); userAgent = userAgent.substring(0,userAgent.indexOf('.')); version = userAgent; } return version; } function trim(str){ return str.replace(/^\s+|\s+$/g, ''); } //building associative array from string (e.g. width:100) function splitParams(str) { var paramsArray = str.split(';'); var parameters = []; var accessor; var value; for (var i = 0; i < paramsArray.length; i++) { accessor = paramsArray[i].substr(0, paramsArray[i].indexOf(':')); value = paramsArray[i].substring(paramsArray[i].indexOf(':') + 1); parameters[trim(accessor)] = trim(value); } return parameters; } $(window).load(function(e) { setupBackground(); }); function setupBackground() { $('#background').css('height', Math.max($(window).height(), $('#wrapper').height()) + 'px'); window.setTimeout(setupBackground, 250); } $(document).ready(function(e) { detectBrowserVersion(); preventDefaults(); hideContents(); includeSWFObjects(); setupLoginTab(); setupCountryHandling(); setupInputHandling(); setupFontHandling(); setupFooterTabs(); setupFormContact(); setupSlider(); setupSitemap(); applyTextShadows(); //applyTextGradients(); setupNavigation(); /* Footer Menu */ /* $('ul.footer-tab-content').each(function(index, element) { var height = 0; $(this).find('li').each(function(index, element) { alert($(this).height()); if ($(this).height() > height) height = $(this).height(); }); $(this).find('li').height(height); }); */ $('.history-back').click(function(e) { e.preventDefault(); window.history.back(); }); if ($('.content-print').size() == 0) $('#btn-print').remove(); $('#btn-print').click(function(e) { e.preventDefault(); var popup = openWindow('/css/print.htm', 'Print', 620, 650, true, true); setTimeout(appendWindowContent, 150); //$(popup).load(appendWindowContent); function appendWindowContent() { if( popup.document.getElementById('body') == null ) { setTimeout( appendWindowContent, 150 ); return; } var $popupContent = $('
'); // NOTE: everything that has class .content-print gets printed! $('.content-print').each(function(index, element) { $popupContent.append($(this).clone()); }); // NOTE: everything that has class .content-print-not gets removed from printing! $popupContent.find('.content-print-not').remove(); popup.document.getElementById('body').innerHTML = $popupContent.html(); } }); $('.scrollTo').click(function (e) { var element = this.hash; e.preventDefault(); $.scrollTo(element, 2000, { offset: 0, easing:'easeInOutQuart' }); }); var expanderSpeed = 2; setExpanderSize(); $('#news .expander-title').click(function(e){ $(this).parent().toggleClass('expander-open'); $(this).siblings('.expander-list:first').slideToggle(expanderSpeed); }).trigger('click'); expanderSpeed = 500; }); function setupCountryHandling() { var $countries = $('#country .country'); if ($countries.size() == 0) return; $( '
 
' ).insertAfter( $countries.eq( '6' ) ); $( '
 
' ).insertAfter( $countries.eq( '13' ) ); $( '
 
' ).insertAfter( $countries.eq( '20' ) ); $countries.click(function(e){ e.preventDefault(); var index = $countries.index($(this)); $.scrollTo($('#country .country-item:eq('+index+')'), 2000, { offset: 0, easing:'easeInOutQuart' }); }); } function openWindow(url, name, width, height, scrollbars, resizable) { if (name == null) name = 'popup'; if (width == null) width = 600; if (height == null) height = 400; if (scrollbars == null) scrollbars = "yes"; if (scrollbars == true) scrollbars = "yes"; if (scrollbars == false) scrollbars = "no"; if (resizable == null) resizable = "yes"; if (resizable == true) resizable = "yes"; if (resizable == false) resizable = "no"; var w = window.open(url, name, "width="+width+",height="+height+",status=yes,scrollbars="+scrollbars+",resizable="+resizable); w.focus(); return w } /* Global Util Functions */ function setFontSize(size) { $('body').css('font-size', size); setExpanderSize(); } function setExpanderSize() { var $expanderTitle = $('#news .expander-title'); $expanderTitle.css('width', 'auto'); var i = 0; $expanderTitle.each(function(){ i++; $(this).css('width', 'auto'); $(this).siblings('.rounded-line-top').css('width', 0); $(this).siblings('.rounded-line-top').fadeOut(0); if ($(this).height() > 30) { // 2 lines or more $(this).siblings('.rounded-line-top').css('height', $(this).height()); } var expanderWidth = $(this).width(); expanderWidth = Math.min( expanderWidth, 620 ); var lineWidth = 660 - expanderWidth * 1.15; $(this).css('width', expanderWidth * 1.1); $(this).siblings('.rounded-line-top').css('width', lineWidth); if ($(this).find('.h1:first').height() > 30) $(this).siblings('.rounded-line-top').css('height', $(this).height()); else $(this).siblings('.rounded-line-top').css('height', 'auto'); }); window.setTimeout(setExpanderSize, 1500); } /* jQuery and Doc-Handling Functions */ function preventDefaults() { $('.prevent-default').click(function(e) { e.preventDefault(); }); } function hideContents() { $('.hide').fadeOut(0); } function includeSWFObjects() { $('.swfobject').each(function(index, element) { var $target = $(this); var id = 'swfobject-id-' + index; $target.attr('id', id); var params = splitParams($target.attr('rel')); if (!params["version"]) params["version"] = "10.0.0"; //console.log(params["path"] + ', ' + id + ', ' + params["width"] + ', ' + params["height"]); swfobject.embedSWF(params["path"], id, params["width"], params["height"], params["version"].toString(), "/media/expressInstall.swf", {}, {}, {}); }); } function setupLoginTab() { if ($('#doc-check').size() == 0) return; $('#doc-check').fadeOut(0); $('#login-fachkreis').click(function(e){ e.preventDefault(); $('#doc-check').fadeIn(definitions.headerSpeed, definitions.headerEase); }); $('#doc-check .close').click(function(e) { e.preventDefault(); $('#doc-check').fadeOut(definitions.headerSpeed, definitions.headerEase); }); } function setupFontHandling() { $('#fontsize-smaller').click( function(e) { setFontSize(definitions.smallFontSize); } ); $('#fontsize-default').click( function(e) { setFontSize(definitions.defaultFontSize); } ); $('#fontsize-bigger').click ( function(e) { setFontSize(definitions.bigFontSize); } ); } function setupInputHandling() { // remove default input value on click $('input').not('[type="submit"]').focus(function() { if (this.value == this.defaultValue){ this.value = ''; } if(this.value != this.defaultValue){ this.select(); } }).blur(function(){ if (this.value == '') this.value = this.defaultValue; }); } function setupFooterTabs() { var $tabs = $('#footer-tabs .footer-tab'); var animating = false; // resize / align footer-tabs var padding = 20; var paddingSubmenu = 20; var loggedIn = false; if ($('#logout-fachkreis').size()) { padding = 12; paddingSubmenu = 14; loggedIn = true; } var tabWidth = Math.floor((1024 - $tabs.size() * (padding + 2)) / $tabs.size()); $tabs.css('width', tabWidth + 'px'); var maxHeight = 0; $tabs.each(function(){ maxHeight = Math.max($(this).height(), maxHeight); }); $tabs.css('height', maxHeight + 'px'); $tabs.last().css('width', tabWidth + (1024 - (tabWidth + padding) * $tabs.size()) - $tabs.size() * 2 + 'px'); $('.footer-tab-content').each(function(){ var $li = $(this).find('li'); var tabWidth = Math.floor((1024 - $li.size() * (paddingSubmenu)) / $li.size()); $li.css('width', tabWidth + 'px'); $li.last().css('width', tabWidth + (1024 - (tabWidth + paddingSubmenu) * $li.size()) - (loggedIn ? 2 : 0) + 'px'); var maxHeight = 0; $li.each(function(){ maxHeight = Math.max($(this).height(), maxHeight); }); $li.css('height', maxHeight + 'px'); }); $('.footer-tab-content').slideUp(0); $('.footer-tab-content:first').slideDown(0); $('#footer-tabs .footer-tab:first').addClass('active'); $tabs .css('cursor', 'pointer') .click(function(e) { if (animating) return; var id = $tabs.index($(this)); $tabs.removeClass('active'); $('#footer-tabs .footer-tab:lt('+id+')').addClass('before'); $('#footer-tabs .footer-tab:gt('+id+')').addClass('after'); $(this).addClass('active'); animating = true; $('.footer-tab-content:not(:eq('+id+'))') .slideUp(definitions.tabSpeed, definitions.tabEase); $('.footer-tab-content:eq('+id+')') .delay(definitions.tabSpeed) .slideDown(definitions.tabSpeed, definitions.tabEase, function(){ animating = false; }); }); } function setupFormContact() { if ($('#form-contact').size() !== 0) { validate('#input-name', 'text'); validate('#input-address', 'email'); validate('#input-to-address', 'email'); validate('#input-subject', 'text'); validate('#input-text', 'textarea'); validate('#input-street-address', 'text'); validate('#input-zipcode', 'zip'); validate('#input-zipcode-en', 'text'); validate('#input-place', 'text'); validate('#input-country', 'text'); validate('#input-your-name', 'text'); validate('#input-to-name', 'text'); } } function validate(formItem, validationType) { var $formItem = $(formItem); $formItem.attr('rel', validationType); $formItem.addClass('form-validate'); var $form = $formItem.parents('form:first'); if (!$form.hasClass('form-validate')) { $form.addClass('form-validate'); $form.find('input[type="image"], input[type="submit"]').click(function(e) { // VALIDATE FORM e.preventDefault(); var $form = $(this).parents('form:first'); $form.find('.error').removeClass('error'); if (validateForm($form) == true) $form.submit(); $form.find('.form-invalid').each(function(){ var $input = $(this); var $label = $('label[for="' + $input.attr('id') + '"]'); $input.parent().addClass('error'); $label.addClass('error'); }); }); } } function validateForm(form) { var $form = $(form); var validForm = true; var validItem = true; var invalidItems = new Array(); $form.find('.form-validate').each(function(){ validItem = true; var validateType = $(this).attr('rel'); var val = $(this).val(); $(this).removeClass('form-invalid'); validItem = validateFormItem($(this), validateType); if (validItem == false) { $(this).addClass('form-invalid'); validForm = false; invalidItems.push($(this)); } }); return validForm; } function validateFormItem(formItem, validateType) { var val = $(formItem).val(); var defaultValue; $(formItem).each(function(){ defaultValue = this.defaultValue }); if (defaultValue == val) return false; switch(validateType.toLowerCase()) { case 'email': if ((val.indexOf('@') > 1) && ((val.length >= 6)) && ((val.lastIndexOf('.') < (val.length - 2))) && ((val.lastIndexOf('.') > val.indexOf('@')))) { return true; } else { //console.log('invalid form item: ' + formItem.attr('id')); return false; } break; case 'textarea': if (val.length < 1) { //console.log('invalid form item: ' + formItem.attr('id')); return false; } else { var iChars = "!@#$%^&*()+=-[]\\\';/{}|\":<>"; for (var i = 0; i < val.length; i++) { if (iChars.indexOf(val.charAt(i)) != -1) { //alert ("Your username has special characters. \nThese are not allowed.\n Please remove them and try again."); return false; } } } break; case 'input': break; case 'text': if (val.length < 1) { //console.log('invalid form item: ' + formItem.attr('id')); return false; } else { var iChars = "!@#$%^&*()+=-[]\\\';./{}|\":<>?"; for (var i = 0; i < val.length; i++) { if (iChars.indexOf(val.charAt(i)) != -1) { //alert ("Your username has special characters. \nThese are not allowed.\n Please remove them and try again."); return false; } } } break; case 'zip': if (val.length < 4) { //console.log('invalid form item: ' + formItem.attr('id')); return false; } else { var iChars = "0123456789"; for (var i = 0; i < val.length; i++) { if (iChars.indexOf(val.charAt(i)) == -1) { //alert ("Your username has special characters. \nThese are not allowed.\n Please remove them and try again."); return false; } } } break; default: if (val.length < 1) { //console.log('invalid form item: ' + formItem.attr('id')); return false; } break; } return true; } function setupSlider() { if ($('.bullets').size() == 0) return; $('.slider-mover').each(function(index, element) { var boxWidth = $(this).parents('.slider:first').width(); var count = ( $(this).find('.slider-content').size() ); $(this).css('width', boxWidth * (count + 1) + 'px'); $(this).parents('.slider').find('.bullets').children().remove(); for (var i = 0; i < count; i++) $(this).parents('.slider').find('.bullets').append('
'); }); $('.bullets').each(function(index, element) { $(this).find('.bullet:first').addClass('bullet-active'); $(this).attr('rel', '0'); }); $('.bullets .bullet') .css('cursor', 'pointer') .click(function(e) { var $this = $(this); var $parent = $(this).parent('.bullets:first'); var $slider = $parent.parents('.slider:first'); var oldID = parseInt( $parent.attr('rel') ); var id = parseInt( $parent.find('.bullet').index($this) ); var boxWidth = $slider.width(); var position = 0 - id * boxWidth; var speed = definitions.sliderSpeed + (Math.abs(id - oldID) - 1) / 2 * definitions.sliderSpeed; $parent.find('.bullet').removeClass('bullet-active'); $(this).addClass('bullet-active'); $slider.find('.slider-mover:first').stop(true, false).animate({left: position + 'px'}, speed, definitions.sliderEase); $parent.attr('rel', id) }); } function applyTextShadows() { $('.text-shadow').textShadow(); } function applyTextGradients() { $('.text-gradient.white').pxgradient({ step: 20, colors: ['#fff','#c6c7c8'], dir: 'y' }); $('.text-gradient.green').pxgradient({ step: 20, colors: ['#2aa128','#238421'], dir: 'y' }); } function setupNavigation() { var naviHover = false; function resizeNavigation() { // NOTE: is this necessery? //if (naviHover) return; $('.nav-submenu').each(function(index, element) { // RESIZE NAVIGATION var $parent = $(this).parents('.level1:first'); var parentWidth = $parent.width() + 10; var sourceParentWidth = parentWidth; var width = $parent.width() - 73; if (index == 0) width += 3; var $subnaviLinks = $(this).find('a'); var maxSubnaviWidth = 0; $subnaviLinks.css({'display': 'block', 'width': ''}) $subnaviLinks.each(function(){ maxSubnaviWidth = Math.max(maxSubnaviWidth, $(this).width()); }); $subnaviLinks.css('display', ''); if (maxSubnaviWidth > width) { width = Math.min( parentWidth * 1.5, maxSubnaviWidth + 5 ); parentWidth = width + 80; } width += 7; $(this).css('width', parentWidth + 'px'); $(this).find('li, .nav-submenu-end').css('width', parentWidth + 'px'); $(this).find('li a, .tile').css('width', width + 'px'); $(this).find('.nav-spacer').css('width', width + 'px'); if ( $(this).offset().left + parentWidth > $(window).width() ) $(this).css('left', (sourceParentWidth - parentWidth) - 4); else $(this).css('left', '-4px'); //console.log( $(this).offset().left + parentWidth ); }); } //window.setInterval(resizeNavigation, 300); $('.nav-submenu').slideDown(0); resizeNavigation(); $('.nav-submenu').slideUp(0); // RESIZE NAVI HEIGHT for 2-line nav-elements function resizeItemHeight(target){ if (target == null) target = $('UL#nav ul li.level2'); target.each(function(){ $(this).parent().slideDown(0); $(this).css('position', 'relative'); var $a = $(this).find('a'); $a.css({'height': 'auto', 'display': 'block'}); if ($.browser.msie && $.browser.version <= 7) $a.css('height', Math.max(20, $a.height() + 4)); else $a.css('height', Math.max(16, $a.height())); $(this).find('.left, .right').css('height', $a.height()); $(this).parent().slideUp(0); $(this).css('height', Math.max(16, $a.height())); }); } resizeItemHeight(); $('UL#nav ul').each(function(){ // REMOVE LAST NAV-SPACER var counter = 1; var size = $(this).find('li').length; var navSpacerCount = 0; var $lastNavSpacer; var $parent = $(this); $(this).find('.nav-spacer').each(function(){ $lastNavSpacer = $(this); navSpacerCount++; }); $(this).find('li').each(function(){ //console.log( counter + ' - ' + size ); if (counter == size) { $lastNavSpacer.remove(); if ($.browser.msie && $.browser.version <= 7) { $parent.find('.nav-submenu-end').css({'position': 'relative', 'top': '-5px'}); } } counter++; }); }); /* Navigation */ // IE Navigation Fix if ($.browser.msie && $.browser.version == 7) { $('UL#nav ul .nav-spacer').css({'margin-top': '-4px', 'margin-bottom': '-3px'}); $('UL#nav ul li.level2').css({'margin-top': '0px', 'margin-bottom': '-4px'}); $('UL#nav .nav-submenu-end').css({'margin-top': '-14px'}); $('UL#nav .nav-submenu-end .right').css({'position': 'absolute', 'top': '0px', 'right': '24px'}); } $('UL#nav li.level1').hover( function() { var prev = $(this).attr('id'); if (prev > 1) { --prev; $('li#' + prev + ' div.nav-spacer-right').addClass('activePrev'); } //$('UL#nav').addClass('activeNav'); $(this).addClass('active'); $('ul', this).stop(true, true).slideDown(300); resizeNavigation(); resizeItemHeight($(this).find('.level2')); //window.setTimeout(resizeNavigation, 50); window.setTimeout(function(){ naviHover = true; }, 100); }, function() { var prev = $(this).attr('id'); if (prev > 1) { --prev; $('li#' + prev + ' div.nav-spacer-right').removeClass('activePrev'); } //$('UL#nav').removeClass('activeNav'); $(this).removeClass('active'); $('ul', this).stop(true, true).slideUp(300); window.setTimeout(function(){ naviHover = false; }, 100); } ); } /* Remove backgrounds and adjust height to fit lines */ function setupSitemap() { return; if ($('#sitemap').size() == 0) return; function adjustUL(target, heightMult, marginMult) { var $this = $(target); var oldHeight = $this.height(); var childCount = $this.find('li').size(); var childrenHeight = $this.find('ul:first').height(); var childrenParentHeight = $this.find('ul:first').parent().height(); var childHeight = childrenHeight + (childrenParentHeight - childrenHeight) / 2; var newHeight = oldHeight - childHeight - 10; var marginBottom = newHeight - oldHeight; marginBottom = childCount * 30; marginBottom = oldHeight - newHeight + 30; $this.css('height', newHeight + 'px'); $this.css('margin-bottom', marginBottom + 'px'); } $('#sitemap ul').addClass('level1'); $('#sitemap ul ul').removeClass('level1').addClass('level2'); $('#sitemap ul ul ul').removeClass('level1 level2').addClass('level3'); $('#sitemap ul ul ul ul').removeClass('level1 level2 level3').addClass('level4'); $('#sitemap ul ul ul ul ul').removeClass('level1 level2 level3 level4').addClass('level5'); $('#sitemap ul, #sitemap li, #sitemap a').css({'background-color': 'inherit'}); $('#sitemap ul.level4').each(function(index, element) { adjustUL(this, 20, 40); }); $('#sitemap ul.level3').each(function(index, element) { adjustUL(this, 26, 50); }); $('#sitemap ul.level2').each(function(index, element) { adjustUL(this, 26, 50); }); $('#sitemap ul.level1').css('height', $('#sitemap ul.level1').height() - 10 + 'px'); } //jump function function jump_biblio() { popupWin = window.open('/css/Bibliography.htm', 'open_window', 'menubar=0, toolbar=0, location=0, directories=0, status=0, scrollbars, resizable, dependent, width=500, height=600, left=400, top=200'); //var thePage = "/css/Bibliography.htm"; //alert(thePage); //openNewWindow(thePage,"temp",500,600,0,0,"none"); }