$(window).load(function(){var projectViewActive=false;var loadingContent=$('#id_load').html();pageLoad();function pageLoad(){loadJobNav();loadFooterNav();fadeEffect();removeBreaks();if(langID === 2){$('#project-close span').css('left','-82px');$('#footer #footer-nav span#footer-nav-jobs').remove();}$('#wpadminbar').remove();};function loadJobNav(){$('#jobs .job').each(function(index,elm){var title=$(elm).find('h2').html();if(title!=='Jobvorlage'){$('#job-nav ul').append('<li'+(index===0?' class="active"':'')+'>'+title+'</li>')}});$('#job-nav ul li').live('click',function(){$('#job-nav ul li').removeClass('active');$(this).addClass('active');var activeJobTitle=$(this).html();$('.job').removeClass('active');$('.job').find('h2:contains("'+activeJobTitle+'")').parent().parent().addClass('active')})};function loadFooterNav(){var activeFooterButton='';$('#footer-nav span').live('click',function(){$('#footer-nav span').removeClass('active');var footerNavID=$(this).attr('id');if(footerNavID!==activeFooterButton){$(this).addClass('active');switch(footerNavID){case"footer-nav-team":$('#footer-jobs').slideUp(300);$('#footer-impressum').slideUp(300);$('#footer-team').slideDown(300);break;case"footer-nav-jobs":$('#footer-team').slideUp(300);$('#footer-impressum').slideUp(300);$('#footer-jobs').slideDown(300);break;case"footer-nav-impressum":$('#footer-jobs').slideUp(300);$('#footer-team').slideUp(300);$('#footer-impressum').slideDown(300);break}activeFooterButton=footerNavID;$('#footer .separator-small').css('visibility','visible');$('html,body').animate({scrollTop:$('#footer-nav').offset().top-50},300)}else{$('#footer-jobs').slideUp(300);$('#footer-impressum').slideUp(300);$('#footer-team').slideUp(300);activeFooterButton='';$('#footer .separator-small').css('visibility','hidden')}})};function fadeEffect(){$('#header #logo #logo-dot').fadeIn(1500);$('body').css('height','1000px');setTimeout(function(){$('#header #intro-text').fadeIn(500);setTimeout(function(){$('#header .separator-big, #main, #main-top, #footer-container, #language-switcher, #banner').fadeIn(500);setTimeout(function(){loadProjectPreview()},100)},600)},500)};function removeBreaks(){$('#references').find('br').remove()};function loadProjectPreview(){function loadPreview(data){var i=1;(function displayProjects(){if(i<14){var thisID='id'+i;var $thisSelector=$('#'+thisID);var snippet=$(data).filter(function(index){return $(this).attr("id")==thisID+'p'});$thisSelector.html(snippet);var time=i*100;showProject(thisID,time);var imgAltAttr=$thisSelector.find('span p').text();$thisSelector.find('img').attr('title',imgAltAttr);var linkImgPre=$thisSelector.find('a').html();$thisSelector.find('a').remove();$thisSelector.append(linkImgPre);i++;displayProjects()}else{return false}})()};function showProject(id,time){setTimeout(function(){$('#'+id).show();$('#'+id).animate({'margin-top':'20px',opacity:1},300)},time)};$.ajax({url:'http://www.redonion.de/?page_id=175&json=1&lang='+langID,success:function(data){data=$.trim(data);loadPreview(data);$('#projects').css('background','none')}});$('.project').hide().css({'margin-top':'300px',opacity:0})};function loadProject(filterID){$.ajax({url:'http://www.redonion.de/?page_id=175&json=1&project_id='+filterID.replace('id','')+'&lang='+langID,success:function(data){data=$.trim(data);var projectContent=$(data).filter('#'+filterID);$('#project-content').html(projectContent);$('#project-slide-nav').show();$('#project-img p, #project-img div').each(function(){$('#project-img').append($(this).html());$(this).remove()});if(filterID === 'id5'){$('#banner_ipg').show();}$('#project-img').find('br').remove();var i=0;$('#project-img a').each(function(){var linkImg=new Array();linkImg[i]=$(this).html();$(this).remove();$('#project-img').append(linkImg[i]);i+=1});$('#project-img div, #project-img img, #project-img iframe').each(function(){$(this).wrap('<div></div>')});$('#project-img div').first().fadeIn(500).addClass('active');if($('#project-img div').length<2){$('#project-slide-nav').hide()}$('#project-img').css('background','#000')}})};$('#projects-own, #projects-customer').click(function(){switchProjectView($(this).attr('id'))});function switchProjectView(id){if($('#'+id).hasClass('active')){}else{$('.project').fadeOut(300);setTimeout(function(){if(id==='projects-own'){$('#projects').css('height','440px');$('.project.own').fadeIn(300)}else{$('#projects').css('height','1060px');$('#c1 .project.small.customer').prependTo('#c1');$('#c2 .project.small.customer').appendTo('#c2');$('#c3 .project.small.customer').prependTo('#c3');$('.project.customer').fadeIn(300)}$('#project-switch span').removeClass('active');$('#'+id).addClass('active')},300)}if(projectViewActive===true){closeProjectDetail()}};$('#project-close span, #project-close div').live('click',function(){closeProjectDetail()});function closeProjectDetail(){$('#banner_ipg').hide();$('#project-section').slideUp(500);setTimeout(function(){$('#project-content').html(loadingContent)},500);projectViewActive=false;$('html,body').animate({scrollTop:$('#project-section').offset().top-120},300)};$('.project').hover(function(){var target=$(this).find('span');if(target.css('display')=='none'){target.toggle()}target.stop(true,false).animate({bottom:'0px'},300)},function(){var target=$(this).find('span');target.stop(true,false).animate({bottom:'-70px'},300,function(){if(target.height()==0){target.toggle()}})});$('.project').live('click',function(){var filterID=$(this).attr('id');loadProject(filterID);if(projectViewActive===false){projectViewActive=true;$('#project-section').slideDown(800)}else{$('#project-content').html(loadingContent)}$('html,body').animate({scrollTop:$('#project-section').offset().top-18},300)});$('div#slide-next').live('click',function(){slideSwitch('next')});$('div#slide-back').live('click',function(){slideSwitch('prev')});function slideSwitch(direction){var $active=$('#project-img div.active');if($active.length==0){$active=$('#project-img div:last')}if(direction==='prev'){var $prev=$active.prev().length?$active.prev():$('#project-img div:last');$active.fadeOut(500).removeClass('active');$prev.addClass('active').fadeIn(500)}else{var $next=$active.next().length?$active.next():$('#project-img div:first');$active.fadeOut(500).removeClass('active');$next.addClass('active').fadeIn(500)}}});
