function openPic(imageName,imageWidth,imageHeight,alt) {
 	newWindow = window.open("","newWindow","width="+imageWidth+",height="+imageHeight+",scrollbars=no,left="+(Math.floor((screen.availWidth-imageWidth-10)/2))+",top="+(Math.floor((screen.availHeight-imageHeight-15)/2)));
	newWindow.document.open();
	newWindow.document.write('<html><title>'+alt+'</title><body bgcolor="#FFFFFF" leftmargin="0" topmargin="0" marginheight="0" marginwidth="0" onBlur="self.close()" onClick="self.close()">'); 
	newWindow.document.write('<img src=\"'+imageName+'\" width='+imageWidth+' height='+imageHeight+' title=\"'+alt+'\" alt=\"'+alt+'\" galleryimg=\"no\">');
	newWindow.document.write('</body></html>');
	newWindow.document.close();
	newWindow.focus();
}

function showPerson(userName) {
      var win = window.open("http://www.kirchenserver.net/bwo/opencms/sites/bistum/vk/personen/anzeige.html?f_action=show_user&f_user_name=" + userName,"preview_stelle_person", "toolbar=no, location=no, directories=no, status=no, menubar=0, scrollbars=yes, "+ "resizable=yes, top=10, left=" + ((screen.width-625) / 2) + ", width=525, height=600");
      if (win != null) {
            win.opener = self;
            win.focus();
			}
	  return false;
}

function showPerson2(url) {
	  var win = window.open(url,"preview_stelle_person", "toolbar=no, location=no, directories=no, status=no, menubar=0, scrollbars=yes, "+ "resizable=yes, top=10, left=" + ((screen.width-625) / 2) + ", width=525, height=600");
      if (win != null) {
            win.opener = self;
            win.focus();
			} 
	  return false;
}


function gotoTop() {
	window.scrollTo(0,0);
}

if (typeof $ != 'undefined') {
$(document).ready(function(){
	if ($(window).width()>1200) {
		$('body').append('<div id="button-app"><a href="http://itunes.apple.com/de/app/artguide/id395723732?mt=8" target="_blank"><img src="/assets/typo/button-app.png" /></a></div>').hide().fadeIn('normal');
	}
	$('body').append('<div id="banner-geschlossen"><a href="http://www.dom-wuerzburg.de/rundgang/fuehrungen"><img src="/assets/typo/banner-geschlossen-2.png" /></a></div>').hide().fadeIn('normal');
	var ie6tf = true;
	if (typeof document.body.style.maxHeight != "undefined") { ie6tf = false; }
	if ($('#largeImg').size()>0) {
		$('#largeImg').wrap('<div class="largeImgCol"></div>');
		$('#largeImg').wrap('<a href="javascript:;" title="Bild verkleinern" id="largeImgLink"></a>');
		$('#largeImg').parent().append('<img src="/assets/typo/smaller2.gif" class="imgSizeIcon" />');
		if (ie6tf===false) {
		$('#largeImg').parent().hover(function(){
			$(this).children('img.imgSizeIcon').css('opacity',0);
			$(this).children('img.imgSizeIcon').fadeTo('slow',1.0);
		},function(){
  			$(this).children('img.imgSizeIcon').fadeOut("fast");
		}); 
		}
		$('.imgCol p.caption').clone().insertAfter('#largeImgLink');
		$('.largeImgCol p.caption a').text('kleiner');
		$('.imgCol > a').wrap('<div class="smallImgCol"></div>');
		$('.imgCol p').appendTo('.smallImgCol');
		$('.imgCol a img').parent().append('<img src="/assets/typo/larger2.gif" class="imgSizeIcon" />');
		$('.imgCol a').attr('href','javascript:;');
		$('.largeImgCol a').attr('href','javascript:;');
		$('.imgCol a').attr('title','Bild vergrößern');
		if (ie6tf===false) {
		$('.imgCol a > img').parent().hover(function(){
			$(this).children('img.imgSizeIcon').css('opacity',0);
			$(this).children('img.imgSizeIcon').fadeTo('slow',1.0);
		},function(){
  			$(this).children('img.imgSizeIcon').fadeOut('fast');
		});  
		}
		$('.imgCol a').click(function(){
			//$('.smallImgCol').hide();
			$('.largeImgCol').show();
		});
		$('.largeImgCol').appendTo('.content');
		$('.largeImgCol a').click(function(){
			$('.largeImgCol').hide();
			//$('.smallImgCol').show();
		});
	}
	if ($('#img1').size()>0) {
		window.curIdx = 0;
		window.maxId = 4;
		if ($('body.theologie').size()>0) window.maxId = 5;
		$('.slides div').appendTo('.imgCol');
		$('.imgCol p').append('<br /><span>[</span>&nbsp;&#8250;&nbsp;<a href="javascript:;">nächstes Bild</a>&nbsp;<span>]</span>');
		$('.imgCol div img').wrap('<a href="javascript:;" title="nächstes Bild"></a>');
		$('.imgCol div img').parent().append('<img src="/assets/typo/next.gif" class="imgSizeIcon" />');
		$('.imgSizeIcon').hide();
		if (ie6tf===false) {
		$('.imgCol div img').parent().hover(function(){
			$('img.imgSizeIcon').css('opacity',0);
			$('img.imgSizeIcon').fadeTo("slow", 1.0);
		},function(){
  			$('img.imgSizeIcon').hide();
		});
		}
		$('.imgCol a').click(function(){
		    $('.imgCol div').hide();
			var n = window.curIdx;
			$('#img'+n).css('zIndex',10);
			$('#img'+n).show();
			$('#img'+n+' img').not('.imgSizeIcon').show();	
			$('#img'+n+' p').hide();
			var o = n+1; if (o>window.maxId) o = 0;
			$('#img'+o).css('zIndex',12);
			$('#img'+o).show();
			//$('#img'+o+' img').hide();	
			$('#img'+o+' img').not('.imgSizeIcon').fadeIn('slow');			
			$('#img'+o+' p').show();
			window.curIdx = o;
		});
		$('.copy a').click(function(){
			var u = $(this).attr('href');
			var n = window.curIdx;
			var o = eval(u.substring(4));
			if (u.substring(0,4) == '#img' && n!=o) {
			$('.imgCol div').hide();
			$('#img'+n).css('zIndex',10);
			$('#img'+n).show();
			$('#img'+n+' img').not('.imgSizeIcon').show();	
			$('#img'+n+' p').hide();
			$('#img'+o).css('zIndex',12);
			$('#img'+o).show();
			//$('#img'+o+' img').hide();	
			$('#img'+o+' img').not('.imgSizeIcon').fadeIn('slow');			
			$('#img'+o+' p').show();
			window.curIdx = o;
			}
			return false;
		});
	} 
 });
}
