numberOfPics = 10;
faktor = 1.25;

defaultHeight = 125;	// 195
	
oversizedHeight = 160;	// 220
	
Z=10;			// speichert den höchsten z-index

gleiten = true;

gleitSpeed = 3;

anzahlGleitSchritte = ( oversizedHeight - defaultHeight ) / gleitSpeed;

linksDrift = !true;

	// gibt an, ob ein bild gerade größer wird, kleiner, oder im normalzustand ist..
gleitVars = [0,0,0,0,0,0,0,0,0,0,0];

	//linksDriftVars = [-45, -30, -16, 0, 11, 21, 39, 53, 65, -55, -70, 78];
linksDriftVars = [-40, -23, -15, 0, 9, 15, 20, 21, 22, -45];

	//  speichert den linksabstand der bilder, wird vom programm verändert..
leftAttributes = [80,149,230,291,338,397,472,558,603,7.7,-191,660];


var version = navigator.appVersion;
var browsername = navigator.appName;

if( browsername.indexOf("Explorer") > -1 ){
	leftAttributes = [81,150,230,292,338,397,472.5,559,604.8,8,-191,660];
}
//window.status = browsername;



for(i=0;i<leftAttributes.length;i++) leftAttributes[i] = leftAttributes[i] * (faktor) - Math.pow(faktor,5)*22;

zaehler = 0;


allLinks = ["news.htm","mjn.htm","vorschau.htm","berichte.htm","videos.htm",
		"http://www.mjn-mennoniten.de/cgi-bin/guestbook.php.cgi",
		"http://www.mjn.7to.de/thwb","Anmeldung.htm","kontakt.htm","index.htm"];

//----------------------------------------------------------------------------------------------------------

function Fensterweite () {
  if (window.innerWidth) {
    return window.innerWidth;
  } else if (document.body && document.body.offsetWidth) {
    return document.body.offsetWidth;
  } else {
    return 0;
  }
}


function initMenu(){


	hiddenMenu.style.visibility = "hidden";

	text="";
	for( i = 1; i <= numberOfPics; i++ ){
		text+= "<img id=i"+i+" src=menu/"+i+".gif class=gif style=left:0; onClick=klick("+
			i+"); onMouseover=over("+i+"); onMouseout=out("+i+");>";
	}

	//alert(document.getElementById("menuski").id);
	menuski.innerHTML += text;


	posLeft = ( Fensterweite() - 890) / 2;
	if(posLeft<10){ posLeft = 10; }

	alles.style.left = posLeft;

	reset();
	move();
}


//---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
function reset(){
	for( i = 0; i < numberOfPics; i++){
		//if( i+1 == aktive ) continue;
		x = eval("i"+ (i+1) );
		x.style.height = defaultHeight;
		x.style.left = leftAttributes[i];
		x.style.top = 10;
	}	
}

function klick( nr ){
	if(nr>10) return;
	active = nr;
	//location = allLinks[nr-1];
}
function over( nr ){
	gleitVars[nr-1] = 1;
	x = eval("i"+nr);
	x.style.zIndex=Z++;
	x.src = "menu/gross/"+nr+".gif";
}
function out( nr ){
		gleitVars[nr-1] = -1;
}
function move(){
	
	for( i=0;i< numberOfPics; i++){
		if( gleitVars[i] == 0) continue;
		
		nr = i+1;
		x = eval("i"+nr);
		if( gleitVars[i] == -1){
			if( !gleiten ){
				while( x.offsetHeight > defaultHeight  ){
					 x.style.height = x.offsetHeight - gleitSpeed;
					if( linksDrift )  x.style.left = x.offsetLeft +1;
				}
			}else
			if( x.offsetHeight > defaultHeight  ){
				x.style.height = x.offsetHeight - gleitSpeed;
				x.style.top = x.offsetTop + 3;
				if( linksDrift ) leftAttributes[ i ] -= linksDriftVars[i] / anzahlGleitSchritte ;
				else leftAttributes[i] += 3;
				x.style.left = leftAttributes[i];
			}
			else{ 
				x.src = "menu/"+(nr)+".gif";
				//x.style.removeAttribute("height");
				gleitVars[i] = 0;
			}
		}
		if( gleitVars[i] == 1 ){
			if( !gleiten ){
				while( x.offsetHeight < oversizedHeight ){
					 x.style.height = x.offsetHeight + gleitSpeed;
					if(linksDrift)  x.style.left = x.offsetLeft -1;
				}
			}else
			if( x.offsetHeight < oversizedHeight ){
				x.style.top = x.offsetTop - 3;
				x.style.height = x.offsetHeight + gleitSpeed;
				if( linksDrift ) leftAttributes[ i ] += linksDriftVars[i] / anzahlGleitSchritte ;
				else leftAttributes[i] -= 3;
				x.style.left = leftAttributes[i];
			}
		}
	
	}
	/*	Spielerei...
	zaehler++;
	if(zaehler<100){
		//for(i=0;i<gleitVars.length;i++){
		x = zaehler % gleitVars.length;
		if(gleitVars[x] == 1 ) gleitVars[ x ] = -1;
		else gleitVars[ x ] = 1;
		//}
	}
	*/
	setTimeout("move()",30);
}



function setDeadline( target, year, month, day){
	month--;
	jetzt = new Date();
	Jahr = jetzt.getYear();
	if (Jahr < 999)
		Jahr += 1900;
	if( Jahr > year ){
		target.style.visibility='hidden';
		return;
	}
	if( jetzt.getMonth() > month ){
		target.style.visibility='hidden';
		return;
	}
	if( jetzt.getMonth() == month && jetzt.getDate() > day ){
		target.style.visibility='hidden';
		return;
	}
}


