$(document).ready(function() {

	$('#slider').show();
	$('#slide_content').anythingSlider({
		width			: 800,
		height			: 400,
		buildArrows		: true,
		buildNavigation	: false,
		delay			: 4000,
		resumeDelay		: 2000
	});
	
	$('.article').mouseenter(function() {
		$(this).children('.infotext').hide();
		$(this).children('.infotext').fadeIn(300);
	});
	
	$('.article').mouseleave(function() {
		$(this).children('.infotext').show();
		$(this).children('.infotext').fadeOut(300);
	});
	
	$('#phone_content').hide();
	$('a.phone').click(function() {
		_gaq.push(['_trackEvent', 'Social Links', 'click', 'phone']);
		return false;
	});
	$('a.mail').click(function() {
		_gaq.push(['_trackEvent', 'Social Links', 'click', 'mail']);
		//return false;
	});
	$('a.skype').click(function() {
		_gaq.push(['_trackEvent', 'Social Links', 'click', 'skype']);
		//return false;
	});
	
	$('a.phone').CreateBubblePopup({
		innerHtml		: '+49 (0) 179 / 74 54 986',
		themePath		: 'assets/madewithcode/img/jquerybubblepopup-theme/',
		themeName		: 'all-black',
		innerHtmlStyle	: {'font-size': '42px', 'padding': '10px;'}
	});
	$('a.mail').CreateBubblePopup({
		innerHtml		: 'info@madewithco.de',
		themePath		: 'assets/madewithcode/img/jquerybubblepopup-theme/',
		themeName		: 'all-black',
		innerHtmlStyle	: {'font-size': '42px', 'padding': '10px;'}
	});
	$('a.skype').CreateBubblePopup({
		innerHtml		: 'ringo.rohe',
		themePath		: 'assets/madewithcode/img/jquerybubblepopup-theme/',
		themeName		: 'all-black',
		innerHtmlStyle	: {'font-size': '42px', 'padding': '10px;'}
	});

	$('#slider .extern').click(function() {
		var win = window.open($(this).attr('href'));
		var name = $(this).parent().children('h2').html();
		if(name == null) {
			name = $(this).parent().parent().children('h2').html();
		}
		if(name == null) {
			name = $(this).html();
		}
		//console.log(name);
		_gaq.push(['_trackEvent', 'Portfolio Links', 'click', name]);
		return false;
	});

	$('#footer .extern').click(function() {
		var win = window.open($(this).attr('href'));
		var name = $(this).html();
		_gaq.push(['_trackEvent', 'Social Links', 'click', name]);
		return false;
	});


	$('#nowPlayingBox').nowplaying({
		apikey:			'b25b959554ed76058ac220b7b2e0a026',
		username:		'TheRockstarr',
		refresh:		30,
		icon:			'http://cdn.last.fm/flatness/global/icon_eq.gif',
		notplayingtext:	''
	});

	$('#nowPlayingBox').click(function() {
		var win = window.open('http://www.last.fm/user/TheRockstarr/');
		var name = 'last.fm';
		_gaq.push(['_trackEvent', 'Social Links', 'click', name]);
		return false;
	});

});
