		// This function returns the appropriate reference,
// depending on the browser.
	function getFlexApp(appName) {
	  if (navigator.appName.indexOf ("Microsoft") !=-1) {
	    return window[appName];
	  } else {
	    return document[appName];
	  }
	}
	
	

		

	
	function callASWheel(top) {
//	 var top = document.getElementById("area").offsetTop;
   
   var myY = - (top * 280 / 374) + 10;
//   document.getElementById("anz3").innerHTML = myY;
   document.getElementById("area").focus();
//  alert("callback" + top);
//alert(getFlexApp('asScroller'));
   getFlexApp("asScroller").onMouseWheel(top);
 
  }


 
/** This is high-level function.
* It must react to delta being more/less than zero.
*/
function handle(delta) {
       var areaCont = document.getElementById("area");
       var contHeight = areaCont.offsetHeight;
 //      alert(contHeight);
       if(contHeight > 374)
       {
	//       alert(scrollerPos);
//	       var top = - ( (delta * 20) * (contHeight - 400) / 360 );
         var top = document.getElementById("area").offsetTop + (delta * 5);
         
	       if((top >= (374 - contHeight)) && (top <= 0))
	       {
//	         document.getElementById("area").style.top = top + 'px';
	         
	         var myY = - (top * 280 / 374) + 10;
	         
//	         alert(delta);
	         
//	         callASWheel(top); 
	         callASWheel(delta * 5);          
         }

	//       alert(top);
//	       document.getElementById("anz2").innerHTML = delta;
//				document.getElementById("anzeige").innerHTML = contHeight + "top: " + top;

	     }
}

/** Event handler for mouse wheel event.
*/
function wheel(event){
       
       var delta = 0;
         var delta = 0;
       if (!event) /* For IE. */
               event = window.event;
       if (event.wheelDelta) { /* IE/Opera. */
               delta = event.wheelDelta/120;
               /** In Opera 9, delta differs in sign as compared to IE.
                */
               if (window.opera)
                      delta = delta; // (was - delta)
       } else if (event.detail) { /** Mozilla case. */
               /** In Mozilla, sign of delta is different than in IE.
                * Also, delta is multiple of 3.
                */
               delta = -event.detail/3;
       }     /** If delta is nonzero, handle it.
        * Basically, delta is now positive if wheel was scrolled up,
        * and negative, if wheel was scrolled down.
        */
       if (delta)
               handle(delta);
       /** Prevent default actions caused by mouse wheel.
        * That might be ugly, but we handle scrolls somehow
        * anyway, so don't bother here..
        */
       if (event.preventDefault)
               event.preventDefault();
    event.returnValue = false;
}

/** Initialization code. * If you use your own event management code, change it as required.
*/
//var scrollarea = document.getElementById("area");

/*
if (window.addEventListener)
       /** DOMMouseScroll is for mozilla. *//*
       window.addEventListener('DOMMouseScroll', wheel, false);
/** IE/Opera. *//*
window.onmousewheel = document.onmousewheel = wheel;
*/




 
    function moveCont(scrollerPos) {

//       var scrollerPos = mySwf.getYpos();
//       document.document.getElementById("anzeige").innerHTML = scrollerPos;

       var areaCont = document.getElementById("area");
       var contHeight = areaCont.offsetHeight;
 //      alert(contHeight);
       if(contHeight > 374)
       {
	//       alert(scrollerPos);
	       var top = - ( (scrollerPos - 10) * (contHeight - 374) / 270 );
	       document.getElementById("area").style.top = top + 'px';
	//       alert(top);
	//       document.getElementById("anzeige").innerHTML ="uuu";
	//			document.getElementById("anzeige").innerHTML = contHeight + "top: " + top;

	     }
    }

    function showPos()
    {
       var areaCont = document.getElementById("area");
       var contHeight = areaCont.offsetHeight;
    	 var scrollerPos = getFlexApp("asScroller").getRunnerPos();
       document.getElementById("anz4").innerHTML = scrollerPos;
	     var  top = - ( (scrollerPos - 10) * (contHeight - 374) / 280 );
	       document.getElementById("area").style.top = top + 'px';
    }
    
    function showScroller()
    {
       var areaCont = document.getElementById("area");
       var contHeight = areaCont.offsetHeight;
       if(contHeight > 374)
       {
       	document.getElementById("scroller").style.visibility = "visible";
       } 
      
			version = swfobject.getFlashPlayerVersion();
			if(version.major == "0")
			{
				
				document.getElementById("cnt").innerHTML = "<span class='n'>Um diese Seite richtig anschauen zu können, benötigen Sie Adobe Flash Player, den Sie von <a href=\"http://www.adobe.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash&Lang=German\" target=\"blank\">der Seite von Adobe</a> herunterladen und installieren können. </span>";
			} 
			
			
			if(window.attachEvent)
					areaCont.attachEvent("onmousewheel", wheel);
				else
				{
					if(window.addEventListener)
						areaCont.addEventListener('DOMMouseScroll', wheel, false);
				}

				//und noch die brutalo
				areaCont.onmousewheel = wheel; 	
 
    }
    
    function addScroller()
    {
    	
		document.write("<object classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000' codebase='http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0' width='15' height='374' id='asScroller' align='middle' style='vertical-align:text-top;margin:0;'>");
		document.write("<param name='allowScriptAccess' value='sameDomain' />");

		document.write("<param name='Menu' value='false'/>");
		document.write("<param name='quality' value='best' />");
		document.write("<param name='bgcolor' value='#000000' />");
		document.write("<param name='movie' value='f/asScroller.swf'/>");
		document.write("<embed src='f/asScroller.swf' quality='best'  bgcolor='#000000' width='15' height='374' name='asScroller' menu='false' align='middle' allowScriptAccess='sameDomain' "  + " type='application/x-shockwave-flash' pluginspage='http://www.macromedia.com/go/getflashplayer' />");
		document.write("</object>");    	
    	
    }
    

