$(document).ready(function() {
	$('#sendToFriend').click(function() {
		if ($('#friendContent').css('display')=='none') {
			$('#friendContent').css('display', '');
		} else {
			$('#friendContent').css('display', 'none');
		}
	});
	
	$('#friendSubmit').click(function() {
		var url = $('#url').val();
		var artist = $('#artist').val();
		var song = $('#song').val();
		var fromEmail = $('#from').val();
		var toEmail = $('#to').val();
		
		$.ajax({
			type: "POST",
			url: "?act=ajax&catid=sendToFriend",
			data: "from="+fromEmail+"&to="+toEmail+"&url="+url+"&artist="+artist+"&song="+song,
			success: function(msg) {
				if (msg=="1") {
					msgText = "Please, enter your name.";
				} else if (msg=="2") {
					msgText = "Please, enter your friend's e-mail address.";
				} else if (msg=="3") {
					msgText = "Incorrect e-mail address.";
				} else {
					msgText = "Thank you, the lyric has been sent to your friend.";
					$('#friendContent').css('display', 'none');
					$('#from').val("");
					$('#to').val("");
				}
				
				alert(msgText);
			}
		});
	});
	
	
	$('#smallerFont').click(function() {
		var currentFontSize = parseInt($('#lyric').css('font-size'));

		if (currentFontSize>12) {
			$('#lyric').css('font-size', currentFontSize-1);
		}
	});
	
	$('#largerFont').click(function() {
		var currentFontSize = parseInt($('#lyric').css('font-size'));

		if (currentFontSize<20) {
			$('#lyric').css('font-size', currentFontSize+1);
		}
	});
	
	
	
	
	
	$('#buyAmazon').ready(function() {
		$("#buyAmazonContent").load("http://www.lyricspresent.com/?act=ajax&catid=amazon");
	});
	
	
	$("#buyAmazon").ajaxStop(function() {
		$('#loading').css('display', 'none');
	});
});
