(function ($,W,D){var exitPositions={top:function (el){return {top:0-el["height"](),left:el["offset"]()["left"]};} ,topLeft:function (el){return {top:0-el["height"](),left:0-(el["width"]()/2)};} ,topRight:function (el){return {top:0-el["height"](),left:$(W)["width"]()+(el["width"]()/2)};} ,left:function (el){return {top:el["offset"]()["top"],left:0-el["width"]()};} ,right:function (el){return {top:el["offset"]()["top"],left:$(W)["width"]()+el["width"]()};} ,btmLeft:function (el){return {top:getWindowHeight()+el["height"](),left:0-(el["width"]()/2)};} ,btmRight:function (el){return {top:getWindowHeight()+el["height"](),left:getWindowHeight()+(el["width"]()/2)};} ,btm:function (el){return {top:getWindowHeight(),left:el["offset"]()["left"]};} };function getWindowHeight(){return W["innerHeight"]||$(window)["height"]();} ;function randDirection(){var directions=[],count=0;for(var i in exitPositions){directions["push"](i);count++;} ;return directions[parseInt(Math["random"]()*count,10)];} ;function prepareOverflow(){var oX=$(D)["width"]()<=$(W)["width"](),oY=$(D)["height"]()<=$(W)["height"](),oR=oX&&oY;oX&&$("body")["css"]("overflow-x","hidden");oY&&$("body")["css"]("overflow-y","hidden");oR&&$("body")["css"]("overflow","hidden");} ;function flyElement(s){var el=$(this),direction=s["direction"]["toLowerCase"]()==="random"?randDirection():s["direction"],tweens=$["extend"](s["tween"],exitPositions[direction](el)),positionProps="position,left,top,bottom,right,width,height,paddingTop,paddingRight,paddingBottom,paddingLeft,marginTop,marginRight,marginBottom,marginLeft,zIndex,overflow,clip,display",clone=$(el["clone"]())["removeAttr"]("id")["attr"]("id","replaced-element-"+(+ new Date()))["css"]((function (){var props=positionProps["split"](","),length=props["length"],d;styles={};while(length--){styles[props[length]]=el["css"](props[length]);} ;return styles;} )());prepareOverflow();$(el)["css"]({left:tweens["left"]?el["offset"]()["left"]:null,top:tweens["top"]?el["offset"]()["top"]:null,position:"absolute",zIndex:999,width:el["outerWidth"](),height:el["outerHeight"]()})["animate"](tweens,s["duration"],function (){el["remove"]();} )["filter"](function (){return !!s["retainSpace"];} )["before"]($(clone)["css"]("opacity",0));if(s["retainSpace"]&& typeof s["retainSpace"]==="object"){$(clone)["animate"](s["retainSpace"],s["duration"],function (){$(this)["remove"]();} );} ;} ;$["fn"]["flyOffPage"]=function (userDefinedSettings){var s=$["extend"]({direction:"random",tween:{},retainSpace:true,duration:500},userDefinedSettings);return this["each"](function (){flyElement["call"](this,s);} );} ;} )(jQuery,window,document);