var Blende = 100;
var TimeOut_Name;

function Bild_ausblenden(img_id, bild_url){

	try {

		//alert(Blende);

		if (Blende > 20) {

			Blende = Blende - 20;

			//alert(Blende);

			document.getElementById(img_id).style.opacity = 1 - (100 - Blende)/100;
         	document.getElementById(img_id).style.MozOpacity = 1 - (100 - Blende)/100;
         	document.getElementById(img_id).style.KhtmlOpacity = 1 - (100 - Blende)/100;
         	document.getElementById(img_id).style.filter = "alpha(opacity="+Blende+")";

/*
			if (img_id.style.MozOpacity) {
				img_id.style.MozOpacity = '0.3';
			}

			alert("A");

			if (img_id.style.opacity) {
				img_id.style.opacity = (Blende /10);
			}

			alert("B");

			if (img_id.filters){
				if (img_id.filters.alpha){
					if (img_id.filters.alpha.opacity){
						img_id.filters.alpha.opacity = Blende *10;
					}
				}
			}
*/

			//alert("weiter");
			TimeOut_Name = window.setTimeout("Bild_ausblenden('"+img_id+"', '" + bild_url + "')", 1);
		} else {

			//alert("Blende nicht > 10 :: " + Blende);

			// Es ist genug ausgeblendet.
			document.getElementById(img_id).src = bild_url;

			// und wieder einblenden
			Bild_einblenden(img_id);

		}


	} catch(e){}
}

function Bild_einblenden(img_id){

	try {

		if (Blende < 90) {

			Blende = Blende + 10;

			document.getElementById(img_id).style.opacity = 1 - (100 - Blende)/100;
         	document.getElementById(img_id).style.MozOpacity = 1 - (100 - Blende)/100;
         	document.getElementById(img_id).style.KhtmlOpacity = 1 - (100 - Blende)/100;
         	document.getElementById(img_id).style.filter = "alpha(opacity="+Blende+")";

         	/*
			img_id.style.MozOpacity = (Blende /10);
			//alert(img_id.style.MozOpacity);
			img_id.style.opacity = (Blende /10);
			img_id.filters.alpha.opacity = Blende*10;
			*/

			TimeOut_Name = window.setTimeout("Bild_einblenden('"+img_id+"')", 1);

		} else {

			img_id.style.MozOpacity = '1.0';
			//alert(img_id.style.MozOpacity);
			img_id.style.opacity = '1.0';
			img_id.filters.alpha.opacity = 100;

		}

	} catch(e){}
}

/*

if (	document.getElementById(img_id).style.MozOpacity ) {
	alert("MozOpacity");
	//obj.tempobj.style.MozOpacity=obj.degree/101
}

if ( document.getElementById(img_id).style.KhtmlOpacity ) {
	alert("KhtmlOpacity");
	//obj.tempobj.style.KhtmlOpacity=obj.degree/100;
}

if ( document.getElementById(img_id).filters.alpha.opacity ) {
	alert("opacity");
	//obj.tempobj.style.KhtmlOpacity=obj.degree/100;
}

if ( document.getElementById(img_id).style.MozOpacity ) {
	alert("-moz-opacity");
	//obj.tempobj.style.KhtmlOpacity=obj.degree/100;
}

/*
if ( document.getElementById(img_id).style.-khtml-opacity ) {
	alert("-khtml-opacity");
	//obj.tempobj.style.KhtmlOpacity=obj.degree/100;
}
*/

function Bild(img_id, bild_url){

	window.clearTimeout(TimeOut_Name);
	Blende = 100;

	try {

		if (document.getElementById(img_id).filters) {
			if (document.getElementById(img_id).filters.blendTrans) {
				document.getElementById(img_id).filters.blendTrans.Apply();
			}
		} else {
			Bild_ausblenden(img_id, bild_url);
		}



	} catch(e){}

		if (document.getElementById(img_id).filters) {
			document.getElementById(img_id).src = bild_url;
		}
	try{
		if (document.getElementById(img_id).filters) {
			if (document.getElementById(img_id).filters.blendTrans) {
				document.getElementById(img_id).filters.blendTrans.Play();
			}
		}

	} catch (e){}
}

var Zoomfaktor;

function Zoom(Bild_ID){
	//alert(Bild_ID);

	MiniBild = document.getElementById(Bild_ID);
	Zoomfaktor = MiniBild.width / MiniBild.height;

	BildQuelle_klein = document.getElementById(Bild_ID).src;

	BildQuelle_gross = BildQuelle_klein.replace("mittel\/", "");

	//alert(BildQuelle_gross);

	ZoomBild =  document.getElementById("Zoombild");
	ZoomBild.src = BildQuelle_gross;

	ZoomBild.width = MiniBild.width;
	ZoomBild.height = MiniBild.height;

	document.getElementById('Bilder_Kasten').style.visibility = "visible";
	document.getElementById('Zoomschliess').style.display = "block";


	window.setTimeout("zoome_bild(1)", 3);

}

function zoome_bild(Richtung){

	//alert(Bild_ID);

	ZoomBild =  document.getElementById("Zoombild");

	if (Richtung == 1){
		ZoomBild.width = ( ZoomBild.width + 50);
		if ( ZoomBild.width < 400) {
			window.setTimeout('zoome_bild(1)', 1);
		}
	} else {
		ZoomBild.width = ( ZoomBild.width - 75);
		if ( ZoomBild.width > 30) {
			window.setTimeout('zoome_bild(0)', 1);
		} else {
			document.getElementById('Bilder_Kasten').style.visibility = "hidden";
		}
	}

	ZoomBild.height = Math.round( ZoomBild.width / Zoomfaktor);


}

function Zoom_ausblenden(){

	window.setTimeout("zoome_bild(0)", 3);
}



function zeige(_Bildname){
	zeige_weg(_Bildname);

	//alert(document.getElementById(_Bildname).style.visibility);
	var objBild = document.getElementById(_Bildname);

	objBild.style.visibility='visible';
	objBild.style.display='block';
}

function zeige_weg(_Bildname){

	var objBild;
	var strBild;

	for ( bi = 0; bi < Manschettenanzahl; bi++) {

		strBild = "dia_Manschette_" + bi;

		if (strBild == _Bildname) {
			// stehen lassen
		} else {
			objBild = document.getElementById(strBild);
			objBild.style.visibility='hidden';
			objBild.style.display='none';
		}
	}
}
