document.write(blend1);
document.write(blend2);
var bildbreite;
var bildhoehe;
var factorbild;
var preload;
var enddia = 0;
var begindia = 0;
var forward = false;
var last = false;
var stop = false;
var downscroll;
var bodystandard ="<link rel='stylesheet' href='" + root + "/css/bubble-tooltip.css' media='screen'></head><body bgcolor='" + backcolor + "' style='background-image:url(" + wallpaper + "); "
	+ "background-repeat:repeat;background-attachment:fixed;color:#FFFFFF;font-family:verdana;font-size:11pt'>"
	+ "<span id='bubble_tooltip'></span>";



function body(){
	document.write(bodystandard);
	
}
body();

function Fensterhoehe()
{
 if (window.innerHeight) return window.innerHeight;
 else if (document.body && document.body.offsetHeight) return document.body.offsetHeight;
 else return 0;
}
function Fensterweite()
{
 if (window.innerWidth) return window.innerWidth;
 else if (document.body && document.body.offsetWidth) return document.body.offsetWidth;
 else return 0;
}

function bildpass(){
		var Hoehe = Fensterhoehe() - verdistrel;
		var Weite = Fensterweite() - hordistrel;
		bildbreite = bild.width;
		bildhoehe = bild.height;
		factorbild = bild.width/bild.height;
		bildhoehe = Hoehe;
		bildbreite = bildhoehe * factorbild;
		if (bildbreite > Weite){
			bildbreite = Weite;
			bildhoehe = bildbreite / factorbild;
			}
		return bildbreite;
}
var ifrwidth;
var ifrheigt;
function showhtml(href){
	var hoehe = Fensterhoehe() - verdistrel;
	var weite = Fensterweite() - hordistrel - (borderleft/3);
	var bildundtext= "<iframe allowtransparency='true' src=" + href + " width=" + weite + " height=" + hoehe + " id='ifrhtml' frameborder=0></iframe>"
			+"<br><br><center><input type='button' value='" + backtext
	        	+ "' style='background-color:" + buttoncolor + ";color:" + fontcolor + "; font-family: " + font + "; "
	        	+ "font-size: " + (fontsize - 4) + "' onClick='location.reload()'>";
	document.getElementById("divglobe").innerHTML = bildundtext;
	
	
	
}

function showpic (option,txt){
	
	
	//alert(downscroll);
	
	window.scrollTo(0, 0);

	txt = replaceit(txt,"&nbsp"," ");
		bildbreite = bildpass();
	if (opt > 0){
		bildhoehe = opt;
		bildbreite = bildhoehe * factorbild;
		}

	if (lang == 0){
		      backtext = "Back"
		      n = 2 * textnr;
		      }
	else{
		backtext = "Zurück"
		n = (2 * textnr) + 1;
		}
	
	var bildundtext = "<table width=" + bildbreite + " border='0'"
			+ " bgcolor='" + backcolor + "'"
			+ " style='background-image:url(" + wallpaper + ")'>"
	 		+"<tr><td align='center'><img src="
	 		+ bild.src
	 		+ " name='picture' "
	 		+ " style='border-color:" + fontcolor + ";border-style: solid; border-width:2px;"
	 		+" width: " + bildbreite + "px; height:" + bildhoehe + "px'>"
			+ "</td></tr><tr><td align='center' style='font-family: "
			+ font + "; color:" + fontcolor + "; font-size:" + fontsize + "px '>" + txt + "</td></tr>"
			+ "<tr><td align='center'>"
			+ "<input id='backbutton' name='B1' type='button' value=" + backtext + " style='background-color:"
			+ buttoncolor + ";color:" + fontcolor + "; font-family: ";
			if(backlink.indexOf("history.back") >= 0){
				bildundtext = bildundtext + font + "; font-size:" + (fontsize-4) + "px' onClick='window.location.href=\""+ backlink + "\"'><\/td><\/tr><\/table>";
			}
			else{
				bildundtext = bildundtext + font + "; font-size:" + (fontsize-4) + "px' onClick='window.location.href=\""+ backlink + "?" + downscroll + "\"'><\/td><\/tr><\/table>";
			}

	document.getElementById("divglobe").innerHTML = bildundtext;

}
function scroll(){
	var down =  document.URL.split("?");
	window.scrollTo(0, down[1]);



}


