(function($)
{
  var a = navigator.userAgent.toLowerCase();
	$.extend($.browser, { chrome: /chrome/.test(a), safari: /webkit/.test(a) && !/chrome/.test(a) });
	
	function initLightbox()
	{
		var l = $("a[rel*='lightbox']"), i = 0, r = {}, b = 'http://blog.acodingfool.com/wp-content/themes/default/', o = { imageBlank: b + 'images/light-blank.gif', imageLoading: b + 'images/light-loading.gif', imageBtnPrev: b + 'images/light-prev.gif', imageBtnNext: b + 'images/light-next.gif', imageBtnClose: b + 'images/light-close.gif' };

		l.each(function() { $.each($(this).attr('rel').split(','), function(i, v) { v = $.trim(v); if (v != 'lightbox') r[v] = '' }) });
		$.each(r, function(k, v) { $("a[rel*='" + k + "']").lightBox(o); i++ });
		if (i == 0)
		{
		  l.lightBox(o);
		  $('#preview').click(function() { l.eq(0).click() })
		}
	};
	
	function initTracking()
	{
		var re = /(?:(?!\.)pdf|xls|doc|js)$/i;
		$('.download')
		  .filter(function() { if (this.host == document.location.host) return re.exec(this.href) != null; return false })
			.click(function() { if (typeof pageTracker != 'undefined') pageTracker._trackEvent('download', 'click', this.href); return true });
	}
	
	$(function()
	{
		$('.menu-item').mouseover(function() { $(this).addClass('hover') }).mouseout(function() { $(this).removeClass('hover') });
		$('.widget li a').mouseover(function() { $(this).parent().addClass('hover') }).mouseout(function() { $(this).parent().removeClass('hover') });
	  $('.widget li:last-child').addClass('last');
		$('#font-more').click(function() { var e = $('.entry'), s = parseFloat(e.css('font-size')) * 1.1; e.css('font-size', Math.min(s, 20)); e = $('.comment-body'); s = parseFloat(e.css('font-size')) * 1.1; e.css('font-size', Math.min(s, 20)) });		
		$('#font-less').click(function() { var e = $('.entry'), s = parseFloat(e.css('font-size')) * 0.9; e.css('font-size', Math.max(s, 10)); e = $('.comment-body'); s = parseFloat(e.css('font-size')) * 0.9; e.css('font-size', Math.max(s, 10)) });
		$('.comment-body:last').css('margin', 0);
		$('#commentform').submit(function() { var t = $(this), r = true; t.find('#author,#email,#comment').each(function() { var t = $(this), v = t.val().length == 0; t.css({ border: v ? '2px solid #060': '1px solid #888', background: v ? '#dfd': '#fff' }).attr('title', v ? 'This field is required': ''); r = r && !v; }); return r; });
    $('#bookmark').click(function() { var b = $.browser, t = 'A Coding Fool'; if (b.mozilla && window.sidebar) window.sidebar.addPanel(t, this.href, ''); else if (b.msie) window.external.AddFavorite(this.href, t); else if (b.opera && window.print) { this.setAttribute('title', t); this.setAttribute('rel', 'sidebar'); return true; } else if (b.safari || b.chrome) alert('Press "Control-D" to add a bookmark'); return false; });
		
		initTracking();
		initLightbox();
	});
	
})
(jQuery);

var addthis_options = 'favorites, email, reddit, digg, delicious, technorati, more';
var addthis_exclude = 'print';

var addthis_localize = { share_caption: 'Share' }; 
