$(document).ready(function(){

	// Google Analytics
	var pageTracker = _gat._getTracker("UA-5468672-1");
	pageTracker._trackPageview();

	// faders
	$("#body .column").fadeTo(450, 1);
	
	// toggler
	$("#toggler img").click(function(){
		var $this = $(this);
		if( $this.is('.collapse') ) {
	    	$this.removeClass('collapse');
	    	$this.addClass('expand');
			$("#top").slideUp("slow");
			$this.attr("src","/images/expand.png");
			$.cookie('toggler', 'expand', { path: '/'});
    	}
   		else {
			$this.removeClass('expand');
			$this.addClass('collapse');
			$("#top").slideDown("slow");
			$this.attr("src","/images/collapse.png");
			$.cookie('toggler', 'collapse', { path: '/'});
		}
   		return false;
   	});

	// toggler cookie
	var toggler = $.cookie('toggler');
   	if (toggler == 'expand') {
		$("#toggler img").removeClass('collapse');
		$("#toggler img").addClass('expand');
		$("img.expand").attr("src", "/images/expand.png");
        $('#top').hide();
    };

	// newsletter signup
	$(".mailbuild input.email").click(function(){
		$(this).attr("value", "");
	});

	// thomas' nobreak
  	var nobreak = '';
	$('.nobreak').each(function() {
		nobreak = $(this).text().replace(/ (\w+)$/,'&nbsp;$1');
		$(this).html(nobreak);
 	});
	
});