var thumbgr = new Array ();

function printthumbs(anfang,ende,idoffset,zoom){
	//alert(lang);
	
	k = 0;
	cr = 0;
	n = anfang;
	if(lang == 1){n++};
	var hoch, breit;
	document.write("<table border='0'><tr><td height='110px' valign='bottom'>");
	for (k=anfang + idoffset; k <= ende + idoffset; k++){
		thumbgr[k] = new Image();
		thumbgr[k].id = "pic" + k;
		thumbgr[k].src = thumbspath + pic + k + thumbsendgr_1;
	
		//thumbgr[k].border = 0;
	
			document.write("<a href=\"javascript:loadpic('" + picpath + pic + k + "b" + picend_1 + "'," + zoom + ",'" + replaceit(text[n],' ','&nbsp') + "')\"><img src="
				+ thumbgr[k].src
				+ " id=" + thumbgr[k].id
				+ " style='border:" + borderwidth + ";border-color:" + bordercolor + ";border-style:ridge;'"
				+ "' alt='" + text[n] + "'"
				+ " onmouseover=thumbchange(" + k + ",1,'" + thumbspath + pic + k + "')"
				+ " onmouseout=thumbchange(" + k + ",0,'" + thumbspath + pic + k + "')"
				+"></a>");
				//if(k==0||k==1){alert(document.getElementById(thumbgr[k].id).href)}
		n+=2;
		cr++;
		if(cr % 12 == 0){document.write("</td></tr><tr><td height='110px' valign='bottom'>");}//Zeilenumbruch
		}
	
	
	document.write("</td></tr></table>");
	document.close;
}

function thumbchange(k,color,thumb){
if (color == 1){
	document.getElementById(thumbgr[k].id).src = thumb + thumbsend_1;
	}
else {
	document.getElementById(thumbgr[k].id).src = thumb + thumbsendgr_1;
	}
}

function wait(){
	
	if (lang == 0){
		var wtext = "Please wait a moment, loading...<br><br>";
		}
	else {
		var wtext = "Bitte warten, lade Dateien...<br><br>";
		}
	//wtext = wtext + "<br><br><br><img src='"
	//	    + sanduhr
	//	    + "'>";
	//wtext = wtext + pbar;
	wtext = wtext + waitgif;
	return(wtext);
	
}

function loadpic(Picture,option,Text){
	downscroll = document.body.scrollTop;
	opt = option;
	txt = Text;
	textnr = Picture.match(/\d+/gi);

	bild = new Image();
	bild.src = Picture;
	preload = window.setInterval('checkcache(opt)', 250);
	//window.setTimeout("wait()",400);
}

function checkcache(option){
	//alert(document.getElementById("divglobe").innerHTML.indexOf(waitgif));

	if(bild.complete == true){
		window.clearInterval(preload);
		showpic(opt,txt);
	}
	else{
		//Crit wait
		if (document.getElementById("divglobe").innerHTML.indexOf(waitgif) < 0){
			document.getElementById("divglobe").innerHTML = wait();
			}
		
		}

}



function flash(name,quelle,breit,hoch,text){
	
	var hoehe = Fensterhoehe() - verdistrel;
	var weite = Fensterweite() - hordistrel - borderleft;
	
	var bildundtext= "<center><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='" +weite + "' height='" + hoehe + "' id='" + name + "' align='middle'>"
			+"<param name='allowScriptAccess' value='sameDomain' />"
			+"<param name='movie' value='" + quelle + "' />"
			+"<param name='quality' value='best' />"
			+"<param name='wmode' value='transparent' />"
			+"<embed src='" + quelle + "' quality='best' width='" + weite + "' "
			+"height='" + hoehe + "' wmode ='transparent' name='mymovie' align='middle' allowScriptAccess='sameDomain' " 
			+"type='application/x-shockwave-flash' pluginspage='http://www.macromedia.com/go/getflashplayer' />"
			+"</object>"
			+ "<br><br><input type='button' value='" + backtext
			+ "' style='background-color:" + buttoncolor + ";color:" + fontcolor + "; font-family: " + font + "; "
			+ "font-size: " + (fontsize - 4) + "' onClick='location.reload()'></center></span>";

	document.getElementById("divglobe").innerHTML = bildundtext;
}

