$(document).ready(function() {
	band.init();
	if($('body').hasClass('impressum')) {
		
	} else {
	$(".scroll").click(function(event) {
		event.preventDefault();
		var full_url = this.href;
		var parts = full_url.split("#");
		var trgt = parts[1];
		var target_offset = $("#"+trgt).offset();
		var target_top = target_offset.top;
		$('html, body').animate({scrollTop:target_top}, 500);
	});
	}

	$('#contentblock-video-teaser a').click(function() {
		$.fancybox({
			'padding'		: 0,
			'autoScale'		: true,
			'overlayColor'	: '#000',
			'transitionIn'	: 'fade',
			'transitionOut'	: 'fade',
			'speedIn'		: 750,
			'speedOut'		: 500,
			'title'			: this.title,
			'width'			: 720,
			'height'		: 495,
			'href'			: this.href = this.href.replace(new RegExp("watch\\?v=", "i"), 'v/') + '&autoplay=1&hd=1',
			'type'			: 'swf',
			'swf'			: {'allowfullscreen':'true', 'wmode': 'transparent'}
		});
		return false;
	});
	$("#media a").fancybox({
		'transitionIn'	:	'elastic',
		'transitionOut'	:	'elastic',
		'speedIn'		:	600, 
		'speedOut'		:	200, 
		'overlayShow'	:	true
	});

});

var band = {
		
	init: function() {
		$('#band').each(function(i, bandEl) {
			band.createStructure(bandEl);
			band.parseMembers(bandEl);
			$('#band-stage').fadeIn(750);
		});
	},
	
	createStructure: function(bandEl) {
		$(bandEl).append('<div id="band-stage"><p></p></div>');
		$('#band-stage', bandEl).hide();
		$('li p', bandEl).hide();
		alltext = "";
		$('#band-stage p').html(alltext);
	
	},

	parseMembers: function (bandEl) {

		$('#band #band-alex .band-area, #band-alex div.info').mouseover(function(){
			$('#band #all-img').css('background-position','656px 0px');
			text = $(this).parent().find('p').html();
			$('#band-stage p').html(text);
			$('#band-alex div.info').toggleClass('hover');
		});
		
		$('#band #band-alex .band-area, #band-alex div.info').mouseout(function(){
			$('#band #all-img').css('background-position','0px 0px');
			$('#band-alex div.info').toggleClass('hover');
			$('#band-stage p').html(alltext);
		});
		
		$('#band #band-Daniel .band-area, #band-Daniel div.info').mouseover(function(){
			$('#band #all-img').css('background-position','0px 1040px');
			text = $(this).parent().find('p').html();
			$('#band-stage p').html(text);
			$('#band-Daniel div.info').toggleClass('hover');
		});
		
		$('#band #band-Daniel .band-area, #band-Daniel div.info').mouseout(function(){
			$('#band #all-img').css('background-position','0px 0px');
			$('#band-Daniel div.info').toggleClass('hover');
			$('#band-stage p').html(alltext);
		});
		
		$('#band #band-calli .band-area, #band-calli div.info').mouseover(function(){
			$('#band #all-img').css('background-position','656px 1040px');
			text = $(this).parent().find('p').html();
			$('#band-stage p').html(text);
			$('#band-calli div.info').toggleClass('hover');
		});
		
		$('#band #band-calli .band-area, #band-calli div.info').mouseout(function(){
			$('#band #all-img').css('background-position','0px 0px');
			$('#band-calli div.info').toggleClass('hover');
			$('#band-stage p').html(alltext);
		});
		
		$('#band #band-consti .band-area, #band-consti div.info').mouseover(function(){
			$('#band #all-img').css('background-position','0px 520px');
			text = $(this).parent().find('p').html();
			$('#band-stage p').html(text);
			$('#band-consti div.info').toggleClass('hover');
		});
		
		$('#band #band-consti .band-area, #band-consti div.info').mouseout(function(){
			$('#band #all-img').css('background-position','0px 0px');
			$('#band-consti div.info').toggleClass('hover');
			$('#band-stage p').html(alltext);
		});
		
	}
	
}

