jQuery(function(){
	//popup links
    $('a[rel="external"]').click( function() {
        window.open( $(this).attr('href') );
        return false;
    });
	
	//custom font
	Cufon.replace('h1, h2');
	
	//Navigations
	$('#sideNav').hover(function() {
		$(this).animate({paddingTop: "2px"}, 100);
	},function() {
		$(this).animate({paddingTop: "0px"}, 100);
	});
	
	$("#sidebar a").filter(function() {
	      var currentURL = window.location.toString().split("/");
				return $(this).attr("href") == currentURL[currentURL.length-1];
				}).addClass("active");
	
	
	var path = location.pathname.substring(1)+location.hash;
	if ( path )
		$('#topNav a[href$="' + path + '"]').parents('li').addClass('current');
	$('#topNav').nmcDropDown();
	$('#topNav').lavaLamp({
		fx: 'easeout',
		speed: 700,
		autoReturn: false
	});
	$('#topNav li ul li:last-child').addClass('noBorder');
	 
	//email spam protection
    $('.email').each(function() {
		var $email = $(this);
		var address = $email.text()
        .replace(/\s*\[at\]\s*/, '@')
        .replace(/\s*\[dot\]\s*/g, '.');
		$email.html('<a href="mailto:' + address + '">' + address + '</a>');
    });
	

});