chopacoff = new Array;
chopacmond = new Array;
function opacity(id, opacStart, opacEnd, millisec) {

	//speed for each frame
	var speed = Math.round(millisec / 100);
	var timer = 0;

	//determine the direction for the blending, if start and end are the same nothing happens
	if(opacStart > opacEnd) {
		for(i = opacStart; i >= opacEnd; i--) {
			switch(id){
				case "offpic":
					chopacoff[i] = setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed));
				case "mond":
					
					chopacmond[i] = setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed));
					
				default:
					setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed));
				}


			timer++;
			}
	} 
	else {
		
		for(i = opacStart; i <= opacEnd; i++)
			{
			switch(id){
				case "offpic":
					chopacoff[i] = setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed));
				case "mond":
				
					chopacmond[i] = setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed));
				default:
					setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed));
				}
			timer++;
			}
	}
}

//change the opacity for different browsers
function changeOpac(opacity, id) {
	
	if (document.getElementById(id)){
		var object = document.getElementById(id).style; 
		object.opacity = (opacity / 100);
		object.MozOpacity = (opacity / 100);
		object.KhtmlOpacity = (opacity / 100);
		object.filter = "alpha(opacity=" + opacity + ")";
		document.getElementById(id).style.visibility = "visible";
		}
}

function shiftOpacity(id, millisec) {
	//if an element is invisible, make it visible, else make it ivisible
	if(document.getElementById(id).style.opacity == 0) {
		opacity(id, 0, 100, millisec);
	} else {
		opacity(id, 100, 0, millisec);
	}
}

function currentOpac(id, opacEnd, millisec) {
	//standard opacity is 100
	var currentOpac = 100;
	
	//if the element has an opacity set, get it
	if(document.getElementById(id).style.opacity < 100) {
		currentOpac = document.getElementById(id).style.opacity * 100;
	}

	//call for the function that changes the opacity
	opacity(id, currentOpac, opacEnd, millisec)
}

var p = 0;


