$(function() {
	
	// linkscrubber 
	$("a").bind("focus",function(){if(this.blur)this.blur();});
	$("input[type='image']").bind("focus",function(){if(this.blur)this.blur();});
	
	// topnav dropdown
	$('.tnav a').hover(function(){
	    $nav = $(this).attr('class');
	    $('#'+$nav).show();
	}, function(){
	    $('#'+$nav).hide();
	});
	$('.dropdown').hover(function(){
	    $(this).show();
	    $nav = $(this).attr('id');
	}, function(){
	    $(this).hide();
	});
	$('.dropdown').hide();

	// prevent top nav links clickable
	$('.tnav a').click(function(event){
	    event.preventDefault();
	});

	// Cufon
	Cufon.set('fontFamily', 'Nobel-Light').replace('#sidebar h1')('#content_right_in h2')('#content_right_in h3')('#content_right_in h4')('#request h2')('#promo_splash_right h1')('#promo_splash_right h2')('#subscribe h1');
	Cufon.set('fontFamily', 'Nobel-Regular').replace('#sidebar h1 span');

	// smooth back to top
	$("a.btop").click(function(event) {
		event.preventDefault();
		$("html, body").animate({
			scrollTop: $($(this).attr("href")).offset().top + "px"
		}, {
			duration: 500,
			easing: "swing"
		});
		return false;
	});
	
   // Fancybox
	$("a.iframe").fancybox();

	// sidenav accordion
	//$('div#sidebar ul ul').hide();
	//$('div#sidebar ul .expand#active > a').next().show();
	//$('div#sidebar ul .expand#active > a').addClass('opened');
	//$('div#sidebar ul .expand > a').click(function() {
	//    $('div#sidebar ul .expand > a').removeClass('opened');
	//    $(this).addClass('opened');
	//    var checkElement = $(this).next();
	//    if((checkElement.is('ul')) && (checkElement.is(':visible'))) {
	//	return false;
	//    }
	//    if((checkElement.is('ul')) && (!checkElement.is(':visible'))) {
	//	$('div#sidebar ul .expand ul:visible').slideUp('fast');
	//	checkElement.slideDown('fast');
	//	return false;
	//    }
	//});
	
});
