$(function () {
     // start the ticker 
	$('#js-news').ticker();

	// hide the release history when the page loads
	$('#release-wrapper').css('margin-top', '-' + ($('#release-wrapper').height() + 20) + 'px');

	// show/hide the release history on click
	$('a[href="#release-history"]').toggle(function () {	
		$('#release-wrapper').animate({
			marginTop: '0px'
		}, 600, 'linear');
	}, function () {
		$('#release-wrapper').animate({
			marginTop: '-' + ($('#release-wrapper').height() + 20) + 'px'
		}, 600, 'linear');
	});	
	
	$('#download a').mousedown(function () {
		_gaq.push(['_trackEvent', 'download-button', 'clicked'])		
	});
	
});
// xml lesen u. ausgeben!
$(document).ready(function(){
			$.ajax({
				type: "GET",
				url: "termine11fa.xml",
				dataType: "xml",
				success: function(xml) {
					$(xml).find('termin').each(function(){
						var id       = $(this).attr('id');
						var tag      = $(this).find('tag').text();
						var datum    = $(this).find('datum').text();
						var beginn   = $(this).find('beginn').text();
						var wo       = $(this).find('ort').text();
						var links    = $(this).find('link').text();
						if(id%2){
						$('<tr id="link_'+id+'" class="zebra"></tr>').html('<td width="14%">'+tag+'</td>').appendTo('#page-wrap').mouseover(function(){$(this).addClass("over");}).mouseout(function(){$(this).removeClass("over");});
						}else{
						$('<tr id="link_'+id+'"></tr>').html('<td width="14%">'+tag+'</td>').appendTo('#page-wrap').mouseover(function(){$(this).addClass("over");}).mouseout(function(){$(this).removeClass("over");});
						}						
						$('<td></td>').html(datum).appendTo('#link_'+id);
						$('<td></td>').html(beginn).appendTo('#link_'+id);
						$('<td></td>').html(wo).appendTo('#link_'+id);
						$('<td></td>').html(links).appendTo('#link_'+id);
					});
				}
			});
		});
		//zebra  table over
		
		// accordion
		$.accordian = function(items, first, options) {


				var active = first;
				var running = 0;
 
				var titles = options && options.titles || '.title';
				var contents = options && options.contents || '.content';
				var onClick = options && options.onClick || function(){};
				var onShow = options && options.onShow || function(){};
				var onHide = options && options.onHide || function(){};
				var showSpeed = options && options.showSpeed || 'slow';
				var hideSpeed = options && options.hideSpeed || 'fast';


				$(items).not(active).children(contents).hide();
				$(items).not(active).each(onHide);
				$(active).each(onShow);


				$(items).children(titles).click(function(e){

 
					var p = $(contents, this.parentNode);
					$(this.parentNode).each(onClick);

 
					if (running || !p.is(":hidden")) return false;

					running = 2;

 
					$(active).children(contents).not(':hidden').slideUp(hideSpeed, function(){--running;});
					p.slideDown(showSpeed, function(){--running;});
 
					$(active).each(onHide);
					active = '#' + $(this.parentNode)[0].id;

					$(active).each(onShow);
 
					return false;

				});



			};
 
			function simpleLog(message) {
				$('<div>' + message + '</div>').appendTo('#log');
			}
 
			$(function(){

 				$.accordian('#list1 > div', '#item11', {
					titles:'.mytitle',
					contents:'.mycontent',
					onClick:function(){simpleLog(this.id + ' clicked')},
					onShow:function(){simpleLog(this.id + ' shown'); $(this).removeClass('off').addClass('on');},
					onHide:function(){simpleLog(this.id + ' hidden'); $(this).removeClass('on').addClass('off');},
					showSpeed:250,
					hideSpeed:550
				});


			});
// fancybox

$(document).ready(function() {
			/*
			*   Bandmitglieder popup / incl. srcoll
			*/

			$("a[rel=members]").fancybox({
				'transitionIn'		: 'none',
				'transitionOut'		: 'none',
				'titlePosition' 	: 'over',
				'titleFormat'		: function(title, currentArray, currentIndex, currentOpts) {
					return '<span id="fancybox-title-over">Image ' + (currentIndex + 1) + ' / ' + currentArray.length + (title.length ? ' &nbsp; ' + title : '') + '</span>';
				}
			});

			/*
			*   Youtube in groß!
			*/

			$("#various1").fancybox({
				'titlePosition'		: 'inside',
				'transitionIn'		: 'none',
				'transitionOut'		: 'none'
			});
            $("#various2").fancybox({
				'titlePosition'		: 'inside',
				'transitionIn'		: 'none',
				'transitionOut'		: 'none'
			});
			$("#various3").fancybox({
				'titlePosition'		: 'inside',
				'transitionIn'		: 'none',
				'transitionOut'		: 'none'
			});
			$("#various4").fancybox({
				'titlePosition'		: 'inside',
				'transitionIn'		: 'none',
				'transitionOut'		: 'none'
			});
			$('#fbWall').fbWall({
id:'089-band',
accessToken:'206158599425293|1f47f18762419bad9594e06f.1-1029609103|71k4anPs_V3Wl2objpotNZanJec',
showGuestEntries:true,
showComments:true,
max:10,
timeConversion:24
});
	
		});
