function getURLParam(strParamName){
	var strReturn = "";
	var strHref = window.location.href;
	if ( strHref.indexOf("?") > -1 ){
		var strQueryString = strHref.substr(strHref.indexOf("?")).toLowerCase();
		var aQueryString = strQueryString.split("&");
		for ( var iParam = 0; iParam < aQueryString.length; iParam++ ){
			if (aQueryString[iParam].indexOf(strParamName + "=") > -1 ){
				var aParam = aQueryString[iParam].split("=");
				strReturn = aParam[1];
			break;
			}
		}
	}
	return strReturn;
}

function loadintoIframe(iframeid, url)
{
		if (document.getElementById)
		    document.getElementById(iframeid).src=url;
}
function loadcontentframe(pvalue)
{
	var strReturn = "";
	strReturn= pvalue +".php";
	loadintoIframe('ifcontent',strReturn);
}
function autoloadcontent()
{
		var pvalue=getURLParam('content');
		if (pvalue!="")
			loadcontentframe(pvalue);
		
}

//Create Cookie
function createCookie(name,value,days) {
	if (days) {
		var date = new Date();
		date.setTime(date.getTime()+(days*24*60*60*1000));
		var expires = "; expires="+date.toGMTString();
	}
	else { 
		var expires = "";
	}
	document.cookie = name+"="+value+expires+"; path=/";
}

//Read Cookie
function readCookie(name) {
	var nameEQ = name + "=";
	var ca = document.cookie.split(';');
	for(var i=0;i < ca.length;i++) {
		var c = ca[i];
		while (c.charAt(0)==' ') c = c.substring(1,c.length);
		if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
	}
	return null;
}

//Erase Cookie
function eraseCookie(name) {
	createCookie(name,"",-1);
}

function initintro()
{
// Hier kein Intro
    initanimation(0);
	return;	
	
	if(readCookie('rose') != "dontshow"){
		jQuery('#container').hide();
		jQuery('#intro').show();
		$("#intro_weiter").click(function(){
				createCookie('rose','dontshow', 0);
				window.location.replace('index.php');
				return;
		});
		setTimeout(function() {
						createCookie('rose','dontshow', 0);
						window.location.replace('index.php');
					}, 15000);
	} else {
       initanimation(0);
	}
	
}

function initgallery()
{
	$("#sidebar_mg").click(function(){
		showgallery();
	});
}
function checkScrollTop()
{
		var lh = 0;
		var ph = 0;
		if(window.innerHeight)
			lh = window.innerHeight;	
		if(parent.document.body.clientHeight)
			lh = parent.document.body.clientHeight;	
		if(parent.document.documentElement.clientHeight)
			lh = parent.document.documentElement.clientHeight;	
		if(window.pageYOffset)
			ph=window.pageYOffset;
		if(parent.document.body.scrollTop)
			ph=parent.document.body.scrollTop;
		if(parent.document.documentElement.scrollTop)
			ph=parent.document.documentElement.scrollTop;
		if(ph >lh/3) 
			parent.window.scrollTo(0, 0);
}
function getPageScroll(){

	var xScroll, yScroll;

	if (self.pageYOffset) {
		yScroll = self.pageYOffset;
		xScroll = self.pageXOffset;
	} else if (document.documentElement && document.documentElement.scrollTop){	
		yScroll = document.documentElement.scrollTop;
		xScroll = document.documentElement.scrollLeft;
	} else if (document.body) {
		yScroll = document.body.scrollTop;
		xScroll = document.body.scrollLeft;	
	}
	arrayPageScroll = new Array(xScroll,yScroll) 
	return arrayPageScroll;
} 
function getPageSize(){
	
	var xScroll, yScroll;
	
	if (window.innerHeight && window.scrollMaxY) {	
		xScroll = window.innerWidth + window.scrollMaxX;
		yScroll = window.innerHeight + window.scrollMaxY;
	} else if (document.body.scrollHeight > document.body.offsetHeight){ 
		xScroll = document.body.scrollWidth;
		yScroll = document.body.scrollHeight;
	} else { 
		xScroll = document.body.offsetWidth;
		yScroll = document.body.offsetHeight;
	}
	var windowWidth, windowHeight;
	if (self.innerHeight) {	
		if(document.documentElement.clientWidth){
			windowWidth = document.documentElement.clientWidth; 
		} else {
			windowWidth = self.innerWidth;
		}
		windowHeight = self.innerHeight;
	} else if (document.documentElement && document.documentElement.clientHeight) { 
		windowWidth = document.documentElement.clientWidth;
		windowHeight = document.documentElement.clientHeight;
	} else if (document.body) { // other Explorers
		windowWidth = document.body.clientWidth;
		windowHeight = document.body.clientHeight;
	}	
	if(yScroll < windowHeight){
		pageHeight = windowHeight;
	} else { 
		pageHeight = yScroll;
	}

	if(xScroll < windowWidth){	
		pageWidth = xScroll;		
	} else {
		pageWidth = windowWidth;
	}
	arrayPageSize = new Array(pageWidth,pageHeight,windowWidth,windowHeight) 
	return arrayPageSize;
}
function showgallery()
{
	var arrayPageSize = getPageSize(); 
	var x=arrayPageSize[0];
	var y=arrayPageSize[1];


	$("#ifcontent").hide();
	$("#context_wetter").hide();

//	alert('pageWidth=' +  x+' - pageHeight='+y);		
	document.getElementById("gal_box").style.width=x+'px';
	document.getElementById("gal_box").style.height=y+'px';
	var x=arrayPageSize[2]-70;
	var y=arrayPageSize[3]-70;
	document.getElementById("gal_content").style.width=x+'px';
	document.getElementById("gal_content").style.height=y+'px';
	var arrayPageScroll = getPageScroll(); 
	var galt = arrayPageScroll[1]+30;
	var gall = arrayPageScroll[0]+30;
	document.getElementById("gal_content").style.top=galt+'px';
	document.getElementById("gal_content").style.left=gall+'px';

	document.getElementById("gal_close").style.top=galt-24+'px';
	document.getElementById("gal_close").style.left=30+'px';
	
	$("#gal_box").fadeIn("fast");
	$("#gal_close").click(function(){
		$("#gal_box").fadeOut("fast", function() {
			$("#ifcontent").show();
			$("#context_wetter").show();
      });
	});

}

