$(document).ready(


	function () {
		
		
		$('#tcNav ul li').each(function (i) {
		
			var t = $(this);
			
			if (!t.hasClass('nontab')) {
					
					
				if ($.browser.msie != true || $.browser.version > 6.0) {
					t.append('<div class="top">&nbsp;</div>');
					t.append('<div class="bottom">&nbsp;</div>');
				}
				t.hover(onHoverOn, onHoverOff);
				
				/*
				// disabled due to shadowbox issues *sniff*
				if (t.find('a').attr('href').indexOf('ajax') > -1) {
					t.click(function () {
						if (arequest($(this).find('a').attr('href'))) {
							$(this).addClass('tcActiveLink').removeClass('temp');
							$(this).siblings().removeClass('tcActiveLink');
							return false;
						} else {
							return true;
						}
					}); 
				}
				*/
				
			}
			
		});
		
		
	}
	

);

function onHoverOn () {
	var e = $(this);
	if (!e.hasClass('tcActiveLink')) {
		e.addClass('tcActiveLink');
		e.addClass('temp');
	}
}

function onHoverOff () {
	var e = $(this);
	if (e.hasClass('tcActiveLink') && e.hasClass('temp')) {
		$(e).removeClass('tcActiveLink');
		$(e).removeClass('temp');
	}
}

function arequest (href) {
	
	var regex = /content=([^&]*)/i;
	
	var results = href.match(regex);
	
	var newURL = "/content/tc-"+results[1]+".php";
	
	$.get(newURL, null, updateContentBlock);
	
	return true;
	
}

function updateContentBlock(data) {
	$('#tcInterior').height($('#tcInterior').height()).css('overflow','hidden').fadeOut('slow', 
			function () {
				$('#tcInterior').html(data);
				$('#tcInterior').fadeIn('slow', setupShadowBox);
				$('#tcInterior').css({height:'auto',overflow:'auto'});
			}
		);
}