function showpicsl(blend){
	if (stop == true) return;
	var bildbreitepre;
	//alert(p);
	document.getElementById("S3").style.top = 0;
	document.getElementById("S3").style.left = 0;
	var backtext;
	if (lang == 0){backtext = "\"End slideshow\""}
	else {backtext ="\"Diashow beenden\""}
	var millisec = 500;
	if (cook == 1){lang = getCookie("language")}
	if(bild.complete == true){
		bildbreite = bildpass();
		if (bildbreite > bildhoehe){
			//bildbreite = bildpass() - (borderleft/2);
		}


		if (picsl[p - 1] && p > begindia){
			if(blend == true){
			opacity('imageidv', 100, 0, millisec);
			document.getElementById("S1").innerHTML = "<img width=" + bildbreitepre
								+ " src='" + picsl[p - 1] + "' "
								+ "style='z-index:0;border-width:3;"
								+ "position:absolute;top:15;left:" + (borderleft/2) + ";"
								+ "border-style:ridge;' "
								+ "id='imageidv' alt=''>";
			}

		}
		document.getElementById("S2").innerHTML = "<img width=" + bildbreite+ " src='" + picsl[p] + "' "
							+ "style='z-index:1;border-width:3;"
							+ "position:absolute;top:15;left:" + (borderleft/2) + ";"
							+ "border-style:ridge;-moz-opacity:0;"
							+ "filter:alpha(opacity=0);' id='imageid' alt=''>";
		document.getElementById("S3").innerHTML = "<table id='S3tab'><td><center>" + textsl[p] + "</td></center></table>";
		with (document.getElementById("S3tab")){
			style.position = "absolute";
			style.top = document.getElementById('imageid').height + 35;
			style.fontSize = fontsize;
			width = bildbreite;
			border = "0 #FFFFFF solid";
			style.left = (borderleft/2);
			}
					
		document.getElementById("S4").innerHTML = "<span style='position:absolute;top:" 
						+ (document.getElementById('imageid').height + 75) +"px;"
						+ "left:" + (borderleft/2) + "px;'>" 
						+ "<input id='endslide' name='B2' type='button' "
						+ "value=" + backtext + " style='background-color:"
						+ buttoncolor + ";color:" + fontcolor + "; font-family: "
						+ font + "; font-size:" + (fontsize-4) + "px';"
						+ " onClick='window.location.href=\""+ backlink +"\"'>"
						
						+ "<input id='lastpic' name='lastpic1' type='button' "
						+ "value=" + ' "<" ' + " style='background-color:"
						+ buttoncolor + ";color:" + fontcolor + "; font-family:"
						+ font + ";font-size:" + (fontsize-4) + "px';"
						+ " onClick='lastpic()'>"
						
						
						+ "<input id='speedminus' name='speedminus1' type='button' "
						+ "value=" + ' - ' + " style='background-color:"
						+ buttoncolor + ";color:" + fontcolor + "; font-family: "
						+ font + "; font-size:" + (fontsize-4) + "px';"
						+ " onClick='change_diaintervall(diaintervall - 1000)'>"
						
						
						+ "<input id='speed1' name='speed1' type='text' size=6 "
						+ " value=" + (diaintervall/1000)+ "&#160sec style='text-align:center;background-color:"
						+ buttoncolor + ";color:" + fontcolor + "; font-family: "
						+ font + "; font-size:" + (fontsize-4) + "px' readonly>"
						
						
						+ "<input id='speedplus' name='speedplus1' type='button' "
						+ "value=" + ' + ' + " style='background-color:"
						+ buttoncolor + ";color:" + fontcolor + "; font-family: "
						+ font + "; font-size:" + (fontsize-4) + "px';"
						+ " onClick='change_diaintervall(diaintervall + 1000)'>"
						
						+ "<input id='nextpic' name='nextpic1' type='button' "
						+ "value=" + ' ">" ' + " style='background-color:"
						+ buttoncolor + ";color:" + fontcolor + "; font-family:"
						+ font + ";font-size:" + (fontsize-4) + "px';"
						+ " onClick='nextpic()'>"
						
						+ "<input id='stop' name='stop1' type='button' "
						+ "value=" + ' "Stop" ' + " style='background-color:"
						+ buttoncolor + ";color:" + fontcolor + "; font-family:"
						+ font + ";font-size:" + (fontsize-4) + "px';"
						+ " onClick='stopsl()'></span>";


		

		//opacity('acttext', 0, 100, millisec);

		bildbreitepre = bildbreite;
		opacity('imageid', 0, 100, millisec);
		
		p++;
		if (enddia == 0){enddia = picsl.length};
		if (p >= enddia){
			p = begindia;
			t = begindia;
			};
			
			window.clearInterval(preload);
			window.clearInterval(showpic);
			
			
		if (forward == false && last == false){preloadslpic(picsl[p],diaintervall,'end')}
			
		
		
			
		}

}
function stopsl(){
	if(document.getElementById("stop").value == "Stop"){
	stop = true;
	document.getElementById("stop").value = "Start";
	document.getElementById("stop").style.backgroundColor = "#AA0000";
	//document.getElementById("stop").onClick = contsl();
	document.getElementById("lastpic").disabled = true;
	document.getElementById("lastpic").style.backgroundColor = "#BBBBBB";
	document.getElementById("nextpic").disabled = true;
	document.getElementById("nextpic").style.backgroundColor = "#BBBBBB";
	}
	else{
	stop = false;
	document.getElementById("stop").value = "Stop";
	document.getElementById("stop").style.backgroundColor = buttoncolor;
	document.getElementById("lastpic").disabled = false;
	document.getElementById("lastpic").style.backgroundColor = buttoncolor;
	document.getElementById("nextpic").disabled = false;
	document.getElementById("nextpic").style.backgroundColor = buttoncolor;
	}
}





