function startGallery() {
	var myGallery = new gallery($("myGallery"), {
		timed: true,
		showArrows: false,
		showCarousel: false,
		embedLinks: false,
		showInfopane: false
	});
};


var TafelnGalNummern; 
var TafelnGalNummernIndex = 0
function BuildTafelnGalNummern(galleryObj){
	TafelnGalNummern = new Element('ul', {'id': 'tafeln-zahler'});
	for(i=1; i<=galleryObj.maxIter; i++){
		TafelnGalNummern.grab(new Element('li', {'html': i}))
		
	}
	(TafelnGalNummern.getChildren('li')[TafelnGalNummernIndex]).addClass('aktiv');
	$('tafeln-gallery').grab(TafelnGalNummern, 'after');

}

function TafelnGalNummernChangeState(inc){
	TafelnGalNummernIndex += inc
	if(TafelnGalNummernIndex >= TafelnGalNummern.getChildren('li').length) TafelnGalNummernIndex = 0;
	if(TafelnGalNummernIndex < 0) TafelnGalNummernIndex = TafelnGalNummern.getChildren('li').length-1;
	TafelnGalNummern.getChildren('li').removeClass('aktiv');
	(TafelnGalNummern.getChildren('li')[TafelnGalNummernIndex]).addClass('aktiv');
}
function StartTafelnGallery() {
	var myGallery = new gallery($('tafeln-gallery'), {
		timed: true,
		showArrows: true,
		showCarousel: false,
		embedLinks: false,
		showInfopane: false,
		defaultTransition: "fadeslideleft",
		onStart: function(e){
			if(this.maxIter>1) BuildTafelnGalNummern(this);
		},
		onNextCalled: function(){
			TafelnGalNummernChangeState(1)
		},
		onPreviousCalled: function(){
			TafelnGalNummernChangeState(-1)
		}
	});
};
		
		

window.addEvent('domready', function(){
	if(typeof(wsAjax)!="undefined"){wsLoad()};
	
	
	
	var initMultiBox = new multiBox({
		mbClass: '.wvap',//class you need to add links that you want to trigger multiBox with (remember and update CSS files)
		container: $(document.body),//where to inject multiBox

		//path: './Files/',//path to mp3 and flv players
		useOverlay: true,//use a semi-transparent background. default: false;
		maxSize: {w:975, h:600},//max dimensions (width,height) - set to null to disable resizing
		addDownload: false,//do you want the files to be downloadable?
		addRollover: false,//add rollover fade to each multibox link
		addOverlayIcon: false,//adds overlay icons to images within multibox links
		addChain: true,//cycle through all images fading them out then in
		recalcTop: true,//subtract the height of controls panel from top position
		addTips: true,//adds MooTools built in 'Tips' class to each element (see: http://mootools.net/docs/Plugins/Tips)
		autoOpen: 0//to auto open a multiBox element on page load change to (1, 2, or 3 etc)
	});
	
	
	
	if($('myGallery')){ startGallery(); }
	if($('tafeln-gallery')){ StartTafelnGallery(); }
	
	if($('weinviertel_multislide')){
		multislide = new multislide('ms_container', 
		{
			slide_duration:			600,
			slide_transition: 		'quint:out',
			class_toggler: 			'control',
			
			onExpand: function(el){
			//	$('slidebtn').setProperty('src','btn_unten.gif');
			//	$('slidebtn').setProperty('alt','Antwort ausblenden');
			},
			
			onCollapse: function(el){
				//$('slidebtn').setProperty('src','btn_rechts.gif');
			//	$('slidebtn').setProperty('alt','Antwort einblenden');
			}
		});
	}
	
	if($('fb-root')){
		 window.fbAsyncInit = function() {
		    FB.init({appId: '151687288195727', status: true, cookie: true,
		             xfbml: true});
		  };
		  (function() {
		    var e = document.createElement('script'); e.async = true;
		    e.src = document.location.protocol +
		      '//connect.facebook.net/de_DE/all.js';
		    	document.getElementById('fb-root').appendChild(e);
		  }());
	}

});



