/* jQuery FlyOut */
;(function($){$.fn.flyout=function(b){var c=false;var d=false;var e;var f;var g;var h;var i;var j=new Image();var k='img';var l;this.click(function(){if(d==true){return false}if(c){putAway(this)}else{flyOut(this)}return false});var o=jQuery.extend({outSpeed:1000,inSpeed:500,outEase:'swing',inEase:'swing',loadingSrc:null,loader:'loader',loaderZIndex:500,widthMargin:40,heightMargin:40},b);function flyOut(a){d=true;e=$(a);f=$('img',a);j=new Image();sL=$(window).scrollLeft();sT=$(window).scrollTop();g=f.offset();h=f.height();i=f.width();$('<div></div>').attr('id',o.loader).appendTo('body').css({'position':'absolute','top':g.top,'left':g.left,'height':h,'width':i,'opacity':.5,'display':'block','z-index':o.loaderZIndex});if(o.loadingSrc){$('#'+o.loader).append($('<img/>').load(function(){$(this).css({'position':'relative','top':h/2-(this.height/2),'left':i/2-(this.width/2)}).attr('alt','Loading...Please wait')}).attr('src',o.loadingSrc))}else{$('#'+o.loader).css('background-color','#000').append($('<span></span>').text('loading').css({'position':'relative','top':'2px','left':'2px','color':'#FFF','font-size':'9px'}))}$(j).load(function(){imgtag=$('<img/>').attr('src',e.attr('href')).attr('title',e.attr('title')+" - Click again to put away.").height(h).width(i);max_x=$(window).width()-o.widthMargin;max_y=$(window).height()-o.heightMargin;width=j.width;height=j.height;x_dim=max_x/width;y_dim=max_y/height;if(x_dim<=y_dim){y_dim=x_dim}else{x_dim=y_dim}dw=Math.round(width*x_dim);dh=Math.round(height*y_dim);if(dw>width){dw=width}if(dh>height){dh=height}dl=Math.round(($(window).width()/2)-(dw/2)+sL);dt=Math.round(($(window).height()/2)-(dh/2)+sT);$('#'+o.loader).empty().css('opacity',1).append(imgtag).width('auto').height('auto').animate({top:dt,left:dl},{duration:o.outSpeed,queue:false,easing:o.outEase});$('#'+o.loader+' '+k).animate({height:dh,width:dw},o.outSpeed,o.outEase,function(){c=true;d=false;$('#'+o.loader+' '+k).click(function(){putAway(null)})})});j.src=e.attr('href')}function putAway(a){if(d==true||c==false){return false}d=true;$('#'+o.loader).animate({top:g.top,left:g.left},{duration:o.inSpeed,queue:false,easing:o.inEase});$('#'+o.loader+' '+k).animate({height:h,width:i},o.inSpeed,o.inEase,function(){$('#'+o.loader).css('display','none').remove();c=false;d=false;j=null;if(a){flyOut(a)}})}return this}})(jQuery);

$().ready(function()
{
    $("div.flyout a").flyout();
});