function lastpic(){
	
	if (stop == true||p == begindia) return;
	last = true;
	window.clearInterval(showpic);
	p -= 2;
	if (p <= begindia){p = begindia}
	if(p < 0){p = 0}
	preloadslpic(picsl[p],100);
	
	
}
function nextpic(){
	if (stop == true) return;
	forward = true;
	window.clearInterval(showpic);
	preloadslpic(picsl[p],100);
	
	
}
function preloadslpic(Picture,intervall,end){
		if (stop == true) return;
		preload = 0;
		bild = new Image();
		bild.src = Picture;
		
		if (p == begindia && !end){
			showpic = window.setInterval('showpicsl(true)', 1000);
			}
		
		else{
			if(last == true){showpic = window.setInterval('showpicsl(false)', intervall)}
			else{showpic = window.setInterval('showpicsl(true)', intervall)}
			}
		last = false;
		forward = false;	
			
		
		
			
}
	
	
function change_diaintervall(val){
	if(val < 2000) return;
	diaintervall = val;
	document.getElementById('speed1').value = (val/1000) + ' sec';

}

function diashow(begin,end){
	
	var preload = 0;
	var k = 0;
	picsl = new Array;
	textsl = new Array;

	for (var n = 0; n < document.getElementsByTagName("a").length; n++){
		pic = document.getElementsByTagName("a")[n].href
		if (pic.indexOf('pictures', 0)>= 0){
			pic = pic.split("'");
			pic[0] = replaceit(pic[1],"'");
			picsl.unshift(pic[1]);
			//alert(pic[3]);
			pic[3] = replaceit(pic[3],"&nbsp"," ");
			pic[3] = replaceit(pic[3],"'");
			pic[3] = replaceit(pic[3],")");
			pic[3] = replaceit(pic[3],"%C2%A0"," ");
			pic[3] = replaceit(pic[3],"%C3%BC","ü");
			pic[3] = replaceit(pic[3],"%C3%B6","ö");
			pic[3] = replaceit(pic[3],"%C3%A4","ä");
			pic[3] = replaceit(pic[3],"%C3%84","Ä");
			pic[3] = replaceit(pic[3],"%C3%96","Ö");
			pic[3] = replaceit(pic[3],"%C3%9C","Ü");
			pic[3] = replaceit(pic[3],"%C3%9F","ß");
			pic[3] = replaceit(pic[3],"%C3%B8","ø");
			textsl.unshift(pic[3]);
			}
		}
	for (var n = 0; n < document.getElementsByTagName("div").length; n++){
		document.getElementsByTagName("div")[n].style.visibility = "hidden";
		}
	for(i = 1;i <= 5; i++){
		document.getElementById("S" + i).style.visibility = "visible";
		
	}

	picsl.reverse();
	textsl.reverse();
	if (begin > 0){begin--}
	p = begin;
	begindia = begin;
	enddia = end;
	preloadslpic(picsl[p],diaintervall);
	
}

function showToolTip(e,text,xo,yo,or){
	
	if(document.all)e = event;
	document.getElementById("bubble_tooltip").innerHTML =  "<div class='bubble_top' id='bubble_top'><span></span></div>"
						 + "<div id='bubble_middle' class='bubble_middle'><span id='bubble_tooltip_content'></span></div>"
						 + "<div class='bubble_bottom' id='bubble_bottom'></div>";
		//if(or){
			document.getElementById('bubble_top').style.backgroundImage = "url(" + root + "pictures/bubble_top_u.gif)";
			document.getElementById('bubble_middle').style.backgroundImage = "url(" + root + "pictures/bubble_middle.gif)";
			document.getElementById('bubble_bottom').style.backgroundImage = "url(" + root + "pictures/bubble_bottom_u.gif)";
			
		//}
	var obj = document.getElementById('bubble_tooltip');
	var obj2 = document.getElementById('bubble_tooltip_content');
	obj2.innerHTML = text;
	obj.style.display = 'block';
	var st = Math.max(document.body.scrollTop,document.documentElement.scrollTop);
	if(navigator.userAgent.toLowerCase().indexOf('safari')>=0)st=0; 
	var leftPos = tempX + xo;
	if(leftPos<0)leftPos = 0;
	obj.style.left = xo + leftPos + 'px';
	obj.style.top = e.clientY - obj.offsetHeight -10 + st + yo + 'px';
	
}	



function hideToolTip()
{
	document.getElementById('bubble_tooltip').style.display = 'none';
	
}