﻿/*****************************************************// Seiten-Initialisierung, die für alle Seiten gleich ist******************************************************/var activeMenu = null;var oldX = 0;var oldY = 0;var mainMenuDiv = 'huerlimann';$(document).ready(function(){	// Mouseover für menu-links		$('.menuDiv').mouseenter( function(){				var id = $(this).attr('id');				if($('#' + id + ' .submenu').is(':hidden') && activeMenu == null){						$('.submenu').hide();			$('.subClaim').hide();						$('#' + id + ' .submenu').stop(true, true).fadeIn();			$('#' + id + ' .subClaim').stop(true, true).fadeIn();		}	});		$('.menuDiv').mouseleave( function(){				var id = $(this).attr('id');				if(activeMenu == null){			$('.submenu').stop(true, true).fadeOut();			$('.subClaim').stop(true, true).fadeOut();		}	});		// Links		$('.menuDiv a').click(function(){				var id = $(this).attr('href').replace('.html', '');		try{			pageTracker._trackPageview($(this).attr('href'));		}		catch(err){			// nothing		}		//_gaq.push(['_trackEvent', $(this).attr('href'), 'clicked']);				activeMenu = id;				var pos = $('#' + id).position();				oldX = pos.left;		oldY = pos.top;				// Exchange DIV positions				if(id != mainMenuDiv){						$('#' + mainMenuDiv).animate({				'left': oldX + 'px'			}, 1000);						$('#' + id).animate({				'left': '0px'			}, 1000, function(){				getSubPage(id + '.html');			});					}else{			getSubPage($(this).attr('href'));		}				return false;			});		// Direktlinks zu Subseiten		$('.submenu a, #newsBox a').unbind().click(function(){				var id = $(this).attr('href').replace('.html', '');				try{			pageTracker._trackPageview($(this).attr('href'));		}		catch(err){			// nothing		}				var topNavi = id.split('_').shift();		var subNav = id.split('_').pop();				if(topNavi != activeMenu)			closeSubDiv();				activeMenu = topNavi;				var pos = $('#' + topNavi).position();				oldX = pos.left;		oldY = pos.top;				// Exchange DIV positions				if(topNavi != mainMenuDiv){						$('#' + mainMenuDiv).animate({				'left': oldX + 'px'			}, 1000);						$('#' + topNavi).animate({				'left': '0px'			}, 1000, function(){				getSubPage(topNavi + "_" + subNav + '.html');			});					}else{			getSubPage(topNavi + "_" + subNav + '.html');		}				return false;			});					if(window.pageInit)		pageInit();});// Load the Sub-Pagefunction getSubPage(page){		$.get(page, function(data){				// Schliessen-Button anhängen				var btnClose = '<a href="javascript:void(0);" onclick="closeSubDiv();" title="Schliessen" class="btnClose"></a>';				var body = jQuery(data).find('#pageContent').html();				$('#pageContent').html(body);				$('.subseiteMenu a').click(function(){						$('.subseiteColumnRight').fadeOut();						var PageLink = $(this).attr('href');			try{				pageTracker._trackPageview($(this).attr('href'));			}			catch(err){				// nothing			}						var base = window.location.href.substring(0, window.location.href.lastIndexOf("/") + 1);			PageLink = PageLink.replace(base, ""); 						getContent(PageLink);			return false;		});		$('.submenu').hide();		$('#pageContent').append(btnClose);				$('#illustrations').load("php/ajax/modules/gallery/mod.gallery.output.php?page="  + page, function(){			$('a[rel="lightbox-illus"]').lightbox();		});				$('#pageContent').fadeIn();	});		return false;}function getContent(page){		$.get(page, function(data){				var btnClose = '<a href="javascript:void(0);" onclick="closeSubDiv();" title="Schliessen" class="btnClose"></a>';		var body = $('#pageContent', data);				$('#pageContent').html(body.html());				$('.subseiteMenu a').click(function(){						$('.subseiteColumnRight').fadeOut();						var PageLink = $(this).attr('href');						var base = window.location.href.substring(0, window.location.href.lastIndexOf("/") + 1);			PageLink = PageLink.replace(base, ""); 						getContent(PageLink);			return false;		});			// Bind Forms if available				bindForms();				$('#pageContent').append(btnClose);		$('.subseiteColumnRight').fadeIn();				// Show Images for this page			$('#illustrations').load("php/ajax/modules/gallery/mod.gallery.output.php?page="  + page, function(){			$('a[rel="lightbox-illus"]').lightbox();		});				// init js if available				if(newsletterAboInit())			return true;	}, "html");		return false;}function bindForms(){		$('#nwEditorForm_huerlimann_kontakt').bind('submit', function(){				var serial = $('#nwEditorForm_huerlimann_kontakt').serialize();				$.post($('#nwEditorForm_huerlimann_kontakt').attr('action'), serial, function(data){			var html = $(data).find('#innerContent').html();			$('#innerContent').html(html);			bindForms();		});				return false;	});		$('#nwEditorForm_oldInn_kontakt').bind('submit', function(){				var serial = $('#nwEditorForm_oldInn_kontakt').serialize();				$.post($('#nwEditorForm_oldInn_kontakt').attr('action'), serial, function(data){			var html = $(data).find('#innerContent').html();			$('#innerContent').html(html);			bindForms();		});				return false;	});		}function closeSubDiv(){		$('#pageContent').fadeOut();		// Exchange Menu Divs		if(activeMenu != mainMenuDiv){		$('#' + mainMenuDiv).animate({			'left': '0px'		}, 1000);				$('#' + activeMenu).animate({			'left': oldX + 'px'		}, 1000);	}		activeMenu = null;	}/*****************************************************//Kontakt- und Newsletter-Form/*****************************************************//*****************************************************//Ajax-Response parsen/*****************************************************/function server_response(data){		var retVal = data.split("^^^^");		return retVal;}
