$(document).ready(function() {
	$('#main').jScrollPane();
	$(".day").click(function() {
		$(".day").css({'color':'#F37101','background-color':'#990000'});
		$(this).css({'color':'#990000','background-color':'#F37101'});
		$.ajax({
			type: "GET",
			url: "includes/ajax.php",
			data: "page=flyer&id="+$(this).attr('id'),
			success: function(content){
				$("#flyer-day").html( content );
				$(document).title='Groove On Schedule';
		   }
		});
		$.ajax({
			type: "GET",
			url: "includes/ajax.php",
			data: "page=day&id="+$(this).attr('id'),
			success: function(content){
				$("#content-day").html( content );
		   }
		});
		return false;
	});

	$(".flyer").click(function() {
		$.ajax({
			type: "GET",
			url: "includes/ajax.php",
			data: "page=flyer&id="+$(this).attr('id'),
			success: function(content){
				$("#main").html( content );
				$('#main').jScrollPane();
		   }
		});
	});

	$(".button").click(function() {
		$(".button").css( {'color':'#F37101'});
		$(this).css({'color':'#ff0000'});
		var id = $(this).attr('id');
		$.ajax({
			type: "GET",
			url: "includes/ajax.php",
			data: "page="+$(this).attr('id'),
			success: function(content){
				$("#main").html( content );
				$('#main').jScrollPane();
				if (id=='preachers')
					{
						$('#main').height(1400);
					}
				$(".this_is_me_link").click(function() {
					$("#this_is_me_div").fadeIn();
					$('#main').jScrollPane();
					$(document).title='Groove On - This Is Me';
					return false;
				});
				$(".news_cat").click(function() {
					$(".news_cat").css({'color':'#ff0000'});
					$(this).css({'color':'#F37101'});
					var id = $(this).attr('id');
					$.ajax({
						type: "GET",
						url: "includes/ajax.php",
						data: "page=news&category="+id,
						success: function(content){
							if (content!="")
								{
									$("#news_box_container").html( content );
									$("#news_box_container").style.height="auto";
									$('#news_box_container').jScrollPane();
								}
							else
								{
									$("#news_box_container").html( "Eroare" );
									$("#news_box_container").style.height="auto";
									$('#news_box_container').jScrollPane();
								}
					   }
					});
					return false;
				});
				$(".day").click(function() {
					$(".day").css({'color':'#F37101','background-color':'#990000'});
					$(this).css({'color':'#990000','background-color':'#F37101'});
					$.ajax({
						type: "GET",
						url: "includes/ajax.php",
						data: "page=flyer&id="+$(this).attr('id'),
						success: function(content){
							$("#flyer-day").html( content );
					   }
					});
					$.ajax({
						type: "GET",
						url: "includes/ajax.php",
						data: "page=day&id="+$(this).attr('id'),
						success: function(content){
							$("#content-day").html( content );
					   }
					});
					return false;
				});
				$(".flyer").click(function() {
					$.ajax({
						type: "GET",
						url: "includes/ajax.php",
						data: "page=flyer&id="+$(this).attr('id'),
						success: function(content){
							$("#main").html( content );
					   }
					});
					return false;
				});
		   }
		});
		document.title=$(this).attr('title');
		return false;
	});
});
