function setContact(){$('#contact_form').submit(function(){$.post("r.php",'mode=' + $(this).attr('id').split('_')[0] + '&' + $("#" + $(this).attr('id')).serialize(), function(data){$('#contact_form label').css('color', '#000000');if(data.substr(0,1) == '|'){data = data.substr(1).split('|');for(var key in data){array = data[key].split('?');key = array[0];value = array[1].split(':');$('label', $('#' + key).parent()).css(value[0], value[1]);}}else{$('#contact_form input').val('');$('#contact_form textarea').val('');$('#contact_form #form_submit').val('Absenden');$('#contact_form .info').html(data);$('#contact_form .info').css({'position': 'absolute', 'visibility': 'hidden', 'display': 'block'});$('#contact_form .info').hide();height = $('#contact_form .info').height() + 'px';$('#contact_form .info').css({'display': 'block', 'position': 'relative', 'visibility': 'visible', 'height': '0px'});$('#contact_form .info').animate({'height': height, 'opcacity': 1}, function(){$(this).delay(3000).animate({'height': '0px', 'opacity': 0});});}});return false;});}function setEdit(sel){$(sel + ' .edit').css('cursor', 'crosshair').dblclick(function(e) {e.preventDefault();if($('#edit-' + $(this).attr('name'), $(this)).length > 0){return false;}if($(this).hasClass('editor') == true){setupEdi($(this), $(this).height());}else if($(this).hasClass('input') == true){elementID = 'edit-' + $(this).attr('name');ediContent = $.trim($(this).text());if(parseInt($(this).css('height')) < parseInt($(this).css('line-height'))){height = $(this).css('line-height');}else{height = $(this).css('height');}width = parseInt($(this).css('width'));if(width < 50){width = 50;}if($(this).css('display') == 'inline'){width = width+20;}$(this).html('<form method="post" action="/"><input onblur="save(\'' + elementID + '\');" type="text" name="' + elementID + '" id="' + elementID + '" style="display: inline; position: relative; width: ' + width + 'px; height: ' + height + '; line-height: ' + $(this).css('line-height') + '; background-color: transparent; border: none; text-align: ' + $(this).css('text-align') + '; vertical-align: ' + $(this).css('vertical-align') + '; color: ' + $(this).css('color') + '; font-size: ' + $(this).css('font-size') + '; font-weight: ' + $(this).css('font-weight') + '; font-style: ' + $(this).css('font-style') + ';"value="' + ediContent + '" /></form>');$('#' + elementID).focus();}});}function setupEdi(o, ediHeight){rLock = 1;elementID = 'edit-' + o.attr('name');$('div.scrolled', o).css({height: '0px', display: 'none'}).removeClass('scrolled');if(o.val()){ediContent = o.val();}else{ediContent = o.html();}ediContent = '<div class="editor_style_helper" style="float: right; padding-bottom: ' + $('#content .right').css('padding-bottom') + '; margin-left: ' + (parseInt($('#content .right').css('margin-left'))-3) + 'px; margin-bottom: ' + $('#content .right').css('margin-bottom') + '; width: ' + $('#content .right').width() + 'px; height: ' + $('#content .right').height() + 'px;"></div>' + ediContent;o.html('<form method="post" action="/"><textarea class="editor" name="' + elementID + '" id="' + elementID + '" style="visibility: hidden; width: 100%; height: ' + (ediHeight+50) + 'px;">' + ediContent + '</textarea></form>');tinyMCE.init({	 /* General options */	 mode : "exact",	 elements : elementID,	 theme : "advanced", skin : "o2k7",	 skin_variant : "silver", language: "de", plugins : "autoresize,safari,table,save,advhr,advimage,advlink,emotions,iespell,inlinepopups,insertdatetime,searchreplace,print,contextmenu,paste,directionality,fullscreen,visualchars,nonbreaking,xhtmlxtras",/* Theme options */ theme_advanced_buttons1 : "bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,|,fontselect,fontsizeselect,|,forecolor,backcolor,|,fullscreen,|,saveit", theme_advanced_buttons2 : "cut,copy,paste,pastetext,pasteword,|,search,replace,|,blockquote,|,undo,redo,|,link,unlink,cleanup,code,|,sub,sup,|,insertdate,inserttime,|,charmap,emotions,iespell,addimg", theme_advanced_buttons3 : "", theme_advanced_buttons4 : "", theme_advanced_toolbar_location : "external", theme_advanced_toolbar_align : "center", theme_advanced_statusbar : false, theme_advanced_resizing : true, theme_advanced_resize_horizontal : false, entity_encoding : "named", forced_root_block : '',	 force_p_newlines : false, force_br_newlines : true, content_css : "/s/e/c.css", cleanup : true, auto_focus : elementID, setup : function(ed) { ed.addButton("addimg", { title : "Bild hinzufügen", image : "/s/i/tree.gif", onclick : function() {qUpload();} }); ed.addButton("saveit", { title : "Inhalte speichern", image : "/s/i/ok-s.png", onclick : function() {$('div.scrolled').animate({height: '0px'}, function(){$(this).removeClass('scrolled').css('display', 'none');}); save(elementID);} }); }, oninit: function() { document.getElementById(elementID).style.visibility = "visible"; $('#' + elementID +'_ifr').contents().find('body div.more').click(function(e){liCh(this);});$('#' + elementID +'_ifr').contents().find("#services li").click(function(e){liCh(this);}); $('#' + elementID +'_ifr').contents().find("div.team").mouseover(function(e){$("div.team").not($(this)).fadeTo(600, 0.5);$("div.team").css('background-color', 'transparent');$(this).fadeTo(500, 1).css('background-color', '#eeeeee');$("#pers_desc").css('display', 'block').html($("div", this).html());}); }});pos = $('#content .right').position();$('#content .right').css({position: 'absolute', left: pos.left + 'px'});$('#content').css({overflow: 'visible'});}function setHyphenator(){}function setLinks(sel){$(sel + " a").click(function(e){link($(this), e);}).css('cursor', 'pointer');$(sel + " #services li").click(function(e){liCh(this);});$(sel + " div.team").mouseover(function(e){$("div.team").not($(this)).fadeTo(600, 0.5);$("div.team").css('background-color', 'transparent');$(this).fadeTo(500, 1).css('background-color', '#eeeeee');$("#pers_desc").css('display', 'block').html($("div", this).html());});$(sel + " .roundit").corner("40px");$(sel + " .roundit_tl").corner("cc:#C6C9C9 tl 40px");$(sel + " .roundit_tr").corner("tr 40px");$(sel + " .roundit_br").corner("br 40px");}function link(o, e, x){if($("#content:animated") && $("#content:animated").length != 0){return false;}if(e != 0){e.preventDefault();}if(x != 1 && (typeof o) == 'object' && o.css('cursor') == 'crosshair'){setTimeout(function(){link(o, e, 1);}, 500);return false;}if((typeof o) == 'object' && $('#edit-' + o.attr('name'), o).length > 0){return false;}if(e != 0){if(o.parent().attr('class') != 'menu'){$(".menu a b").css('color', '#ffffff');$(".menu a.now").attr('class', '');}url = o.attr('href');o.attr('id', 'nav_now');}else{url = o;}if(url != url.replace("@","") || url.substr(0, 7) == 'http://' || url.substr(0, 8) == 'https://'){location.href = url;return false;}if(e != 0 && o.attr('target') == '_blank'){var newWindow = window.open(o.attr('href'), '_blank');newWindow.focus();return false;}mode = url.split('/')[1].split('.php')[0];id = 0;if(url.split('id=')[1]){id = url.split('id=')[1].split('&')[0];}$("#content").attr('id', 'old_content');$.get("r.php", { mode: mode, id: id },function(data){var time = new Date();loadPage($("#nav_now"), data, time.getTime());$(this).attr('id');});return false;}preImgLoad = new Array('/s/i/right_0.jpg','/s/i/right_1.jpg','/s/i/right_2.jpg','/s/i/right_3.jpg','/s/i/right_4.jpg','/s/i/right_5.jpg','/s/i/right_6.jpg','/s/i/right_7.jpg','/s/i/right_8.jpg');function loadImgs(num){img = new Image();img.src = preImgLoad[num];if(img.complete){num++;if(num < preImgLoad.length){setTimeout(function(){loadImgs(num);}, 300);}}else{setTimeout(function(){loadImgs(num);}, 300);}}function loadPage(o, data, oTime){img = new Image();pos = data.indexOf("background-image: url('")+24;url = data.substr(pos, data.indexOf("');", pos)-pos);img.src = url;var time = new Date();if(url == '' || img.complete || (time.getTime()-oTime) >= 90){mainHeight = $("#main").height() + 'px';$("#old_content").css({'position': 'absolute', 'z-index': '1', 'margin-top': '0px'}).animate({height: '0px'}, 600, function(){$(this).remove();});$("#main").css({'overflow': 'hidden', 'height': mainHeight}).append(data);$("#content").css({'visibility': 'hidden', 'height': 'auto', position: 'absolute', 'height': 'auto','z-index': '2'});conHeight = $("#content").height() + 'px';$("#main").animate({height: conHeight});Hyphenator.run();$("#content").css({'visibility': 'visible', 'height': '80px', 'background-color': '#ffffff'}).animate({'height': conHeight}, 1000, function(){$("#main").css({'overflow': 'visible', 'height': 'auto'});$(this).css({'position': 'relative', 'height': 'auto', 'background-color': 'transparent'});}); $(".content div.more").click(function(e){liCh(this);});preTitle = '';if(spli = document.title.split('-')){preTitle = spli[0] + ' - ';}document.title = preTitle + $("#content h1").html();location.hash = '#' + mode + '-' + id;setLinks("#content");setEdit('#content');setContact();}else{setTimeout(function(){loadPage(o, data, oTime)}, 100);}}function setLogin(){$('#login').submit(function(e){if(e != 0){e.preventDefault();}if($('#login input[name="login_mail"]').val() && $('#login input[name="login_passwd"]').val()){$.post("r.php", { mode: 'login', mail: $('#login input[name="login_mail"]').val(), passwd: $('#login input[name="login_passwd"]').val() },function(data){r = data.split('|');$('#login').html($('#login').html() + '<div class="info">' + r[1] + '</div>'); height = $('#login .info').css({height: 'auto', position: 'absolute', visibility: 'hidden'}).height();$('#login .info').css({height: '0px', position: 'relative', visibility: 'visible'}).animate({height: (height+10) + 'px'}, 400, function(){$(this).delay(2000).animate({height: '0px'}, 600, function(){$(this).remove(); if(r[0] == 1){location.reload();}});});});}return false;});$('.logout').click(function(e){if(e != 0){e.preventDefault();}$.post("r.php", { mode: 'login', logout: 1 },function(data){r = data.split('|');$('#session_info').html($('#session_info').html() + '<div class="info">' + r[1] + '</div>'); height = $('#session_info .info').css({height: 'auto', position: 'absolute', visibility: 'hidden'}).height();$('#session_info .info').css({height: '0px', position: 'relative', visibility: 'visible'}).animate({height: (height+10) + 'px'}, 400, function(){$(this).delay(2000).animate({height: '0px'}, 600, function(){$(this).remove(); if(r[0] == 1){location.reload();}});});});return false;});}function setNav(){var navTO;function fixNav(){if($(window).scrollTop() >= 450){$('#nav .menu').css({position: 'fixed', top: '-240px'});$('#nav .menu a').css({opacity: 1});}else{$('#nav .menu').css({position: 'relative', top: ''});$('#nav .menu a').css({opacity: 0.7});}}$(window).scroll(function () { fixNav();});$("#nav .screen span").fadeTo(1, 0);$("#nav .screen span:eq(0)").css('display', 'block').fadeTo(600, 1);$('#nav .menu').css({'z-index': '3'});$("#nav .menu a").css({opacity: 0.7}).hover(function(){$(".menu a b").css('color', '#ffffff');$(".menu a.now b").css('color', '#ff8c00');$("b", this).css('color', '#ff8c00');	clearTimeout(navTO);$(this).fadeTo(400, 1);n = ($("#nav .menu a").index(this)+1);$("#nav .screen span").css('display', 'none'); $("#nav .screen span:eq(" + n +")").css('display', 'block').fadeTo(400, 1);},function(){if($(window).scrollTop() <= 500){$(this).fadeTo(600, 0.7);}$(".menu a b").css('color', '#ffffff');$(".menu a.now b").css('color', '#ff8c00');navTO = setTimeout(function(){$("#nav .screen span").css('display', 'none'); $('#nav .screen span:eq(0)').fadeTo(400, 1);}, 100);}).click(function(event){$(this).trigger('mouseout');$(".menu a b").css('color', '#ffffff');$(".menu a.now").attr('class', '');$(this).attr('class', 'now');$("b", this).css('color', '#ff8c00');return false;});$('#nav .screen').hover(function(){clearTimeout(navTO);},function(){navTO = setTimeout(function(){$("#nav .screen span").css('display', 'none'); $('#nav .screen span:eq(0)').fadeTo(400, 1);}, 100);});$("#nav a span").mouseover(function(){$(this).parent().trigger('mouseover');});}$(document).ready(function(){$('body').css({'opacity': 0}).animate({'opacity': 1}, 1500);setUnSel();setHyphenator();setNav();setContact();setLogin();setLinks("body");setRefs();setEdit('body');setTimeout(function(){setScreen();}, 1500);if(location.hash){$("#content").html('');setTimeout(function(){link(location.hash.replace('#', '/').replace('-', '.php?id='), 0);}, 1500);}$('a[href*=#]').bind("click", function(e){e.preventDefault();var ziel = $(this).attr("href");if($(ziel).offset()){$('html,body').animate({scrollTop: $(ziel).offset().top}, 2000 , function (){location.hash = ziel;});}});});function setRefs(){$('#refs li div').mouseenter(function(){if($('.overi', this).length == 0){i = $(this).css('backgroundImage').split('/');nI = ($(this).css('backgroundImage').replace(i[(i.length-1)], '') + 'o/' + i[(i.length-1)]);$(this).append('<div class="overi"></div>');$('.overi', this).css({top: '0px', left: '0px', backgroundImage: nI, opacity: 0});}$('.overi', this).animate({opacity: 1}, 600);}).mouseleave(function(){$('.overi', this).animate({opacity: 0}, 1000, function(){$('.overi', this).remove();});});function cRefs(){$('#refs li:first').before($('#refs li:last'));$('#refs li:first').before($('#refs li:last'));$('#refs li:first').before($('#refs li:last'));$('#refs').css({marginTop: '-230px'});$('#refs').animate({marginTop: '0px'}, 2000);setTimeout(function(){cRefs();}, 5000);}refMax = parseInt(($('#refs li').length-1)/3)-1;while(refMax > 0){$('#refs li:last').after($('#refs li:eq(' + (refMax*3) + ')'));$('#refs li:last').after($('#refs li:eq(' + (refMax*3) + ')'));$('#refs li:last').after($('#refs li:eq(' + (refMax*3) + ')'));refMax--;}refMax = parseInt(($('#refs li').length-1)/3);setTimeout(function(){cRefs();}, 5000);}function save(o){id = o.replace('edit-', '');if($('#' + o).hasClass('editor') && tinyMCE.get(o)){tinyMCE.get(o).setProgressState(1);value = tinyMCE.get(o).getContent();}else{value = $('#' + o).val();}$.post("r.php", { mode: 'save', table: id.split('-')[0], id: id.split('-')[1], col: id.split('-')[2], value: value },function(data){r = data.split('|');if(r[0] == 1){if($('#edit-' + r[1]).hasClass('editor') && tinyMCE.get('edit-' + r[1])){$('#content .right').css({position: 'relative', left: '0px'});$('*[name=' + r[1] + ']').html(tinyMCE.get('edit-' + r[1]).getContent());$('*[name=' + r[1] + '] .editor_style_helper').remove();$(".content div.more").click(function(e){liCh(this);});}else{$('*[name=' + r[1] + ']').html($('#edit-' + r[1]).val());}}else{alert('failed' + r);tinyMCE.get(o).setProgressState(1);}});}function setScreen(){inum = $('.right .screen').css('background-image').split('right_')[1].split('.')[0];img = new Image();img.src = "http://glaubundglaub.de/s/i/right_" + inum + ".jpg";if(!img.complete){setTimeout(function(){setScreen();}, 300);return false;}inum++;if(inum > 8){inum = 0;}nscreen = $('.right .screen').clone();$('.right .screen').attr('id', 'screen');if(navigator.appName == 'Microsoft Internet Explorer'){nscreen.attr('id', 'nscreen').css({opacity: 1, width: '200px', visibility: 'hidden', 'background-position-x': '0px', backgroundImage: "url('/s/i/right_" + inum + ".jpg')"});$('.right #screen').after(nscreen);$('.right #screen').css({position: 'absolute', marginLeft: '0px', width: '200px', zIndex: '3'}).animate({'background-position-x': (200 - img.width) + 'px'}, 5000, function(){$('#nscreen').css({visibility: 'visible'});$(this).animate({'background-position-x': (-img.width) + 'px', opacity: 0}, 2000, function(){$(this).remove(); setScreen();});});}else{nscreen.attr('id', 'nscreen').css({opacity: 1, width: '200px', visibility: 'hidden', 'background-position': '0px 0px', backgroundImage: "url('/s/i/right_" + inum + ".jpg')"});$('.right #screen').after(nscreen);$('.right #screen').css({position: 'absolute', marginLeft: '0px', width: '200px', zIndex: '3'}).animate({'background-position': (200 - img.width) + 'px 0px'}, 5000, function(){$('#nscreen').css({visibility: 'visible'});$(this).animate({'background-position': (-img.width) + 'px 0px', opacity: 0}, 2000, function(){$(this).remove(); setScreen();});});}}function liCh(o, x){if($('div', o).css('display') == 'block'){$('div', o).animate({height: '0px'}, function(){$(this).removeClass('scrolled').css('display', 'none');});return false;}$('div.scrolled', o.parentNode).animate({height: '0px'}, function(){$(this).removeClass('scrolled').css('display', 'none');});$('div', o).css({'display': 'block', 'visibility': 'hidden', 'height': 'auto', 'z-index': '2'});conHeight = $('div', o).height() + 'px';$('div', o).css({'visibility': 'visible', 'height': '0px', 'z-index': '1'});$('div', o).addClass('scrolled').animate({height: conHeight});}function setUnSel(){function uSel(event){if(window.getSelection){var sel = window.getSelection();sel.removeAllRanges();}if(event){if (typeof event.preventDefault != 'undefined'){event.preventDefault();}}return false;}jQuery.fn.extend({ disableSelection : function() { return this.each(function() { this.style.cursor = 'default';this.onselectstart = function() { return false; }; this.onclick = uSel; this.unselectable = "on"; jQuery(this).css('user-select', 'none'); jQuery(this).css('-o-user-select', 'none'); jQuery(this).css('-moz-user-select', 'none'); jQuery(this).css('-khtml-user-select', 'none'); jQuery(this).css('-webkit-user-select', 'none'); }); } });$(".unselect").disableSelection();}
