jQuery(document).ready(function($) {
		
	// we have JavaScript enabled...
	$('body').removeClass('nojs');
	
	var $pentry = $('.portfolio-entry');
		$plink = '',
		$pimg = '',
		$pcontent = '',
		psrc = '',
		$this = '';
		
	if ($pentry.length > 0)
	{
		$pentry.each(function() 
		{
			$this = $(this);
			$plink = $this.children('a.portfolio-link');
			$pimg = $plink.children('img');
			$pcontent = $this.children('.portfolio-content');
			psrc = $pimg.attr('src');
			
			$plink.css('background-image', 'url("' + psrc + '")');
			$pimg.remove();
		});
		
	}
	
	$pentry.find('.readmore a').click(function() {
		
		$this = $(this);
		$pcontent = $this.parents('.portfolio-content');
		$plink = $pcontent.siblings('a.portfolio-link');

		$this.blur();
	
		if ($this.text() === "< hide")
		{
			$pcontent.children('p:not(.teaser, .readmore)').each(function() { $(this). slideUp(400, 
				function() {
					$pcontent.animate({width: "187px"}, 400, "linear", 
						function () { $this.text('read more >'); } );
			}); });
		}
		else
		{
			$pcontent.animate({width: "470px"}, 400, "linear", 
				function() { 
					$pcontent.children('p:not(.teaser, .readmore)').each(function() { $(this). slideDown(400, 
						function() { $this.text('< hide'); 	} ); 
					});
				} );
		}
		
		return false;
	});
	
	/* external links */	
	$(".portfolio-entry a[href*='http://']:not([href*='"+location.hostname+"'], a.portfolio-link)").addClass('external');
	$("a.external, a[rel*=external], ul.social a, a.portfolio-link").attr("target","_blank");
	
	if ($.browser.msie && $.browser.version == 6)
	{
		$('h2.pagetitle').after('<p class="message">Seriously? You\'re viewing my portfolio in IE 6? You really should <a href="http://www.firefox.com">upgrade to a better browser</a>. It\'s insulting.</p>');
	}
	
			
});

(function($) {
    var userAgent = navigator.userAgent.toLowerCase();

    $.browser = {
        version: (userAgent.match( /.+(?:rv|it|ra|ie)[\/: ]([\d.]+)/ ) || [0,'0'])[1],
        safari: /webkit/.test( userAgent ),
        opera: /opera/.test( userAgent ),
        msie: /msie/.test( userAgent ) && !/opera/.test( userAgent ),
        mozilla: /mozilla/.test( userAgent ) && !/(compatible|webkit)/.test( userAgent )
    };
})(jQuery);








