$(document).ready(function(){
	
	$('.msgok').each(coolReveal);
	$('.msgerror').each(coolReveal);
	
	$('A[rel="external"]').click( function() {
		window.open( $(this).attr('href') );
		return false;
	});
});

function coolReveal()
{
	$(this).hide();
	$(this).slideDown('slow'); 
}











var iLyricsSlideSpeed = 500;
var bLyricsLocked = false;

function handleLyricsClick(oThis, oEvent)
{
	oEvent.preventDefault();
	
	if (!bLyricsLocked)
	{
		bLyricsLocked = true;
		
		hideAllLyrics();
		
		oSongLink = $(oThis);
		oSongLinkAlbum = oSongLink.parent().parent().parent();
		
		iSongLinkNumber = oSongLinkAlbum.find('li a').index(oSongLink);
		iSongLinkAlbumNumber = oSongLinkAlbum.index();
		
		oAlbum = $('.lyricscontent .album:eq(' + iSongLinkAlbumNumber + ')');
		oSong = oAlbum.find('.song:eq(' + iSongLinkNumber + ')');
		oSong.slideDown(iLyricsSlideSpeed, function() {
			bLyricsLocked = false;
		});
	}
}

function hideAllLyrics()
{
	$('.lyricscontent .song').slideUp(iLyricsSlideSpeed);
}

function initializeLyrics()
{
	$('.lyricscontent .song').slideUp(iLyricsSlideSpeed);
	$('.lyricsnav .album a').click(function(event) {
		handleLyricsClick(this, event);
	});	
}