function loadmovie(name) {
	mvname='movie'+name;
	if(name==1){
		jQuery('#movie2').hide();
		jQuery('#movie3').hide();
		jQuery('#movie4').hide();
		jQuery('#movie1').show();
	}
	if(name==2){
		jQuery('#movie1').hide();
		jQuery('#movie3').hide();
		jQuery('#movie4').hide();
		jQuery('#movie2').show();
	}
	if(name==3){
		jQuery('#movie1').hide();
		jQuery('#movie2').hide();
		jQuery('#movie4').hide();
		jQuery('#movie3').show();
	}
	if(name==4){
		jQuery('#movie1').hide();
		jQuery('#movie2').hide();
		jQuery('#movie3').hide();
		jQuery('#movie4').show();
	}
}

function loadmenuv(name) {
	mvname='menuv'+name;
	ph=0;
	if(parent.document.body.scrollTop) {
		ph=parent.document.body.scrollTop;
	}
	if(name==1){
		jQuery('#menuv2').hide();
		jQuery('#menuv3').hide();
		jQuery('#menuv4').hide();
		jQuery('#menuv5').hide();
		jQuery('#menuv1').show();
	}
	if(name==2){
		jQuery('#menuv1').hide();
		jQuery('#menuv3').hide();
		jQuery('#menuv4').hide();
		jQuery('#menuv5').hide();
		jQuery('#menuv2').show();
	}
	if(name==3){
		jQuery('#menuv1').hide();
		jQuery('#menuv2').hide();
		jQuery('#menuv4').hide();
		jQuery('#menuv5').hide();
		jQuery('#menuv3').show();
	}
	if(name==4){
		jQuery('#menuv1').hide();
		jQuery('#menuv2').hide();
		jQuery('#menuv3').hide();
		jQuery('#menuv5').hide();
		jQuery('#menuv4').show();
	}
	if(name==5){
		jQuery('#menuv1').hide();
		jQuery('#menuv2').hide();
		jQuery('#menuv3').hide();
		jQuery('#menuv4').hide();
		jQuery('#menuv5').show();
	}
	setIframeHeight();
	if(ph>0) {
		parent.window.scrollTo(0, ph);
	}
}

function loadskarte(name) {
	mvname='#skarte'+name;
	ph=0;
	if(parent.document.body.scrollTop) {
		ph=parent.document.body.scrollTop;
	}
	for(var i=1;i < 9;i++) {
		mvname='#skarte'+i;
		jQuery(mvname).hide();
	}
	mvname='#skarte'+name;
	jQuery(mvname).show();
	setIframeHeight();
	if(ph>0) {
		parent.window.scrollTo(0, ph);
	}
}

