$(document).ready(function() {
	$('img#under-construction').css('opacity', .5);
	$('img#under-construction').click(function() {
		if ($(this).hasClass('zoomed')) {
			heightTo = 77; widthTo = 180;	
			opacityTo = .5;			
		} else {
			heightTo = 193; widthTo = 403;
			opacityTo = 1;
		}
	  $(this).animate({	    
	    height: heightTo,
	    width: widthTo,
	    opacity: opacityTo
	  }, 250, function() {
	    // Animation complete.
	    if ($(this).hasClass('zoomed')) {
	    	$(this).removeClass('zoomed');
	    } else {
	    	$(this).addClass('zoomed');
	    }
	  });
	});
	
	$("a.fancybox").fancybox({
		'titlePosition'	: 'inside',
		'transitionIn'	: 'elastic',
		'transitionOut'	: 'elastic'
	});
	
	$("a.fancyvideo").fancybox({
		'type': 'swf',
		'width': 425,
		'height':344,
		'titlePosition'	: 'inside',
		'transitionIn'	: 'elastic',
		'transitionOut'	: 'elastic'
	});
	$("a.fancyvideo.wide").fancybox({
		'type': 'swf',
		'width': 570,
		'height':344,
		'titlePosition'	: 'inside',
		'transitionIn'	: 'elastic',
		'transitionOut'	: 'elastic'
	});
	
	$("#jquery_jplayer_1").jPlayer({
		ready: function () {
			$(this).jPlayer("setMedia", {
				mp3: "/_stuff/endofnine_bei_radio_duisburg.mp3"
			});
		},
		swfPath: "/_inc/jplayer",
		supplied: "mp3"
	});
	
	$('map#profile area').bind('mouseover', function() { highlightBox($(this).attr('id'), true); });
	$('map#profile area').bind('mouseout', function() {	highlightBox($(this).attr('id'), false); });
	
	$('map#profile area').bind('click', function() { moveToMemberBox($(this).attr('id')); });	
	$('.members .topLink').bind('click', function() { moveToMemberBox('top'); });
	
});

var currentlyActive; // currently active profile

function highlightBox(whichOne, doHighlight) {	
	$('#left .area:not(.' + currentlyActive + ')').addClass('inactive');
	if (doHighlight) $('#left .area.'+whichOne).removeClass('inactive');
}

function moveToMemberBox(whichOne) {
	currentlyActive = whichOne;	
	$('#left .area:not(.' + currentlyActive + ')').addClass('inactive');
	
	switch(whichOne) {		
		case 'exe' : var areaNr = 1; break;
		case 'arcon' : var areaNr = 2; break;
		case 'void' : var areaNr = 3; break;
		case 'ceno' : var areaNr = 4; break;
		default: var areaNr = 0; 
	}
	var offY = areaNr * 499;
	$('.members .inner').animate({ marginTop: -offY },1000);
}
