var currnum=0;
var variable=0;
var pfeil;
var selis=0;

var wstart=0;
	var hstart=43;
	var lleft=0;
	var lleft1=-997;
	var breiter;
	var winW;
	var winH;
	var bb=0;
	var cc=0;
	var allloaded=0;
	var speed = 0;

var dacontent="<a href='javascript:showImg(currnum,1)'><img src='pics/blank.gif' id='bigImg' alt=' photograph &copy; J&uuml;rgen Berderow'></a>";

var docEl = (
                 typeof document.compatMode != "undefined" && 
                 document.compatMode        != "BackCompat"
                )? "documentElement" : "body";

function init_mousemove() {
	document.getElementById("pf_li").style.visibility = "visible";
	document.getElementById("pf_re").style.visibility = "visible";
	document.getElementById("inhalt").style.visibility = "visible";
	 // for ie add scroll position
        //
		/*
        if (document.all && !document.captureEvents) {
            xPos    += document[docEl].scrollLeft;
            yPos    += document[docEl].scrollTop;
        }
		*/
		if( typeof( window.pageYOffset ) == 'number' ) {
			//Netscape compliant
			winW = window.innerWidth;
			winH = window.innerHeight;
		} else if( document.body ) {
			//DOM compliant
			winW = document.body.clientWidth;
			winH = document.body.clientHeight;
		} else if( document.documentElement ) {
			//IE6 standards compliant mode
			winW = document.body.clientWidth;
			winH = document.body.clientHeight;
		}
		adaptToScreen();
		//alert(winH);
		
		stop();
        if(document.layers) document.captureEvents(Event.MOUSEMOVE);
        document.onmousemove =	dpl_mouse_pos;		
}

function dpl_mouse_pos(e) {

        // position where mousemove fired
        //
        var xPos    =  e? e.pageX : window.event.x;
        var yPos    =  e? e.pageY : window.event.y;
    

		//var wW = winW/2;
		var wW = dist1;

		if(wW > winW) wW = winW;
		
		//alert(wW);
		//alert ((-575 + winW/2));-575 + 30 
		if(xPos<parseInt(wW/2) && xPos>parseInt(0) && yPos>150 && yPos<210){
			speed = Math.abs(Math.round((wW/2 - xPos)/150));
			if (speed > 10) speed = 10;
        	down();
		}else if (xPos>wW/2 && xPos<parseInt(wW) && yPos>150 && yPos<210){
			speed = Math.abs(Math.round((xPos - wW/2)/150));
			//alert(speed); 
			if (speed > 10) speed = 10;
			up();
		}else{
			speed = 0;
			stop();	
		}
        //
        if (document.layers) routeEvent(e);
    }


function setdir(dir){
	pfeil=dir;
}
function scrollLayer(target, speed){
	document.getElementById(target).style.visibility="hidden";
}


function MZ_findObj(n){ //v3.6
        var x,t; if((n.indexOf("?"))>0&&parent.frames.length){t=n.split("?");
        x=eval("parent.frames['"+t[1]+"'].document.getElementById('"+t[0]+"')");
        }else{x=document.getElementById(n)}return x;
}

function showImg(num,fwrd) {
	document.getElementById("subcon").innerHTML=dacontent;
	if(fwrd==1) num++;
	if(fwrd==0) num--;
	if(num>imgArr.length-1 && fwrd==1){ 
		num=0;
	}
	if(num<0 && fwrd==0){
		num=imgArr.length-1;
	}
	var dummy = new Image;
	dummy = "pics/blue.gif";
	document.getElementById("bigImg").src=dummy;
	var img = new Image;
	img = "pics/"+imgArr[num];
    if(imgArr[num] != "undefined") document.getElementById("bigImg").src=img;

	currnum=num;
}
function seli(thissel){
	selis=thissel;
	for(i=1;i<=6;i++){
		if(thissel!=i) document.getElementById("navpoint"+i).src="pics/nav/nav_0"+i+".gif";
	}
	document.getElementById("navpoint"+thissel).src= "pics/blank.gif";//"pics/nav/nav_over_0"+thissel+".gif";
	document.getElementById("nav_oben").src="pics/nav/nav_0"+thissel+".gif"; 
}
function jump(posiC){
	//----------------------------
	document.getElementById("Layer1").style.top=-(posiC-80)+'px';
	init(posiC,55,rectH);
}
function setArrPos(){
	pageHeight = document.getElementById('theDoc').offsetHeight;
	layerHeight = document.getElementById("Layer1").offsetHeight/2;

	if(layerHeight<pageHeight-80){
		document.getElementById("pfeil-u").style.top=layerHeight+60+'px';
	}
}
function getObj(name)
{
  if (document.getElementById)
  {
  	this.obj = document.getElementById(name);
	this.style = document.getElementById(name).style;
  }
  else if (document.all)
  {
	this.obj = document.all[name];
	this.style = document.all[name].style;
  }
  else if (document.layers)
  {
   	this.obj = document.layers[name];
   	this.style = document.layers[name];
  }
}
function init(clipTop,clipWidth,clipBottom)
{
	DHTML = (document.getElementById || document.all || document.layers)
	if (!DHTML) return;
	var x = new getObj('Layer1');
	if (document.layers)
	{
		lyrheight = x.style.clip.bottom;
		lyrheight += 20;
		x.style.clip.top = clipTop;
		x.style.clip.left = 0;
		x.style.clip.right = clipWidth;
		x.style.clip.bottom = clipBottom;
	}
	else if (document.getElementById || document.all)
	{
		lyrheight = x.obj.offsetHeight;
		x.style.clip = 'rect('+clipTop+'px,'+clipWidth+'px,'+clipBottom+'px,0)';
	}
}


