var abst_u=120; start_u=325; pos_gross=1;

// Temporary variables to hold mouse x-y pos.s 
var maus=1;
var tempX = 0;
var tempY = 0;

// Temporary variables to calculate picture position, sice abd picure ID
var pox = 0;
var BposX = 1;
var ID="bild_";
var ID2="g_";
var ID3="t_";
var j1=-10000; j2="g_"; j3="t_";
var ausricht=0;

// Last active picture: akt2, last active text akt3
var akt2 ="g_1";
var akt3 ="t_1";

// Variable for mumber of small pictures
var AnzB=0;

// find out if ie runs in quirks mode
//
var docEl = (
             typeof document.compatMode != "undefined" && 
             document.compatMode        != "BackCompat"
            )? "documentElement" : "body";

// register event
// capture it for nc 4x (ok it's a dino)
//

// Main function to retrieve mouse x-y pos.s and to calculate pictute position

function getMouseXY(e) {

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

	// for ie add scroll position
	//
	if (document.all && !document.captureEvents) {
	    tempX    += document[docEl].scrollLeft;
	    tempY    += document[docEl].scrollTop;
	}    

	// for the dino pass event

	if (document.layers) routeEvent(e);
	// catch possible negative values in NS4
 	if (tempX < 0){tempX = 0}
 	if (tempY < 0){tempY = 0}  
	if (ausricht==0) {gauss_h(tempX,tempY);}	// Paintings horisontal
	else {gauss_v(tempX,tempY);}		// Oil vertical
}


function init_mousemove(x,ausrichtung) {

    if(document.layers) document.captureEvents(Event.MOUSEMOVE);
    document.onmousemove = getMouseXY;
    AnzB=x;
    ausricht=ausrichtung;

    pos_gross=screen.availWidth*0.424	-150;		// calculate Picture position width * 0.85 *0.5 - half picture
    start_u=pos_gross+350-((AnzB)*60);
//    alert (pos_gross);

    if (ausricht==0) {					// Pictures paintings
	disp_h(1);
	gauss_h(10,10);
    }
    else {						// Oil
	disp_v(1);
	gauss_v(10,10);
    }
	document.getElementById("t_0").style.left=-800+"px";		// GIF wait out

}


function gauss_v(tempX,tempY) {

	// Bildposition in x-direction -> BposX = (tempX - BildMitteNr1)/distance of picturers =105
	// find maximum Maximum
	if (screen.height >=950) {
		BposX = (tempX - start_u)/abst_u;
		// Alle Bilder von j1 = 1 to anzBilder 
		// Achtung in Formel j1 -1
		for (var j1 = 1; j1 <= AnzB; j1++) {
			pox=1+60*(Math.pow(1.3,-((j1-1-BposX)*(j1-1-BposX))));  
			ID="bild_"+j1
			darstellen_v (ID,pox,j1);
 		}
	}
	else {
		BposX = (tempY - 140)/85;
		// Alle Bilder von j1 = 1 to anzBilder 
		// Achtung in Formel j1 -1
		for (var j1 = 1; j1 <= AnzB; j1++) {
			pox=1+30*(Math.pow(1.3,-((j1-1-BposX)*(j1-1-BposX))));  
			ID="bild_"+j1
			darstellen_v (ID,pox,j1);
		}
	}
}

function gauss_h(tempX,tempY) {

	// Bildposition in x-direction -> BposX = (tempX - BildMitteNr1)/distance of picturers =105
	// Berschiebung des Maximums
	if (screen.height >=950) {
		BposX = (tempX - start_u)/abst_u;			// tempX - Abstand des ersten Bildes vom Rand (325) / Abstand der Bilder (105)
		// Alle Bilder von j1 = 1 to anzBilder 
		// Achtung in Formel j1 -1
		for (var j1 = 1; j1 <= AnzB; j1++) {
			pox=1+50*(Math.pow(1.3,-((j1-1-BposX)*(j1-1-BposX))));  
			ID="bild_"+j1
			darstellen_h (ID,pox,j1);
 		}
	}
	else {
		BposX = (tempY - 200)/70;
		// Alle Bilder von j1 = 1 to anzBilder 
		// Achtung in Formel j1 -1
		for (var j1 = 1; j1 <= AnzB; j1++) {
			pox=1+30*(Math.pow(1.3,-((j1-1-BposX)*(j1-1-BposX))));  
			ID="bild_"+j1
			darstellen_h (ID,pox,j1);
		}
	}
}

