Event.observe(window, "load", function() {
	if($('gallery_1'))
		new UI.Carousel('gallery_1',{scrollInc:6});
	if($('gallery_2'))
		new UI.Carousel('gallery_2',{scrollInc:6});
	if($('gallery_3')) {
		var carousel3 = new UI.Carousel('gallery_3',{scrollInc:1}).observe('scroll:ended', function(event) {
		  carouselUpdateText(event.memo.carousel);
		});
		carouselUpdateText(carousel3);
	}
	if($('gallery_4')) {
		var carousel4 = new UI.Carousel('gallery_4',{scrollInc:1}).observe('scroll:ended', function(event) {
		  carouselUpdateText(event.memo.carousel);
		});
		carouselUpdateText(carousel4);
	}
	
	if($$('[href="/templates/flash/IBBMap.swf?scale=noscale"]')) {
		
	}
});


function carouselUpdateText(carousel)
{	
	var index = Math.round(carousel.currentIndex())+1;
	var elements = carousel.elements;
	if(elements.length>index)
		$$('.GalleryText').first().update(elements[index].childElements().first().alt);
	
}

function openInOpener(landNumber) {
	trackingcenter.event('bauplatz.'+landNumber+'.interesse').beam();
	var formElem = $('sendLandNumber');
	if (formElem != null) {
		formElem['landNumber'].setAttribute('value', landNumber);
		formElem.submit();
	}
	
}
function landClick(landNumber){
	trackingcenter.event('bauplatz.'+landNumber+'.detail').beam();
}
