/* START: public/CMS/js/jQuery/fileTree/jqueryFileTree.js */
if(jQuery)(function($){function scrollFileListWrappers(){var offset;$('.fileListWrapper').each(function(){var container=$(this),selected=container.find('.expanded');if(selected.length>0){offset=selected.offset().top-container.offset().top+container.scrollTop();container.animate({scrollTop:offset-50})}});$('#pageConfigWrapper').find('div.fileListWrapper ul.jqueryFileTree li.file > a').each(function(){var that=$(this);if(!that.data('hasConfigEvent')){that.data('hasConfigEvent',true);that.on('click',function(){var contentElementWrap=that.closest('.contentElementWrap'),scriptConfig=contentElementWrap.find('> .scriptConfig'),configButton=contentElementWrap.find('button.startConfig'),data={scriptFilePath:that.attr('rel'),content_id:that.closest('[content_id]').attr('content_id')};Phelic_Ajax('CMS/ajax/getScriptConfigHtml.php',data,true,function(result){result=$(result);scriptConfig.replaceWith(result);if(result.find('*').length==0){configButton.fadeOut()}else configButton.fadeIn()});return false})}})};$.extend($.fn,{fileTree:function(options,fileFunction,folderFunction){if(!options)var o={};if(options.root==undefined)options.root='/';if(options.script==undefined)options.script='CMS/ajax/jQueryFileTree.php';if(options.folderEvent==undefined)options.folderEvent='click';if(options.expandSpeed==undefined)options.expandSpeed=500;if(options.collapseSpeed==undefined)options.collapseSpeed=500;if(options.expandEasing==undefined)options.expandEasing=null;if(options.collapseEasing==undefined)options.collapseEasing=null;if(options.multiFolder==undefined)options.multiFolder=true;if(options.loadMessage==undefined)options.loadMessage='Loading...';if(options.onFinish==undefined)options.onFinish=function(){};if(options.selectedPath==undefined)options.selectedPath='';$(this).each(function(){function showTree(parentElement,pathToFile){$(parentElement).addClass('wait');$(".jqueryFileTree.start").remove();$.post(options.script,{dir:pathToFile},function(data){$(parentElement).find('.start').html('');$(parentElement).removeClass('wait').append(data);if(options.root==pathToFile){$(parentElement).find('ul:hidden').show()}else $(parentElement).find('ul:hidden').slideDown({duration:options.expandSpeed,easing:options.expandEasing});bindEvents(parentElement);var ul=$(parentElement).find('> ul');ul.find('li > a').each(function(){if(options.selectedPath.indexOf($(this).attr('rel'))==0){if($(this).attr('rel')=='')return;var li=$(this).closest('li');li.find('ul').remove();showTree(li,$(this).attr('rel'));li.removeClass('collapsed').addClass('expanded');if(options.selectedPath==($(this).attr('rel')))$(this).addClass('active')}});options.onFinish();scrollFileListWrappers()})}
function bindEvents(parentElement){$(parentElement).find('ul > li > a').bind(options.folderEvent,function(){if($(this).parent().hasClass('directory')){if($(this).parent().hasClass('collapsed')){if(!options.multiFolder){$(this).parent().parent().find('ul').slideUp({duration:options.collapseSpeed,easing:options.collapseEasing});$(this).parent().parent().find('li.directory').removeClass('expanded').addClass('collapsed')};$(this).parent().find('ul').remove();showTree($(this).parent(),escape($(this).attr('rel').match(/.*\//)));$(this).parent().removeClass('collapsed').addClass('expanded');folderFunction($(this).attr('rel'),$(this).closest('.jqueryFileTree'))}else{$(this).parent().find('ul').slideUp({duration:options.collapseSpeed,easing:options.collapseEasing});$(this).parent().removeClass('expanded').addClass('collapsed')}}else fileFunction($(this).attr('rel'),$(this).closest('.directory').find('>a').attr('rel'),$(this).closest('.jqueryFileTree'));$(this).toggleClass('active');return false});if(options.folderEvent.toLowerCase!='click')$(parentElement).find('li a').bind('click',function(){return false})};$(this).html('<ul class="jqueryFileTree start"><li class="wait">'+options.loadMessage+'<li></ul>');showTree($(this),escape(options.root))})}})})(jQuery)
/* END: public/CMS/js/jQuery/fileTree/jqueryFileTree.js */


/* START: public/CMS/js/global.js */
$(document).ready(function(){checkHashTab();$(window).on('hashchange',checkHashTab)
function checkHashTab(){var hash=window.location.hash;if((typeof hash=='undefined')||(hash==''))return;hash=hash.substr(1);$('div.tabSystem > ol > li').each(function(){if(($(this).attr('for')==hash)||($(this).text().trim().toLowerCase()==hash.toLowerCase())||($(this).text().trim().toLowerCase()==decodeURIComponent(hash).toLowerCase())){var li=$(this);li.trigger('click');setTimeout(function(){$([document.documentElement,document.body]).animate({scrollTop:li.offset().top-75},500)},500);return false}})};selectCurTopMenuItem()
function selectCurTopMenuItem(){var curMenuItem=$('#topNav').find('a[href="'+CURRENT_URL_KEY+'"]').closest('li');curMenuItem.addClass('active');curMenuItem.parentsUntil('#topNav','li, ol').each(function(){if($(this).prop('tagName').toLowerCase()=='li')$(this).addClass('active')})};$('div[type="survey"].content form input[type="checkbox"]').on('click',function(){var checkBox=$(this),isChecked=checkBox.is(':checked'),form=checkBox.closest('form'),minChoice=parseInt(form.attr('minChoice')),maxChoice=parseInt(form.attr('maxChoice')),checkboxes=form.find('input[type="checkbox"]'),selectCount=checkboxes.filter(':checked').length;if((minChoice==0)&&(maxChoice==0));else if((minChoice==1)&&(maxChoice==1)){form.find('input[type="checkbox"]').prop('checked',false);checkBox.prop('checked',isChecked)}else if(selectCount>maxChoice){if(minChoice==0){Phelic_showInfo('Sie können maximal nur '+maxChoice+' Optionen wählen!','warning',5)}else if(minChoice==maxChoice){Phelic_showInfo('Sie müssen genau '+minChoice+' Optionen wählen!','warning',5)}else Phelic_showInfo('Sie müssen zwischen '+minChoice+' und '+maxChoice+' Optionen wählen!','warning',5);return true}else if(selectCount<minChoice)if(isChecked){return true}else{if(maxChoice==0){Phelic_showInfo('Sie müssen mindestens '+minChoice+' Optionen wählen!','warning',5)}else if(minChoice==maxChoice){Phelic_showInfo('Sie müssen genau '+minChoice+' Optionen wählen!','warning',5)}else Phelic_showInfo('Sie müssen zwischen '+minChoice+' und '+maxChoice+' Optionen wählen!','warning',5);return true};Phelic_Ajax(form.attr('action'),serializeInputs(form),true,function(result){if(result!='success'){Phelic_showInfo('Fehler beim Speichern!','error');checkBox.prop('checked',!isChecked)}else Phelic_showInfo('Speichern erfolgreich!','success',3)})});var jWindow=$(window);$(window).on('scroll',adaptParallaxScrolling);$(window).on('resize',adaptParallaxScrolling);setTimeout(adaptParallaxScrolling,500)
function adaptParallaxScrolling(){var docViewTop=jWindow.scrollTop(),windowHeight=jWindow.height(),docViewBottom=docViewTop+windowHeight;$('.content[script="parallaxLayer"]').each(function(){var parallaxLayer=$(this);parallaxLayer.css('height','');var imageWrapper=$(this).find('.imageWrapper'),layerHeight=parallaxLayer.height(),picHeight=imageWrapper.find('img.dummy').height(),totalViewportHeightPx=windowHeight+$(this).height(),topPos=imageWrapper.offset().top,picTopFromViewportBottom=docViewBottom-topPos,progressPercent=Math.round(100*picTopFromViewportBottom/totalViewportHeightPx);progressPercent=Math.max(0,Math.min(100,progressPercent));var offsetPx=Math.round((progressPercent*(picHeight-layerHeight)/100));imageWrapper.css('background-position','0 -'+offsetPx+'px');if(layerHeight>picHeight)parallaxLayer.css('height',picHeight+'px')})}})
/* END: public/CMS/js/global.js */


