var isover;
var scrollspeed=1; if (!navigator.userAgent.match(/msie/i)) { scrollspeed=1; }

var overregion=false; var visiblediv=0;

var mouseX, mouseY;
if(window.Event && document.captureEvents) document.captureEvents(Event.MOUSEMOVE);
document.onmousemove = getMousePos;	

function stopscroll() { 
	window.clearInterval(isover);
}

function scrollleft(max) {
	stopscroll();
	isover=window.setInterval('sleft('+max+')',10);
}

function scrollright() {
	stopscroll();
	isover=window.setInterval('sright()',10);
}

function sleft(max) {
	var limit=max-410; if (limit<0) { limit=0; } else { limit=(-1)*limit; }

	if (parseInt(document.getElementById('slider').style.marginLeft)>limit) {
		document.getElementById('slider').style.marginLeft=(parseInt(document.getElementById('slider').style.marginLeft)-scrollspeed)+'px';
	}
}

function sright() {
	if (parseInt(document.getElementById('slider').style.marginLeft)<0) {
		document.getElementById('slider').style.marginLeft=(parseInt(document.getElementById('slider').style.marginLeft)+scrollspeed)+'px';
	}
}

function onloadfuncs () {
	if (window.myonload) {
		myonload();
	}
	var zielhoehe=0;
	var h1=document.getElementById('menuelinks').offsetHeight;
	var h2=document.getElementById('inhalt').offsetHeight;
	var h3=document.getElementById('menuerechts').offsetHeight;
	zielhoehe=h1;
	if (h2>zielhoehe) { zielhoehe=h2; }
	if (h3>zielhoehe) { zielhoehe=h3; }
	if (zielhoehe==h1) {
		zielhoehe=zielhoehe-11;
		document.getElementById('mllastspacer').style.fontSize='0px';
		document.getElementById('mllastspacer').style.lineHeight='0px';
	}
	if ((zielhoehe-h1)>0) { document.getElementById('menuelinks_fill').style.height=(zielhoehe-h1)+"px"; }
	if ((zielhoehe-h3)>0) { document.getElementById('menuerechts_fill').style.height=(zielhoehe-h3)+"px"; }
}

function karte_over(id,mapcolour) {
	var divname="ortediv"+id;
	var hpos=new Array(-1,255,315,-1,160,185,150,-1,140,-1,90,125,275,200,230,45,195,265);
	var vpos=new Array(-1,110,95,-1,115,155,160,-1,70,-1,140,105,70,135,125,105,55,30);
	var xoffset=0;
	var yoffset=0;
	//var mapcolour=1;

	overregion=true;
	visiblediv=id;
	hideall();
	if (document.getElementById(divname)) {
		if (document.getElementById(divname).style.visibility=='hidden') {
			document.getElementById(divname).style.visibility='visible';
			var prnt=document.getElementById('karte').offsetParent;
			xoffset=parseInt(document.getElementById('karte').offsetLeft);
			yoffset=parseInt(document.getElementById('karte').offsetTop);
			while (prnt) {
				xoffset=xoffset+prnt.offsetLeft;
				yoffset=yoffset+prnt.offsetTop;
				prnt=prnt.offsetParent;
			}
			document.getElementById(divname).style.left=(xoffset+hpos[id])+'px';
			document.getElementById(divname).style.top =(yoffset+vpos[id])+'px';
			if (mapcolour==1) {
									document.getElementById('karte').src='images/'+portalid+'/winter/karte_'+id+'.gif';}
			else if (mapcolour==0)  {
									document.getElementById('karte').src='images/'+portalid+'/karte_'+id+'.gif';} 
			
		}
	}
}

function karte_out(id,mapcolour) {
	overregion=false;
	setTimeout('karte_out2('+id+','+mapcolour+');',300);
}

function karte_out2(id,mapcolour) {
	var divname="ortediv"+id;
	//var mapcolour=1;

	if ((overregion==false) && (visiblediv==id)) {
		visiblediv=0;
		document.getElementById(divname).style.visibility='hidden';
		if (mapcolour==1) {
							document.getElementById('karte').src='images/'+portalid+'/winter/karte_0.gif'; }
		else if (mapcolour==0)  {
							document.getElementById('karte').src='images/'+portalid+'/karte_0.gif';}
	}
}

function hideall() {
	var divname; var i;
	for (i=1; i<=17; i++) {
		divname="ortediv"+i;
		if ((document.getElementById(divname)) && (i!=visiblediv)) { document.getElementById(divname).style.visibility='hidden'; }
	}
}

function getMousePos(e) {
	if (!e)	var e = window.event||window.Event;
	if ('undefined' != typeof e.pageX) {
		mouseX = e.pageX;
		mouseY = e.pageY;
	} else {
		if (document.compatMode && document.compatMode=="CSS1Compat") {
	    mouseX = e.clientX + document.documentElement.scrollLeft;
	    mouseY = e.clientY + document.documentElement.scrollTop;
		} else {
			mouseX = e.clientX + document.body.scrollLeft;
			mouseY = e.clientY + document.body.scrollTop;
	  }
	}
}

function panorama(ivr,initialview,autospin) {
	document.write('<applet archive="/panoramen/panoapplet.jar" code="panoapplet" style="width:451px; height:315px; margin:auto;">');
	document.write('<param name="file" value="/panoramen/ivr/'+ivr+'" />');
	document.write('<param name=initialView value="'+initialview+'" />');
	document.write('<param name="autospin" value="'+autospin+'" />');
	document.write('</applet>');
}

function panoramagross(ivr,initialview,autospin) {
	document.write('<applet archive="/panoramen/panoapplet.jar" code="panoapplet" style="width:890px; height:530px; margin:auto;">');
	document.write('<param name="file" value="/panoramen/ivr/'+ivr+'" />');
	document.write('<param name=initialView value="'+initialview+'" />');
	document.write('<param name="autospin" value="'+autospin+'" />');
	document.write('<param name="foregroundFrame" value="true">');
	document.write('<param name="toolbar" value="none">');
	document.write('<param name="toolbarstyle" value="floating">');
	document.write('</applet>');
}

function flashkarte(karte,breite,hoehe,skip) {
	document.write('<object classid="CLSID:D27CDB6E-AE6D-11cf-96B8-444553540000" width="'+breite+'" height="'+hoehe+'" codebase="http://active.macromedia.com/flash2/cabs/swflash.cab#version=4,0,0,0">');
	document.write('<param name="movie" value="'+karte+'" />');
	document.write('<param name="quality" value="high" />');
	document.write('<param name="menu" value="false" />');
	document.write('<param name="wmode" value="opaque" />');	
	if (skip==1) {
		document.write('<param name="FlashVars" value="skipit=1" />');
		document.write('<embed src="'+karte+'" FlashVars="skipit=1" border="0" quality="high" menu="false" width="'+breite+'" height="'+hoehe+'" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer"></embed>');
	} else {
		document.write('<embed src="'+karte+'" border="0" quality="high" menu="false" width="'+breite+'" height="'+hoehe+'" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer"></embed>');
	}		
	document.write('</object>');
}

function flashheader(flashmovie) {
	document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="930" height="183" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0">');	
	document.write('<param name="movie" value="'+flashmovie+'" />');
	document.write('<param name="quality" value="high" />');
	document.write('<param name="menu" value="false" />');	
	document.write('<param name="wmode" value="transparent" />');	
	document.write('<embed src="'+flashmovie+'" border="0" quality="high" wmode="transparent" menu="false" width="930" height="183" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer"></embed>');
	document.write('</object>');
}

