$('#overview-rail').each(function(){
	var $links = $('a', this),
		panelIds = $links.map(function() { return this.hash; }).get().join(","),
		$panels = $(panelIds),
		$panelWrapper = $panels.filter(':first').parent(),
		delay = 1000;

	$panels.hide();
	
	$links.click(function() {
		var $link = $(this),
		link = $(this);
		
		if ($link.is('.active')) {
			return false;
		}

		if ($link.is('.link')) {
			return;
		}
		      
		$links.parent().removeClass('active');
		$link.parent().addClass('active');
				
		$panels.hide().filter(this.hash).show();
		
		return false;
	});
	
	$links.filter(':first').click();
});

$(document).ready(function() {
	slidePrograms = function(){
		$('#lower> div.program-col > div.descrip').hide();
		$('#lower> div.program-col > div.descrip:first').show();
				
		$('#lower> div.program-col .thumb').hover(function() {
			$clicked = $(this);
			
			if ($clicked.css("display") != "inline" && $clicked.is(":not(animated)")){
				$('#lower> div.program-col > div.descrip').hide();
				$clicked.next('div').show();
				
				//console.log($(this));
			};
			
		});
		
		return false;
	}
	
	$(function(){ //WHEN DOCUMENT HAD LOADED
		slidePrograms(); //RUN CODE FOR PROGRAM SLIDER
	});

});