function darstellen_h (i, x, ii) {						// Small pictures at bottom horisontal

	document.getElementById(i).style.display="inline";
  	document.getElementById(i).style.width=55+x+"px";	
  	document.getElementById(i).style.height=40+x/1.1+"px";	
	if (screen.height >=950) {
		document.getElementById(i).style.position="absolute";
		document.getElementById(i).style.left=(ii*abst_u)+start_u+55-x/2+"px";	// BildNr ii *Abstand + Verschiebung - Vergrößerung
		document.getElementById(i).style.top=-x/1.1+"px";	
	}
	else {
		document.getElementById(i).style.position="absolute";
		document.getElementById(i).style.left=+1100-x+"px";	// 
		document.getElementById(i).style.top=-610+ii*70-x/4+"px";	
	} 
}

function darstellen_v (i, x, ii) {						// Small pictures at bottom vertical

	document.getElementById(i).style.display="inline";
  	document.getElementById(i).style.width=40+x/1.3+"px";	
  	document.getElementById(i).style.height=55+x+"px";	
	if (screen.height >=950) {
		document.getElementById(i).style.position="absolute";
		document.getElementById(i).style.left=(ii*abst_u)+start_u+55-x/4+"px";	// 
		document.getElementById(i).style.top=-x+"px";	
	}
	else {
		document.getElementById(i).style.position="absolute";
		document.getElementById(i).style.left=+1150-x*1.5+"px";	// 
		document.getElementById(i).style.top=-690+ii*85-x/2+"px";	
	} 
}


function disp_h (i) {						// Big Drawing Picture in the middle and text

	j2=ID2+i;		
	j3=ID3+i;
	document.getElementById(akt2).style.position="absolute";
	document.getElementById(akt2).style.left=-800+"px";		// out picture
	document.getElementById(akt3).style.position="absolute";
	document.getElementById(akt3).style.left=-800+"px";		// out text

	document.getElementById(j2).style.position="absolute";
	document.getElementById(j3).style.position="absolute";
	if (screen.height >=950) {
		document.getElementById(j2).style.left=650+pos_gross+"px";    	// in Picture
		document.getElementById(j3).style.left=-0+pos_gross+"px";    	// in Text
	}
	else {document.getElementById(j2).style.left=900+"px";    	// in Picture
		document.getElementById(j3).style.left=300+"px";    	// in Text
	}
	akt2=j2;						// store akt2 picture for next out
	akt3=j3;
}

function disp_v (i) {						// Big Picture in the middle and text

	j2=ID2+i;		
	j3=ID3+i;
	document.getElementById(akt2).style.position="absolute";
	document.getElementById(akt2).style.left=-800+"px";		// out picture
	document.getElementById(akt3).style.position="absolute";
	document.getElementById(akt3).style.left=-800+"px";    		// out text

	document.getElementById(j2).style.position="absolute";
	document.getElementById(j3).style.position="absolute";
	if (screen.height >=950) {
		document.getElementById(j2).style.left=950+pos_gross+"px";    	// in Picture
		document.getElementById(j3).style.left=150+pos_gross+"px";    	// in Text
	}
	else {document.getElementById(j2).style.left=1100+"px";    	// in Picture
		document.getElementById(j3).style.left=200+"px";    	// in Text
	}
	akt2=j2;						// store akt2 picture for next out
	akt3=j3;
}






