$(document).ready(function() {	
	

		$('a[rel$="external"]').live('click', function(){
				this.target = "_blank";
		});

	
	
	$("div.logo-container").hover(function() { 
			var thumbOver = $(this).find("img").attr("src");
			$(this).find("a.logo-fade").css({'background' : 'url(' + thumbOver + ') no-repeat center bottom'});
			$(this).find("span").stop().fadeTo('normal', 0 , function() { $(this).hide(); });		
	} , function() { 
			$(this).find("span").stop().fadeTo('normal', 1).show();
	});
	
	$("ul#topnav > li > a:not(.active)")	
	.mouseover(function(){
				$(this).animate({ 'background-position':'0 0', 'color':'#00b4ff' }, { queue:false, duration:400 }); 			
	})
	.mouseout(function(){
				$(this).animate({ 'background-position':'0 -34px', 'color':'#cccccc' }, { queue:false, duration:500 });
	});


	$("ul#menu > li").hover(function(){

			$(this).children('a:not(.active)').stop().animate({ 'background-position':'0 -50px', 'color':'#00b4ff' }, { duration:300 });
			$(this).find('ul.snav').stop().animate({ height:'show' }, {queue: false, complete: function(){ $(this).css({ height: 'auto'}); }});
				
	}, function(){
	
			$(this).children('a:not(.active)').stop().animate({ 'background-position':'0 0', 'color':'#cccccc' }, { duration:500 });
			$(this).find('ul.snav').stop().animate({ height:'hide' }, {queue: false, complete: function(){ $(this).css({ height: 'auto'}); }}); 
	
	});


	$('div.radio')
	.mouseover(function(){
				$(this).css({ 'background-position':'0 -350px', 'color':'#000000' });
	})
	.mouseout(function(){
				$(this).css({ 'background-position':'0 0', 'color':'#444444' });
	});
	
	
	$('.maplink').click(function(){

		var linkid = $(this).attr('id');
		var newIndex = $('div#coveragemap img#img_'+linkid).index();
		var oldIndex = $('div#coveragemap img:visible').index();
		$('.maplink').removeClass('active');
		$(this).addClass('active');
		if(newIndex > oldIndex){
			$('img#img_'+linkid).fadeIn('normal', function(){   $('div#coveragemaps img:not(#img_'+linkid+')').hide();  });
		}else{
			$('div#coveragemaps img:not(#img_'+linkid+')').fadeOut('normal', function(){   $('img#img_'+linkid).fadeIn();  });
		}
		return false;

	});

	
});