function flashgo(){
	var to_flash = "'"+movie+"?width="+screen.width+"&height="+screen.height+"&Text="+Text; 
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImgRestore(thissel) { //v3.0
  var i,x,a=document.MM_sr; 
  for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++){ 
  	if(selis!=thissel){
  		x.src=x.oSrc;
	}
	}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
function getNum() {
	var die_url = window.location.href;
	variable = die_url.substring(die_url.indexOf("?")+1,die_url.length);
	currnum=variable;
	//alert(currnum);
}
function verweis(seite,currnum){
	window.location.href = seite + "?currnump=" + currnum;
}
function converter(seite,currnum){
	window.location.href = seite+"?"+currnum;
}

function writeit(what){
	document.getElementById("back").style.visibility="visible";
	document.getElementById("pf_li").style.visibility="hidden";
	document.getElementById("pf_re").style.visibility="hidden";
	if(what=="con"){
		document.getElementById("nav_oben").src="pics/nav/images/nav_oben1_05.gif";
		document.getElementById("subcon").innerHTML=dacontent_con;
	}
	if(what=="inf"){
		document.getElementById("nav_oben").src="pics/nav/images/nav_oben1_06.gif";
		document.getElementById("subcon").innerHTML=dacontent_info;
		
	}
}



var aktiv;
var xpos=0;

  
   function down() {
    window.clearInterval(aktiv);
   aktiv = window.setInterval("ssdown()", 10);

  }
   function ssdown() {
	   var s = document.getElementById("sc");
	   if((xpos>=0)){
			xpos = -dist;
		}
	    xpos = xpos + speed;
   		document.getElementById("sc").style.left = xpos + "px";
   }
  function up() {
	  window.clearInterval(aktiv);
   aktiv = window.setInterval("ssup()", 10);
  }
   function ssup() {
	   var s = document.getElementById("sc");
	   if((s.style.left==0+'px')){
		}
		xpos = xpos - speed;
		if((xpos<=-dist)){
			xpos = 0;
		}
	   
   		s.style.left =  xpos + "px";
   }
 
  function stop() {
  	 window.clearInterval(aktiv);
  }
 
 //-->
 
 	

	function breite(){
		breiter = window.setInterval("checker()", 20);
		/*
		if( typeof( window.pageYOffset ) == 'number' ) {
			//Netscape compliant
			winW = window.innerWidth;
		} else if( document.body ) {
			//DOM compliant
			winW = document.body.clientWidth;
		} else if( document.documentElement ) {
			//IE6 standards compliant mode
			winW = document.body.clientWidth;
		}
		if(!winW) winW=1400;
		*/
		document.getElementById("abdeck").style.visibility = "visible";
	}
	function checker () {
		if (lleft<(parseInt(-575 + winW/2 + 979))){
				//hstart=hstart+10;
				lleft=lleft+10;
				lleft1=lleft1+10;
				document.getElementById("logostart").style.left=lleft+"px";
				document.getElementById("arrstart").style.left=lleft1+"px";
    			bb=1;
		}
		if(lleft>=(parseInt(-575 + winW/2 + 979))){
			document.getElementById("logostart").style.left="989px";
			cc=1;
		}
		if(bb==1 && cc==1){
			window.clearInterval(breiter);
			wegda();
		}
	}
	function wegda(){
		document.getElementById("abdeck").style.visibility="hidden";
		document.getElementById("arrstart").style.visibility="hidden";
		document.getElementById("arrstart").style.left=-10000 + "px";
		document.getElementById("inhalt").style.visibility = "visible";
		showImg(1,0);
	}
	
	function adaptToScreen(){
		//alert(winH);
		if(winH < 700) {
			//document.getElementById("nav_oben").style.top = 10 + "px";
			document.getElementById("topleiste").style.top = 25 + "px"; // -20
			document.getElementById("topleiste").style.height = 192 + "px"; // -10
			document.getElementById("subcon").style.top = 230 + "px"; // -60
			document.getElementById("nav_oben").style.bottom = 18 + "px";
			document.getElementById("Layer1").style.top = 135 + "px"; // -25
			if(document.getElementById("arrstart")){
				document.getElementById("arrstart").style.top = 217 + "px"; // -30
			}
		}
		if(winH >= 700 && winH < 960) {
			var percent =  100*(winH-700)/(960-700);//winH/(760/100);
			//document.getElementById("nav_oben").style.top = 10 + "px";
			document.getElementById("topleiste").style.top = 25 + Math.round((20/100)*percent) + "px";//25 + "px"; // -20
			document.getElementById("topleiste").style.height = 192 + Math.round((20/100)*percent) + "px";//202 + "px"; // -10
			document.getElementById("subcon").style.top = 230 + Math.round((70/100)*percent) + "px";//240 + "px"; // -60
			document.getElementById("nav_oben").style.bottom = 18 + Math.round((6/100)*percent) + "px";
			document.getElementById("Layer1").style.top = 135 + Math.round((25/100)*percent) + "px";//135 + "px"; // -25
			if(document.getElementById("arrstart")){
				document.getElementById("arrstart").style.top = 217 + Math.round((40/100)*percent) + "px";//227 + "px"; // -30
			}
		}
		if(winH >= 960) {
			//document.getElementById("nav_oben").style.top = 10 + "px";
			document.getElementById("topleiste").style.top = 45 + "px"; // 45
			document.getElementById("topleiste").style.height = 212 + "px"; // 212
			document.getElementById("subcon").style.top = 300 + "px"; // 300
			document.getElementById("nav_oben").style.bottom = 24 + "px";
			document.getElementById("Layer1").style.top = 160 + "px"; // 160
			if(document.getElementById("arrstart")){
				document.getElementById("arrstart").style.top = 257 + "px"; // 257
			}
		}
	}

