/* Custom audiocandy+radio JavaScript Copyright 2009 */
/* Authors: Shaun Robinson and Mike O'Brien @ obrob.com */

$(function(){
	
	
	// ### FEATURED: BOX FADE INS 
	
	
	 $("#featboxbg div.boxgrid").each(function (i) {
		//$(this).css('background', 'url(http://aestheti.ca/~acr/images/default_thumb.jpg)')
		$(this).hide().pause((i+1)*300).fadeIn('slow');
	});
	
	
	$('.boxcaption').click(function(){
	
		window.location = $('h4 a', this).attr('href');
	});
	
	
	$('.boxgrid.caption').hover(function(){
		$(".cover", this).stop().animate({top:'0px'},{queue:false,duration:1000, easing:'easeOutElastic'});
	}, function() {
		$(".cover", this).stop().animate({top:'186px'},{queue:false,duration:160});
	});
	 
	
	
	
	
	// ### RADIO PLAYER ONLINE INDICATOR
	
	
	$('#radio_player').pause(800).fadeIn('slow').slideDown('slow');
	
	$('#radio_player').click(function(){ 
		if ($('#streaming').length) {
			window.location = 'http://www.audiocandyradio.com/listen.pls'; 
		
		} else {
			window.location = '/schedule/';	
		}
	});
	







	
	// ### SCHEDULER
	
	themeRoot = 'http://aestheti.ca/~acr/wp-content/themes/massivenews/'
	if ($('.sch').length) {
		
		$('.day').hover(function(){
			$(this).css('background', 'url(' + themeRoot + 'images/pink_20.png)')
		},
		function(){
			$(this).css('background', 'url(' + themeRoot + 'images/black_50.png)')
		});
		
		$('.show').hover(function(){
			//alert( $(this).css('backgroundColor') );
			$(this).animate({color:'black'},100);
			$('a', this).animate({color:'black'},50);
			$(this).animate({backgroundColor: 'yellow'}, 50);
			$(this).click(function(){
				window.location = ($('a', this).attr('href'));
			});
		},
		function(){
			$(this).animate({color:'white'},100);
			$('a', this).animate({color:'yellow'},50);
			$(this).animate({backgroundColor: '#ff3196'}, 50);
			
		});
	}
	

	/* post category switcher thingamajiggy */
	
	
	
	$('.showpost-first').css('background-color', '#fff');
	
	$('.showpost').click(function(){
		$('.showpost').css('background-color', 'transparent');
		$(this).css('background-color', '#fff');
		var theId = $(this).attr('id');
		theId = theId.replace('showpost_', '');
		//alert(theId);
		
		$('.post').fadeOut();
		$('#post_' + theId).fadeIn();
		
		//$('.post').slideUp();
		//$('#post_' + theId).slideDown();
		
		return false;
		
	});
	$('#cf3_field_14, #cf3_field_15').val('1.\n\n2.\n\n3.\n\n');
	
	
});

//