/** * function for secure logging * does not produce errors if no console is present */ function log(o) { if(typeof console=="object" && typeof console.log == "function") { console.log(o); } } /** * browser history management * is also important for deeplinks and bookmarks */ var oHistory = { /** * initilizes history management * that means * 1) that you can reload the page and it will remember which (sub)page was open * 2) also the forth and back buttuns will remember that * 3) furthermore you can bookmark and link to (sub)pges */ init: function() { $.history.init(oPageFolding.showContentNum); } /** * pipe through history load function (only for abstraction purposes) */ ,load: function(iId) { $.history.load(iId); } } // folding of the tabs var oPageFolding = { /** * @var int stores id of currently open item */ iActiveId:null /** * sets events and opens first content */ ,init: function(){ $('.tab-head') .click(oPageFolding.tabClick) .hover(oPageFolding.tabOver, oPageFolding.tabOut); $('ul.tabs-menu li') .click(oPageFolding.subClick) .hover(oPageFolding.subOver, oPageFolding.subOut); $('h1.faq') .click(oPageFolding.faqClick) .hover(oPageFolding.faqOver, oPageFolding.faqOut); // event for download button // TODO: remove this from here $('.sc-download-desc, .sc-download-icon') .hover(function() { $(this).parent().find('.sc-download-icon').removeClass('download_inactive').addClass('download_active'); },function() { $(this).parent().find('.sc-download-icon').removeClass('download_active').addClass('download_inactive'); }) .click(function() { var sUrl = "http://" + $(this).parent().find('.sc-download-url').text(); window.open(sUrl); }); // sportler login // TODO: remove this from here var sPassword = 'welcome2chio'; function submitPassword(sUserPassword) { if (sUserPassword == sPassword) { window.location.href = "/" + oLanguages.getActiveLanguage() + "/login-sportler"; } else { $('#athlete_msg_error').fadeIn('slow'); } } $('#athlete_login_input_field') .focusin(function() { $(this).val(''); $('#athlete_msg_error').fadeOut('slow'); }) .focusout(function() { if ($.trim($(this).val()) == '') { $(this).val($(this).attr('name')); } }) .keypress(function(e) { if (e.which == '13') { submitPassword($(this).val()); } }); $('#athlete_submit').click(function() { submitPassword($('#athlete_login_input_field').val()); }); // hover event for tickets // TODO: remove this from here $('.event-list-footer-lnk-img').hover(function() { $(this).addClass('event-list-footer-lnk-img-active'); }, function() { $(this).removeClass('event-list-footer-lnk-img-active'); }); $('.event-list-footer-lnk-txt').hover(function() { $(this).next().addClass('event-list-footer-lnk-img-active'); }, function() { $(this).next().removeClass('event-list-footer-lnk-img-active'); }); } /** * helper function for tabClick and showTab */ ,closeAllContents: function(iId) { $('.tab-content').each(function(){ var me = $(this); if(/*me.css('display') != 'none'*/ me.is(':visible') && me.attr('id') != 'tab-content-'+iId) { me.slideUp('slow'); } }); $('.tab-fold-icon-close').removeClass('tab-fold-icon-close') } /** * event handler for 'open'-clicks */ ,tabClick: function() { //oPageFolding.closeAllContents(0); var iId = parseInt($(this).next().attr('id').substr(12)); $('.tab-head-heading').removeClass('menu_state_active').mouseleave(); log($(this).find('.tab-head-heading')); if (!$(this).find('.tab-head-heading').hasClass('menu_state_active')) { //$(this).find('.tab-head-heading').addClass('menu_state_active'); oPageFolding.closeAllContents(0); oHistory.load(iId); oPageFolding.showTab(iId); } else { oPageFolding.closeAllContents(0); } } /** * tab hover Over */ ,tabOver: function() { var heading = $(this).find('.tab-head-heading'); if (!heading.hasClass('menu_state_active')) { heading.addClass('menu_state_hover'); } } /** * tab hover Out */ ,tabOut: function() { var heading = $(this).find('.tab-head-heading'); if (!heading.hasClass('menu_state_active')) { heading.removeClass('menu_state_hover'); } } /** * used to show a specific tab */ ,showTab: function(id) { if($('#tab-content-'+id).css('display')=='block') return; $('.tab-head-heading').removeClass('menu_state_active').mouseleave(); $('#tab-content-'+id).prev().find('.tab-head-heading').addClass('menu_state_active'); $('#tab-content-'+id).slideDown( 'slow' , function() { $('#tab-content-'+id).show(); if ($('#tab-content-'+id).hasClass('chio-voting')) oVoting.helperAdjustSettings(); // exception 2859 (Rolex Time Travel) // exception 7186 (Fan-Shop) if (id != 2859 && id != 7186) { $.scrollTo( $('#tab-content-'+id).prev(), 400); } } ); oPageFolding.updateFlow(id); // show faq/download/lightbox subsubpages $('.submenu-'+id+'>li').each(function() { if ($(this).css('display') != 'none') {return true;} var sId = $(this).attr('id').substr(8); $('.subpage-' + sId).slideDown('slow'); //##MARKER }); } /** * helper function for tabClick and showTab */ ,closeAllSubpages: function() { $('.sub-content').each(function(){ var me = $(this); if(me.css('display') != 'none') { me.slideUp('slow'); } }); $('.sub-content-download').slideUp('slow'); $('ul.tabs-menu li').removeClass('sub-active'); // close all subsubpages $('.sub-content-faq').slideUp('slow'); } /** * shows a subpage of the currently open tab */ ,subClick: function(e) { // check if it was a subsub cklick if (!$(this).parent().parent().hasClass('content-left-col')) { oPageFolding.subSubClick($(this), e); return; } // clear last active sub $('ul.tabs-menu li').removeClass('menu_state_active').mouseleave(); // show subsub element if exists var iId = $(this).attr('id').substr(8); $('.submenu-'+iId).slideDown('slow'); window.setTimeout(function(){ $('.sc-download-desc').css('display','none'); $('.sc-download-desc').css('display','block'); }, 500); if(oPageFolding.iActiveId == iId) { oPageFolding.closeAllSubpages(); oPageFolding.closeAllFaqs(); $('.submenu-'+iId).slideUp(); oPageFolding.iActiveId = null; oHistory.load(-iId); } else { // load subpage oHistory.load(iId); } if (typeof e == 'object' && e != null) { e.stopPropagation(); } } /** * sub entry hover Over */ ,subOver: function() { if (!$(this).hasClass('menu_state_active')) { $(this).addClass('menu_state_hover'); } } /** * sub entry hover Over */ ,subOut: function() { if (!$(this).hasClass('menu_state_active')) { $(this).removeClass('menu_state_hover'); } } /** * shows a subpage of the currently open tab */ ,showSub:function(iId){ // hide all inactive submenus $('li:not(.menu_state_active)>ul.tabs-menu').each(function(){ var me = $(this); if(/*me.css('display') != 'none'*/ me.is(':visible') && me.parent().attr('id') != 'subpage-'+iId) { me.slideUp('slow'); } }); //##MARKER $('.subpage-'+iId)/*.stop()*/.slideDown( 'slow' ,function() { $('.subpage-'+iId).show(); } ); // special treadment for downloads / faqs / sponsors $('#subpage-'+iId).addClass('menu_state_active'); var me = $('.subpage-' + iId); while (me.next().hasClass('sub-content-faq')) { me = me.next(); //##MARKER me.slideDown('slow'); } me = $('.subpage-' + iId); while (me.next().hasClass('content-sponsor')) { me = me.next(); me.slideDown('slow'); } me = $('.subpage-' + iId); while (me.next().hasClass('sub-content-download')) { me = me.next(); me.slideDown('slow'); } } /** * click subsub element */ ,subSubClick: function(me, e) { oPageFolding.closeAllSubpages(); // load subsub var iId = parseInt(me.attr('id').split('-')[1]); oHistory.load(iId); if (typeof e == 'object' && e != null) { e.stopPropagation(); } } /** * shows a subsubpage of the currently open tab if exists */ ,showSubSub: function(iId, iParentId) { $('#subpage-'+iId).addClass('sub-active'); //##MARKER $('.subpage-'+iId).slideDown('slow'); // show faq/download/lightbox subsubpages $('.submenu-'+iId+'>li').each(function() { if ($(this).css('display') != 'none') {return true;} var sId = $(this).attr('id').substr(8); //##MARKER $('.subpage-' + sId).slideDown('slow'); }); } /** * helper function for faqClick */ ,closeAllFaqs: function() { $('.faq-content').each(function(){ var me = $(this); me.parent().find('.faq-icon').removeClass('faq-icon-active'); me.parent().find('.faq-icon').css('background-position', '-400px -300px'); me.parent().find('h1').removeClass('menu_state_active'); if(me.css('display') != 'none') { me.slideUp('fast'); } }); } /** * shows a faq / news entry */ ,faqClick:function() { var oElement = $(this).next().next(); var sClass = $(this).parent().attr('class').split(' ')[1]; var iId = parseInt(sClass.split('-')[1]); if ($(this).parent().hasClass('sub-content-news')) { oPageFolding.updateFlow(iId); oCoverFlow.update(); oHistory.load(iId); } else { if (oElement.css('display') == 'none') { oPageFolding.closeAllFaqs(); $(this).addClass('menu_state_active'); $(this).parent().find('.faq-icon').addClass('faq-icon-active'); //##MARKER oElement.stop().slideDown('slow'); } } } /** * faq / news entry hover Over */ ,faqOver: function() { if (!$(this).hasClass('menu_state_active')) { $(this).addClass('menu_state_hover'); $(this).parent().find('.faq-icon').css('background-position', '-411px -300px'); } } /** * faq / news entry hover Out */ ,faqOut: function() { if (!$(this).hasClass('menu_state_active')) { $(this).removeClass('menu_state_hover'); $(this).parent().find('.faq-icon').css('background-position', '-400px -300px'); } } /** * helper to find an element in dom * @return {oDomElement:{}, sType:'string'} */ ,helperFindContent: function(iId) { // first check if it is a main content var oDomElement oDomElement = $('#tab-content-'+iId); if(oDomElement.length >0) { return { oDomElement: oDomElement ,sType: 'content' } } // second check if it is a subpage oDomElement = $('#subpage-'+iId); if(oDomElement.length >0 && oDomElement.parent().parent().hasClass('content-left-col')) { return { oDomElement: $('.subpage-'+iId) ,oLiElement: oDomElement ,sType: 'subpage' } } // last check if it is a subsubpage oDomElement = $('#subpage-'+iId); if (oDomElement.length >0) { return { oDomElement: $('.subpage-'+iId) ,oLiElement: oDomElement ,sType: 'subsubpage' } } // and don't forgett the news oDomElement = $('.subpage-'+iId); if (oDomElement.length >0) { return { oDomElement: $('.subpage-'+iId) ,oLiElement: oDomElement ,sType: 'news' } } } /** * shows content defined by its page id */ ,iParentId:null ,showContentNum: function(iId) { if(!iId || oPageFolding.iParentId == iId) { return; } if(typeof iId == 'string' && iId.indexOf('/') != -1) { window.location.hash = ''; window.location = iId; } // find id var oContent = oPageFolding.helperFindContent(iId); if(!oContent) { return; } // supress irritating loops if(oContent.oDomElement.css('display') != 'none' && !oContent.oDomElement.hasClass('sub-content-news')) { return; } if(oContent.sType == 'content') { oPageFolding.iParentId = iId; } else if(oContent.sType == 'subpage') { oPageFolding.iParentId = parseInt(oContent.oLiElement.parent().attr('class').substr(18), 10); } else if (oContent.sType == 'subsubpage') { oPageFolding.iParentId = parseInt(oContent.oLiElement.parent().parent().parent().attr('class').substr(18), 10); } else if (oContent.sType == 'news') { oPageFolding.iParentId = parseInt($('.subpage-' + iId).parent().attr('id').split('-')[2]); } oPageFolding.iActiveId = iId; // close all oPageFolding.closeAllContents(oPageFolding.iParentId); oPageFolding.closeAllSubpages(); oPageFolding.closeAllFaqs(); if(oContent.sType == 'content') { oPageFolding.showTab(iId); } else if(oContent.sType == 'subpage') { $('#tab-content-'+oPageFolding.iParentId).prev().find('.tab-head-heading').addClass('menu_state_active'); oPageFolding.showTab(oPageFolding.iParentId); oPageFolding.showSub(iId); // show subsubmenu if exists if ($('.submenu-'+iId).length > 0) { $('.submenu-'+iId).show(); } } else if(oContent.sType == 'subsubpage') { var iSubId = $('#subpage-'+iId).parent().parent().attr('id').split('-')[1]; var iTabId = $('#subpage-'+iId).parent().parent().parent().parent().parent().attr('id').split('-')[2]; $('#tab-content-'+iTabId).prev().find('.tab-head-heading').addClass('menu_state_active'); oPageFolding.showTab(iTabId); if ($('.submenu-'+iSubId).length > 0) { $('.submenu-'+iSubId).show(); } $('#subpage-'+iSubId).addClass('menu_state_active'); oPageFolding.showSubSub(iId); } else if (oContent.sType == 'news') { $('.sub-content-news').each(function() { var me = $(this); me.find('.faq-icon').css('background-position', '-400px -300px'); me.find('h1').removeClass('menu_state_hover'); }); oPageFolding.showTab(oPageFolding.iParentId); oPageFolding.closeAllFaqs(); $('.subpage-' + iId).find('.faq').addClass('menu_state_active'); $('.subpage-' + iId).find('.faq-icon').addClass('faq-icon-active'); $('.subpage-' + iId).find('.faq-content').slideDown('slow'); } } /** * updates the coverflow position corresponding to the choosen id * @return bool true if the element is in the coverflow */ ,updateFlow: function(iId) { if (oCoverFlow.aImageData.length < 1) { oCoverFlow.parseImages(); } if (oCoverFlow.bReady) { return oCoverFlow.update(iId); } else { setTimeout(function() {oCoverFlow.update(iId);}, 100); } } } // controling the picture galeries var oPictureGaleries = { bAnimate: false ,iActualPicture: 0 /** * picture galeries are mainly managed by colorbox * this function sets that up */ ,init: function() { $('.gallery').each(function() { var aPictures = $('a[rel=gallery-thump-' + $(this).attr('id').substr(7)+']'); aPictures.colorbox({ slideshow: false ,width: 600 ,height: 430+28 ,scalePhotos: false ,scrolling: false ,photo: true ,opacity: 0.70 ,current: (oLanguages.getActiveLanguage() == 'de'? 'Bild {current} von {total}' : 'Picture {current} of {total}') ,previous: 'voriges' ,next: 'nächstes' ,close: 'schließen' }); }); // inline galleries $('.ig-control-next').click(function(){ if (!oPictureGaleries.bAnimate) { oPictureGaleries.bAnimate = true; var type = $(this).parent().attr('id').split('_')[1]; var holder = $('#holder_' + type); var left = holder.position().left - 618; var count = $(holder).find('.ig-entry-'+type).length-1; var iBullet = parseInt($('.ig-control-bullets-item-active').attr('id').split('_')[1]) + 1; iBullet = (iBullet > count ? 0 : iBullet); oPictureGaleries.updateBullets(iBullet, type); if(left < -618 * count) { left = 0; } $(holder).animate({left: (left)}, 'slow', 'swing', function() {oPictureGaleries.bAnimate = false;}); } }); $('.ig-control-prev').click(function(){ if (!oPictureGaleries.bAnimate) { oPictureGaleries.bAnimate = true; var type = $(this).parent().attr('id').split('_')[1]; var holder = $('#holder_' + type); var left = holder.position().left + 618; var count = holder.find('.ig-entry-'+type).length-1; var iBullet = parseInt($('.ig-control-bullets-item-active').attr('id').split('_')[1]) - 1; iBullet = (iBullet < 0 ? count : iBullet); oPictureGaleries.updateBullets(iBullet, type); if(left > 0) { left = -618 * count; } $(holder).animate({left: (left)}, 'slow', 'swing', function() {oPictureGaleries.bAnimate = false;}); } }); $('.ig-control-bullets-item').click(function() { if (!oPictureGaleries.bAnimate) { oPictureGaleries.bAnimate = true; var type = $(this).parent().parent().attr('id').split('_')[1]; var iBullet = parseInt($(this).attr('id').split('_')[1]); oPictureGaleries.updateBullets(iBullet, type); var holder = $('#holder_' + type); var left = iBullet * -618; $(holder).animate({left: (left)}, 'slow', 'swing', function() {oPictureGaleries.bAnimate = false;}); } }); // galleries $('.ig-gal-control-prev').click(function() { if (!oPictureGaleries.bAnimate) { oPictureGaleries.bAnimate = true; var holder = $(this).parent().parent().find('.ig-gal-wrapper'); var offset = holder.find('.gallery_boxnine').width(); var left = $(holder).position().left + offset; var count = $(holder).find('.gallery_boxnine').length-1; if(left > 0) { left = -offset * count; } $(holder).animate({left: (left)}, 'slow', 'swing', function() {oPictureGaleries.bAnimate = false;}); } }); $('.ig-gal-control-next').click(function() { if (!oPictureGaleries.bAnimate) { oPictureGaleries.bAnimate = true; var holder = $(this).parent().parent().find('.ig-gal-wrapper'); var offset = holder.find('.gallery_boxnine').width(); var left = $(holder).position().left - offset; var count = $(holder).find('.gallery_boxnine').length-1; if(left < (-offset * count)) { left = 0; } $(holder).animate({left: (left)}, 'slow', 'swing', function() {oPictureGaleries.bAnimate = false;}); } }); } /** * sets "active" bullet filled * (in the bullet navigation in picture galeries and the news achive) */ ,updateBullets: function(index, location) { if (!location || $.trim(location)=='') {location = "";} $('.ig-control-bullets-item').removeClass('ig-control-bullets-item-active'); $('#bullet_' + index + '_' + location).addClass('ig-control-bullets-item-active'); } } // lighbox management var oLightbox = { /** * sets up events for the colorbox * some for opening the box, some for the box behavior */ init: function() { // media-lightboxen $('.lightbox-media').click(function(){ var aPictures = $('a[rel=gallery-thump-' + $(this).attr('id').substr(9) + ']'); aPictures.colorbox({ slideshow: false ,width: 600 ,height: 430+28 ,scalePhotos: false ,scrolling: false ,photo: true ,opacity: 0.70 ,current: (oLanguages.getActiveLanguage() == 'de'? 'Bild {current} von {total}' : 'Picture {current} of {total}') ,previous: 'voriges' ,next: 'nächstes' ,close: 'schließen' ,open: true }); }); // text-lightboxen $('.lightbox-text').click(function(){ var sId = $(this).attr('id').substr(9); $.colorbox({ slideshow: false ,width: 600 ,height: 430+28 ,scrolling: false ,opacity: 0.70 ,current: (oLanguages.getActiveLanguage() == 'de'? 'Bild {current} von {total}' : 'Picture {current} of {total}') ,previous: 'voriges' ,next: 'nächstes' ,close: 'schließen' ,open: true ,inline: true ,href: '#lb-content-'+sId }); }); // triggers when colorbox open/change content $(document).bind('cbox_complete', function() { // check for video var oActualElem = $.colorbox.element(); var sMediaPath = oActualElem[0].pathname; var aMediaPath = sMediaPath.split('/'); var aMediaFileName = aMediaPath[aMediaPath.length-1].split('.'); var bVideo = (aMediaFileName[aMediaFileName.length-2] == 'video'); // show video if (bVideo) { // get video path aMediaPath.pop(); var sVideoPath = aMediaPath.join("/") + '/' + aMediaFileName[0].split('_')[0] + '.mp4'; // render video $('#cboxLoadedContent').html("
"); jwplayer('mediaspace').setup({ 'flashplayer': '/wp-content/themes/chio2011/jwplayer/player.swf' , 'file': sVideoPath , 'image': sMediaPath , 'controlbar': 'over' , 'dock': 'false' , 'width': '600' , 'height': '430' , 'icons': 'false' }); } }); } } // functions to manage team meber display var oTeamView = { /** * initializes the team meber view */ oAllHtml:null ,init: function() { oTeamView.oAllHtml = $($('#team').html()); oTeamView.oAllHtml.find('img').each(function(){ var me=$(this); var sDataSrc = me.attr('data-src'); if(sDataSrc.length > 0) { me.attr('src',sDataSrc) .attr('data-src',''); } }); $('#team-chio-span').click( function(){oTeamView.show(this, 'team')}); $('#team-alrv-span').click( function(){oTeamView.show(this, 'team-alrv')}); $('#team-art-span').click( function(){oTeamView.show(this, 'team-art')}); $('#team-art li, #team-alrv li').click( function(){oTeamView.show(this, 'team-' + $(this).attr('id'))}); $('li.team').live( 'click' ,function(){ var sTargetId = $(this).attr('id').replace('-','-info-'); $.colorbox({ slideshow: false ,width: 600 ,height: 430+28 ,scrolling: false ,opacity: 0.70 ,current: (oLanguages.getActiveLanguage() == 'de'? 'Bild {current} von {total}' : 'Picture {current} of {total}') ,previous: 'voriges' ,next: 'nächstes' ,close: 'schließen' ,open: true ,inline: true ,href: '#'+sTargetId }); } ); } ,show: function(oDom, sClass){ $('#team-roles li, #team-roles span').removeClass('menu_state_active'); $(oDom).addClass('menu_state_active'); $('#team').quicksand(oTeamView.oAllHtml.filter('.'+sClass)); } } // language control elements in header var oLanguages = { /** * this function handles clicks on the language buttons */ init: function() { $('#sitemap-german').click(function(){ document.location.href= "/de" + oLanguages.getPageUrl(); }); $('#sitemap-english').click(function(){ document.location.href= "/en" + oLanguages.getPageUrl(); }); $('#top-logo').click(oLanguages.goHome) } /** * returns url without language */ ,getPageUrl:function() { var sPath = document.location.pathname + document.location.search; var sLang = sPath.substr(0,4); if(sLang == '/de/' || sLang == '/en/') { sPath = sPath.substr(3); } return sPath; } /** * returns active language */ ,getActiveLanguage: function() { var sPath = document.location.pathname; var sLang = sPath.substr(0,4); if(sLang == '/en/') { return 'en'; } return 'de'; } /** * navigates to the home of the corresponding language */ ,goHome: function() { document.location.href='/' + oLanguages.getActiveLanguage() + '/'; } } // calendar control var oCalendar = { /** * sets up calendar click events */ init: function() { $('.cal-item,.cal-item-active').click(function(){ var iTimestamp = $(this).attr('id').split('-')[1]; document.location.href= "/" + oLanguages.getActiveLanguage() + "/events-page#" + iTimestamp; }); } } /** * handels setup and control of the contentflow libary */ var oCoverFlow = { aImageData: [] ,oCf: {} ,bInteractive: false ,bReady: false /** * sets up the contentflow libary and initializes the waiting for the preloaded images */ ,init: function() { if($('#contentFlow').length == 0) { return; } oCoverFlow.parseImages(); //oCoverFlow.createCoverflowObject(); oCoverFlow.checkImageLoadStatus(); } /** * creates the coverflow object itself */ ,createCoverflowObject: function() { function setInteractive() { oCoverFlow.bInteractive = true; } oCoverFlow.oCf = new ContentFlow ( 'contentFlow' ,{ reflectionHeight: 0.2 ,fixItemSize: false ,scrollWheelSpeed: 0 ,onclickInactiveItem: setInteractive ,onclickActiveItem: function(oItem) { oHistory.load(oCoverFlow.aImageData[oItem.index]); } ,onclickPreButton: function() { oActiveItem = oCoverFlow.oCf.getActiveItem(); oCoverFlow.oCf.moveTo(oActiveItem.pre); } ,onclickNextButton: function() { oActiveItem = oCoverFlow.oCf.getActiveItem(); oCoverFlow.oCf.moveTo(oActiveItem.next); } } ); } /** * reads image alt tags from dom */ ,parseImages: function() { oCoverFlow.aImageData = []; $('#contentFlow img.item').each(function(){ oCoverFlow.aImageData.push($(this).attr('alt')); }); } /** * check if all images are loaded */ ,checkImageLoadStatus: function() { var bCheckAgain = false; $('#coverflow .flow img.item').each(function() { if (!$(this)[0].complete) { bCheckAgain = true; return false; } }); if (bCheckAgain) { setTimeout(function() {oCoverFlow.checkImageLoadStatus();}, 100); } else { var iItemNum = $('#coverflow .flow img.item').length; $('.loading').removeClass('loading'); oCoverFlow.createCoverflowObject(); oCoverFlow.oCf.init(); oCoverFlow.bReady = true; if (iItemNum > 1) { setTimeout(function() {oCoverFlow.showControls();}, 300); } } } /** * update */ ,update: function(iId) { for(i in oCoverFlow.aImageData) { if(iId == oCoverFlow.aImageData[i]) { oCoverFlow.bInteractive = false; if (oCoverFlow.bReady) { oCoverFlow.oCf.moveTo(i); } return true; } } return false; } /** * show controls */ ,showControls: function() { $('.preButton').show(); $('.nextButton').show(); } } /** * eventhandlers and lightboxex for chio-events (=Veranstaltungen) */ var oEvents = { /** * setup click events on load */ init: function() { // setup events $('.event-list-content-info').click(function() { var iEventId = parseInt($(this).parent().attr('id').split('-')[3]); oEvents.showEventDetail(iEventId); }); $('.event-list-content-action').click(function() { var iEventId = parseInt($(this).parent().attr('id').split('-')[3]); oEvents.showEventDetail(iEventId); }); $('.event-list-content-more').click(function() { var iEventId = parseInt($(this).parent().attr('id').split('-')[3]); window.location.href = "/" + oLanguages.getActiveLanguage() + "/starterlisten#event-" + iEventId; }) } /** * displays an event detail in a light box */ ,showEventDetail: function(iEventId) { // setup event details var sTitle = $('#event-list-content-' + iEventId).find('.event-list-content-action-title').text(); var sImage = $('#event-list-content-' + iEventId).find('.event-list-content-hidden-image').text(); var sSponsorImg = $('#event-list-content-' + iEventId).find('.event-list-content-hidden-sponsor').text(); var sContent = $('#event-list-content-' + iEventId).find('.event-list-content-hidden-text').html(); var sMediaDesc = $('#event-list-content-' + iEventId).find('.event-list-content-hidden-imagedesc').text(); var sType = (sImage !='about:blank' && $.trim(sImage) != '' ? 'media' : 'text'); var sEventHtml = '' + sTitle + '
'+sMediaDesc+'
' + 'Ihre Stimme wurde gezählt.
":"Your vote has been counted.
")); $('#voting-navi').css('display','none'); } else { alert((oLanguages.getActiveLanguage() == 'de'?"Die angegebene Email Adresse ist für diese Umfrage bereits registriert.":"The given e-mail address is allready registered for this voting.")); } } , "json" ); } /** * helper: set width for the icon bar */ ,helperAdjustIconBarPosition: function() { var iWrpWidth = 402; var iWidth = $('#voting-navi-icons').width(); $('#voting-navi-icons').css('margin-left', (((iWrpWidth - iWidth) / 2) + 4) + 'px'); } /** * helper adjust heights of voting elements */ ,helperAdjustItemHeights: function() { var iMaxHeight = 230; $('#voting-items .voting-item').each(function(iIndex, oElem) { iMaxHeight = ($(this).height() > iMaxHeight? $(this).height() : iMaxHeight); }); $('#voting-items .voting-item').each(function(iIndex, oElem) { $(this).height(iMaxHeight); }); $('.voting-items-screen').height(iMaxHeight); } /** * super helper */ ,helperAdjustSettings: function() { oVoting.helperAdjustItemHeights(); oVoting.helperAdjustIconBarPosition(); } } /** * main init function */ $(document).ready(function(){ // very quick fix for IE slideDown/slideUp issues if ($.browser.msie && parseInt($.browser.version) < 9) { $.fx.off = true; } // advanced images post-loading $.fn.__orig_slidedown = $.fn.slideDown; $.fn.slideDown = function() { if(this.hasClass('sub-content') || this.hasClass('sub-content-news') || this.hasClass('sub-content-faq') || this.hasClass('faq-content')) { if(!this.hasClass('sub-content-images-visible')) { this.addClass('sub-content-images-visible') this.find('img').each(function(){ var me=$(this); var sDataSrc = me.attr('data-src'); if(sDataSrc.length > 0) { me.attr('src',sDataSrc) .attr('data-src',''); } }); } } return $.fn.__orig_slidedown.apply(this, arguments); } // iframe heights $('iframe#resultpage-frame').bind('load', function() { log('iframe loaded'); }); // call all inits oCoverFlow.init(); oSocial.init(); oHistory.init(); oPageFolding.init(); oLightbox.init(); oPictureGaleries.init(); oLanguages.init(); oCalendar.init(); oTeamView.init(); oEvents.init(); oTopMenu.init(); oFooterMenu.init(); oVoting.init(); });