$(document).ready( function(){	

	// Toggler
	$(".toggle").next().hide();
	$(".toggle").click(function(){
		if( $(this).next().is(":hidden") ) {
			$(this).next().slideDown('fast');
		} else {
			$(this).next().slideUp('fast');
		}
	});
	
	// Smooth Scroller
	$('a[href*=#]').click(function() {
		if( location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'') && location.hostname == this.hostname )
		{
			var $target = $(this.hash);
			$target = $target.length && $target || $('[name=' + this.hash.slice(1) +']');

			if ($target.length) 
			{
				var targetOffset = $target.offset().top;
				$('html,body').animate({scrollTop: targetOffset}, 1000);
		  		return false;
			}
		}
	});
	
	// Email Spam Gaurd
	$('a.nospam').click(function(){
		var href = $(this).attr('href');
		var h_array = href.split('+');

		var new_href;
		new_href = h_array[0] + rot13(h_array[1]) + h_array[2];
		$(this).attr('href', new_href);
	});
	
});

function rot( t, u, v ) {  return String.fromCharCode( ( ( t - u + v ) % ( v * 2 ) ) + u ); }  function rot13( s ) {  var b = [], c, i = s.length,   a = 'a'.charCodeAt(), z = a + 26,   A = 'A'.charCodeAt(), Z = A + 26;  while(i--) {   c = s.charCodeAt( i );   if( c>=a && c<z ) { b[i] = rot( c, a, 13 ); }   else if( c>=A && c<Z ) { b[i] = rot( c, A, 13 ); }   else { b[i] = s.charAt( i ); }  }  return b.join( '' ); }  function rot5( s ) {  var b = [], c, i = s.length,   a = '0'.charCodeAt(), z = a + 10;  while(i--) {   c = s.charCodeAt( i );   if( c>=a && c<z ) { b[i] = rot( c, a, 5 ); }   else { b[i] = s.charAt( i ); }  }  return b.join( '' ); }  function rot135( s ) {  return rot13( rot5( s ) ); }