// "About" Javascript
// author: Rafael Lüder
// e-mail: rafael.lueder@gmail.com
// website: http://rafael-lueder.com/about.html

$(document).ready(function(){

	// jQuery Toggle
	$('#toggle').click(function(){
		if ($('#grid').is(':hidden')) {
			$('#grid').fadeIn('fast').css({'z-index' : '1000', 'position' : 'fixed' });
		}
		return false;
	});

//	$('#grid').click(function(event) {
//		var x = event.pageX - this.offsetLeft;
//		var y = event.pageY - this.offsetTop;
//	integers below should be pulling from #toggle's offsetLeft (360), offsetWidth (209), offsetTop (186), top-margin (80), offsetHeight (24)
//		if (x >= 360 && x <= 569 && y >= 266 && y <= 290) {
//			$('#grid').fadeOut('fast');
//		}
//		return false;
//	});

	$('#grid').bind({
		click: function(event) {
			var x = event.pageX - this.offsetLeft;
			var y = event.pageY - this.offsetTop;
			if (x >= 360 && x <= 569 && y >= 266 && y <= 290) {
				$('#grid').fadeOut('fast');
			}
			return false;
		},
//		mouseover: function(event) {
//			var x = event.pageX - this.offsetLeft;
//			var y = event.pageY - this.offsetTop;
//			if (x >= 360 && x <= 569 && y >= 266 && y <= 290) {
//				$('#toggle').addClass('toggleGrid');
//			} else {
//				$('#toggle').removeClass('toggleGrid');
//			}
//		}
	});

	// jQuery noSpam
	$('a.email').nospam({
		replaceText: true,
		filterLevel: 'low'
	});
	//	jQuery Tweet!
	$('.twitter').tweet();
	//	jQuery nowPlaying
	$('.lastfm ul').nowPlaying();
	
});

// Typekit
// http://typekit.com/
//WebFont.load({
//	typekit: {id:'jwy4tsf'}
//});

// Hyphenator
// http://code.google.com/p/hyphenator/
Hyphenator.run();

// Harmony Canvas Background
// http://paulirish.com/2010/my-harmonious-background-canvas/
harmony();

// Google Analytics
// http://code.google.com/intl/en/apis/analytics/docs/tracking/asyncTracking.html
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-413761-1']);
_gaq.push(['_trackPageview']);
(function() {
	var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
	ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
	var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
