$(document).ready(function() { 
$('a').each(function() {if ($(this).attr('rel') == 'external') {$(this).attr('target','_blank');}});
/*portfolio zoom*/
$('ul.portfolio_list li').click(function() {/*get the screen h+v centre to animate the popup to*/var totop = ($(window).height() - 500) / 2 + $(window).scrollTop();var toleft = parseInt($('body').width() - 800) / parseInt(2+$('body').scrollLeft());/*create a container div with the same attributes as the parent li, insert the li > div contents into it and animate to fullsize*/$(this).addClass('open');var p = $(this).position();var t = $(this).parent('ul').position();var o = $(this).offset();var ct = $(this).find('div.p_content').clone(true);$('.open').animate({opacity:0.5});$('<div class="pf_popup"></div>').appendTo('body').css('opacity',0).css('position','absolute').css('left',p.left+30+'px').css('top',o.top-10+'px').html(ct).prepend('<p class="close">CLOSE</p>').animate({width:"800px",height:"500px",opacity: 0.9,top:totop+'px',left:toleft+'px'});});/*end portfolio function*/$('.pf_popup p.close').live('click',function() {var p = $('.open').position();var t = $('.open').parent('ul').position();var o = $('.open').offset();$('.open').animate({opacity:1});$(this).parents('div.pf_popup').animate({width:"150px",height:"150px",opacity: 0,top:o.top-10+'px',left:p.left+30+'px'},function() {$('.pf_popup').remove();$('.open').removeClass('open');});});});











