jQuery(function() {
	jQuery('#globalNav li a, #carNav li a').attr('title', '');
	// set opacity to nill on page load
	jQuery("#globalNav li a span, #carNav li a span, #listingInfo li a span").css("display","block");
	jQuery("#globalNav li a span, #carNav li a span, #listingInfo li a span").css("opacity","0");
	// on mouse over
	jQuery("#globalNav li, #carNav li, #listingInfo li").hover(function () {
		// animate opacity to full
		
		jQuery('span', this).stop().animate({
			opacity: 1
		}, "slow");
		jQuery(this).children('.subNav').stop().hide().delay('500').fadeTo('slow',1);
		
	},
	// on mouse out
	function () {
		// animate opacity to nill
		jQuery(this).children('.subNav').stop().css('left', 'auto').fadeOut('slow');
		jQuery('span', this).stop().animate({
			opacity: 0
		}, "slow");
		
	});
	
	jQuery("ul#globalNav li.active a span").css('opacity', 1);
	
	jQuery('.welcomeInfo h4, .welcomeInfo p').css({visiblity: 'hidden'});
	jQuery("a.external").attr('target', '_blank');
	
	if(jQuery('.welcomeInfo').length != 0) {
	
		var h = jQuery('.welcomeInfo').innerHeight();
		jQuery('#sub.overlay').css('marginTop', -h);
		jQuery('.welcomeInfo').css({height: jQuery('.welcomeInfo').height()});
	
	}
	
	if(jQuery('.watchLiveInfo').length != 0) {
	
		var h = jQuery('.watchLiveInfo').innerHeight();
		jQuery('#sub.overlay').css('marginTop', -h);
		jQuery('.watchLiveInfo').css({height: jQuery('.watchLiveInfo').height()});
	
	}
		
	jQuery('li.End').hide().parent().addClass('teambio');
	
	jQuery('.teambio:even, .B').css( 'background', '#a6a8ab');
	
	jQuery('.datatable').attr('cellpadding', '0');
	jQuery('.datatable').attr('cellspacing', '0');
	jQuery('.datatable').each(function(){
		
		jQuery(this).children('thead').children('tr:first').addClass('first');
		
	});
	
	jQuery('.driverScroller ul li:first').addClass('first');
	
	jQuery('#scRacesResult tbody tr:even').css('background', '#a6a8ab').addClass('alt');
	
	//jQuery('.broadcastTimings').hide();
	jQuery('#airTime li:first').css('borderTop', 'none');
	jQuery('#airTime li:last').css('borderBottom', 'none');
	jQuery('#airTime h4').click(function(){
		if(jQuery(this).hasClass('active') == true){
			jQuery(this).removeClass('active');
			jQuery('.broadcastTimings').slideUp();
					
		} else {
			jQuery('.broadcastTimings').slideUp();
			jQuery(this).parent().siblings().children('h4').removeClass('active');
			jQuery(this).addClass('active');
			
			jQuery(this).next('.broadcastTimings').slideDown();
			
		}
	});
	jQuery('.raceInfoTable, .raceInfoReport').hide();
	
	if (document.location.toString().indexOf("ChampionshipRace") < 0) {
		jQuery('.results #main :first-child').show();
	} else {
		jQuery('.results #main #ChampionshipRace').show();
	}
	jQuery('.resultSelect, .aboutSelect').click(function(){

		
		var report = jQuery(this).attr('href');
		
		jQuery('.raceInfoTable, .raceInfoReport, .aboutInfo').hide();
		jQuery(report).show();
		return false;
	
	});
	
	/*
jQuery('.openLiveTiming, .liveTiming').click(function(){
	
		window.open("http://static.sportresult.com/federations/fia/gt1/","FIA GT1 World Championship Live Timing", "location=no,scrollbars=yes,menubar=no,width=650,height="+screen.height+",toolbar=no,status=no");
		
		return false;
	
	});
*/
	
	jQuery('table, table tr, table td, table th').attr('bgcolor', '');
	
	jQuery('.raceInfoTable th:nth-child(2), .raceInfoTable td:nth-child(2)').hide();
	
	jQuery('#championshipStats tbody tr:even').addClass('alt');
	
});