function ttfestsaal()
{
     $('#ttwiga').qtip({
		content: {url: 'ttips/ttwiga.html'},
		position: {
			corner: {
				target: 'bottomMiddle',
				tooltip: 'topMiddle'
			}
		 },
		 style: {
			border: {
				width: 2,
				radius: 0,
				color: '#ffffff'
			},
			background: '#6B070A',
			color: '#ffffff',
			width: 225,
			padding: 0
		}
		
	  });
     $('#ttklwiga').qtip({
		content: {url: 'ttips/ttklwiga.html'},
		position: {
			corner: {
				target: 'bottomMiddle',
				tooltip: 'topMiddle'
			}
		 },
		 style: {
			border: {
				width: 2,
				radius: 0,
				color: '#ffffff'
			},
			background: '#6B070A',
			color: '#ffffff',
			width: 225,
			padding: 0
		}
		
	  });
     $('#ttsaal').qtip({
		content: {url: 'ttips/ttsaal.html'},
		position: {
			corner: {
				target: 'bottomMiddle',
				tooltip: 'topMiddle'
			}
		 },
		 style: {
			border: {
				width: 2,
				radius: 0,
				color: '#ffffff'
			},
			background: '#6B070A',
			color: '#ffffff',
			width: 225,
			padding: 0
		}
		
	  });
     $('#ttnische').qtip({
		content: {url: 'ttips/ttnische.html'},
		position: {
			corner: {
				target: 'bottomMiddle',
				tooltip: 'topMiddle'
			}
		 },
		 style: {
			border: {
				width: 2,
				radius: 0,
				color: '#ffffff'
			},
			background: '#6B070A',
			color: '#ffffff',
			width: 225,
			padding: 0
		}
		
	  });
     $('#ttklstube').qtip({
		content: {url: 'ttips/ttklstube.html'},
		position: {
			corner: {
				target: 'bottomMiddle',
				tooltip: 'topMiddle'
			}
		 },
		 style: {
			border: {
				width: 2,
				radius: 0,
				color: '#ffffff'
			},
			background: '#6B070A',
			color: '#ffffff',
			width: 225,
			padding: 0
		}
		
	  });
     $('#ttstube').qtip({
		content: {url: 'ttips/ttstube.html'},
		position: {
			corner: {
				target: 'bottomMiddle',
				tooltip: 'topMiddle'
			}
		 },
		 style: {
			border: {
				width: 2,
				radius: 0,
				color: '#ffffff'
			},
			background: '#6B070A',
			color: '#ffffff',
			width: 225,
			padding: 0
		}
		
	  });
     $('#ttkamin').qtip({
		content: {url: 'ttips/ttkamin.html'},
		position: {
			corner: {
				target: 'bottomMiddle',
				tooltip: 'topMiddle'
			}
		 },
		 style: {
			border: {
				width: 2,
				radius: 0,
				color: '#ffffff'
			},
			background: '#6B070A',
			color: '#ffffff',
			width: 225,
			padding: 0
		}
		
	  });
     $('#ttgarten').qtip({
		content: {url: 'ttips/ttgarten.html'},
		position: {
			corner: {
				target: 'bottomMiddle',
				tooltip: 'topMiddle'
			}
		 },
		 style: {
			border: {
				width: 2,
				radius: 0,
				color: '#ffffff'
			},
			background: '#6B070A',
			color: '#ffffff',
			width: 225,
			padding: 0
		}
		
	  });	 
}
function initToolTip2()
{
   $('area').each(function()
   {
      $(this).qtip(
      {
         content: $(this).attr('alt'), // Use the ALT attribute of the area map
         position: {
			corner: {
				target: 'bottomLeft',
				tooltip: 'topLeft'
			}
		 },
		 style: {
			border: {
				width: 2,
				radius: 0,
				color: '#ffffff'
			},
			background: '#6B070A',
			color: '#ffffff'         }
      });
   });
}
function initanimation(dvalue)
{
// Animation Starten
		$('#tl_logo').crossSlide({
		sleep: 5,
		fade: 1
		}, [
		{ src: 'images/tl02.jpg' },
		{ src: 'images/tl03.jpg' },
		{ src: 'images/tl01.jpg' },
		{ src: 'images/tl04.jpg' },
		{ src: 'images/tl05.jpg' },
		{ src: 'images/tl06.jpg' },
		{ src: 'images/tl07.jpg' },
		{ src: 'images/tl08.jpg' },
		{ src: 'images/tl11.jpg' },
		{ src: 'images/tl09.jpg' },
		{ src: 'images/tl10.jpg' },
		{ src: 'images/tl13.jpg' },
		{ src: 'images/tl12.jpg' },
		{ src: 'images/tl14.jpg' },
		{ src: 'images/tl15.jpg' },
		{ src: 'images/tl16.jpg' },
		{ src: 'images/tl17.jpg' },
		{ src: 'images/tl18.jpg' }
		]);
		if(dvalue>0) {
		setTimeout(function() {
			$('.context_slide').innerfade({
			speed: 300,
			timeout: 8000,
			type: 'sequence',
			animationtype:    'slide',
			containerheight: '320px'
			});
                }, 15000);
		} else {
			$('.context_slide').innerfade({
			speed: 300,
			timeout: 8000,
			type: 'sequence',
			animationtype:    'slide',
			containerheight: '320px'
			});
		}
	
}

