function showBio(nr) {
	$(".bio-box").hide();
	$("#bio-" + (nr)).show();
}

function showReviews(lang) {
	lang = lang.toLowerCase();
	if (lang.length < 1) {
		$(".review-item").show();
		return;
	}
	$(".review-item").hide();
	$(".review-item").each(function (i) {
		if (this.className.toLowerCase().indexOf("lang-" + lang) > -1)
			$(this).show();
	});
	//$(".lang-" + (lang)).show();
}

function setupReviews() {
	$(".reviews h3").bind("click", toggleReview);
	//$(".reviews .maintext").bind("click", hideReview);
}

function setupCds() {
	$(".cd-cover").bind("click", showCd);
}

function showCd() {
	$(this).siblings(".cd-info").toggle();
}

function toggleReview() {
	$(this).siblings(".maintext").toggle();
	$(this).siblings(".ingress").toggle();
	//$(this).hide();
}

function hideReview() {
	$(this).siblings(".ingress").show();
	$(this).hide();
}

function createMp3Players() {
	var count = 0;
	$("a[href*='.mp3']").each(function (i) {
		this.id = "soundButton" + count;
		addSoundButton(this.href, "/includes/swf/SoundButton.swf", this.id, "55", "12");
		count++;
	});
}

function removeOldQuote(event) {
	$("#quote" + (curQuote-1)).remove();
}

var curQuote = 0;
var curQuoteIndex = 0;
function showQuote() {
	//return;
	// Remove last quote
	var oldQuote = $("#quote" + curQuote);
	if (oldQuote.length > 0) {
		var t = new Tween(oldQuote.get(0).style, 'marginTop', Tween.regularEaseInOut, 0, 35, 1.5, 'px');
		t.onMotionFinished = removeOldQuote;
		t.start();
		curQuote++;
	}
	
	//Add new quote
	var html = "<div id='quote" + curQuote + "'><em>" + arQuotes[curQuoteIndex].quote + "</em> - " + arQuotes[curQuoteIndex].source + "</div>";
	$(".quote").prepend(html);
	var newQuote = $("#quote" + curQuote);
	//elm.css("margin-top", -elm.height());
	var t = new Tween(newQuote.get(0).style, 'marginTop', Tween.regularEaseInOut, -(newQuote.height() + 10), 0, 1.5, 'px');
	t.start();
	if (curQuoteIndex + 1 < arQuotes.length)
		curQuoteIndex++;
	else
		curQuoteIndex = 0;
	setTimeout("showQuote()", 10000);
}









if (location.search.indexOf("reviews") == 1) {
	var sStyle = "<style type=\"text/css\">";
	sStyle += ".review-item .ingress { display:block; }";
	sStyle += ".review-item .maintext { display:none; }";
	sStyle += "</style>";
	document.write(sStyle);
	
	$(document).bind("ready", setupReviews);
}

if (location.search.indexOf("cds") == 1) {
	/*var sStyle = "<style type=\"text/css\">";
	sStyle += ".review-item .ingress { display:block; }";
	sStyle += ".review-item .maintext { display:none; }";
	sStyle += "</style>";
	document.write(sStyle);*/
	
	$(document).bind("ready", setupCds);
}

$(document).bind("ready", createMp3Players);
$(document).bind("ready", showQuote);