// JavaScript Document


	$(function()
			{
			var footerHeight=62;
			if(document.title.indexOf('Kids')>0){
				footerHeight=0;
			}
			
				
	var isResizing;
	
	
	// and the body scrollpane
	var setContainerHeight = function()
	{
		// IE triggers the onResize event internally when you do the stuff in this function
		// so make sure we don't enter an infinite loop and crash the browser
		if (!isResizing) { 
			isResizing = true;
			$w = $(window);
			$c = $('#content_wrapper');
			$textfade=$('#textfade');
			
			$toheight=$w.height()-footerHeight-193;
			$('.jScrollPaneContainer').css({'height': $toheight + 'px'});
			$c.css({'height': $toheight + 'px', 'overflow':'auto' , 'outline' : 'none', 'padding-bottom' : '5px'});
			$('.scrollpane').css('outline','none');
			$offset=$c.offset();
			
			if($w.width() < 1060){
				$('#col_right').css('width',$w.width()-380 + 'px');
				$c.css('width' , $w.width()-20 + 'px');
				$('.jScrollPaneContainer').css('width' , $c.width()+6 + 'px');
			}else{
				$('#col_right').css('width','690px');
				$c.css('width' , '1040px');
				$('.jScrollPaneContainer').css('width' , $c.width()+6 + 'px').css('outline','none');
			}
			
			$textfade.css({'width' : $c.width()-15 + 'px'});
			$c.jScrollPane();
			
			isResizing = false;
			
		}
		}
	
	setContainerHeight();
	setContainerHeight();
	
	$(window).bind('resize', setContainerHeight);
	});
	
	
	$(document).ready(function() {	

			$('.weiss').css('color','#ffffff');
			$('a.changepage').each(function(){
											window.open($(this).attr('href'),$(this).attr('target'));
											if($(this).attr('target')=='_blank'){
												history.go(-1);
											}
			});
			
			$('#menu_wrapper img.menuroll').hover(
				function () {
						this.src=this.src.replace(".p","_H.p");
					 },
				function () {
						this.src=this.src.replace("_H.p",".p");
					 }
				);
			
			
			var rep="<div class='w_hide'>";
			var htm=$('#col_right').html().replace(/--HIDE--/g,rep);
			
			
			var rep="</div><img src='ximg/weiter.jpg' class='weiter' />";
			var htm=htm.replace(/--END--/g,rep);
			
			$('#col_right').html(htm);
			$('div.w_hide').hide();
		
	
			
		$('img.weiter').css('cursor','pointer').click(function() {
 			 $(this).prev('div.w_hide').slideToggle('slow',function(){$(window).resize()});
			
			 if(this.src.indexOf("weiter")>0){
				 this.src="ximg/schliessen.jpg";
			 }else{
				 this.src="ximg/weiter.jpg";
			 }
 
		});
		
			$("#various3").fancybox({
				'width'				: 690,
				'height'			: 465,
				'padding'			: 32,
				'autoScale'			: false,
				'transitionIn'	: 'fade',
				'transitionOut'	: 'fade',
				'type'				: 'iframe',
				'overlayOpacity'	: 0,
				'showCloseButton'	: false
			});
			
			
			$("#kontaktpop").fancybox({
				'width'				: 690,
				'height'			: 465,
				'padding'			: 20,
				'autoScale'			: false,
				'transitionIn'	: 'fade',
				'transitionOut'	: 'fade',
				'type'				: 'iframe',
				'overlayOpacity'	: 0,
				'showCloseButton'	: false
			});
			
			
			$("a[href*='vita.php']").fancybox({
				'width'				: 885,
				'height'			: 500,
				'padding'			: 32,
				'autoScale'			: false,
				'transitionIn'	: 'fade',
				'transitionOut'	: 'fade',
				'type'				: 'iframe',
				'overlayOpacity'	: 0,
				'showCloseButton'	: false
			});
			
			
				
			
			$('#anfahrt1').click(function(){
				$('#karte0').attr('src',$('#karte1').attr('src'));
			});
			
			$('#anfahrt2').click(function(){
				$('#karte0').attr('src',$('#karte2').attr('src'));
			});
			
			$('#anfahrt3').click(function(){
				$('#karte0').attr('src',$('#karte3').attr('src'));
			});
			
			$('a.originalSize').click(function(){
				$('div.left_headline').css('font-size','12px');
				$('div.left_text').css('font-size','11px');
				$('.footer_text').css('font-size','11px');
				$('div.ueberschrift').css('font-size','18px');
				$('.minitext').css('font-size','9px');
				$('#pane1').css('font-size','12px');
				$('#footer1').css('font-size','8px');
				$(window).resize();
			});
			
			$('a.mediumSize').click(function(){
				$('div.left_headline').css('font-size','13px');
				$('div.left_text').css('font-size','13px');
				$('.footer_text').css('font-size','13px');
				$('div.ueberschrift').css('font-size','21px');
				$('.minitext').css('font-size','10px');
				$('#pane1').css('font-size','13px');
				$('#footer1').css('font-size','9px');
				$(window).resize();
			});
			
			$('a.bigSize').click(function(){
				$('div.left_headline').css('font-size','15px');
				$('div.left_text').css('font-size','15px');
				$('.footer_text').css('font-size','14px');
				$('div.ueberschrift').css('font-size','23px');
				$('.minitext').css('font-size','11px');
				$('#pane1').css('font-size','15px');
				$('#footer1').css('font-size','10px');
				$(window).resize();
			});
			
			var printem=function(){
			var printwindow =  window.open('','PrintWindow','');
				var html = '<html><head><title>Cendenta</title><style>img{display:none;visibility:hidden}</style></head><body><div id="print" style="font-family:Verdana, Arial, sans-serif;line-height:150%">' + $('<div />').append($('#col_right').clone()).html() + '</div></body></html>';
				printwindow.document.open();
				printwindow.document.write(html);
				printwindow.document.close();
				printwindow.print();
				return false;

			}
			$('img.printbut').click(function(){
				printem();
			});
			
			if($('.fadein img').length>1){
			$('.fadein img:gt(0)').hide();
    		setInterval(function(){
      		$('.fadein :first-child').fadeOut(2000)
         	.next('img').fadeIn(2000)
         	.end().appendTo('.fadein');}, 
     		 5000);
			}

		
			
		$(window).resize();

		
	 });
			
	
	
							  


