jQuery(function(a){var b,c;return window.UIGuider=b=function(){function b(b){this.block=a(b),this.target=a(a(this.block).attr("data-target-element")),this.top_arrow=this.block.children(".arrow.top"),this.bottom_arrow=this.block.children(".arrow.bottom"),this.state="hidden",this.place_arrow=function(a){return a.y==="bottom"?(this.top_arrow.hide(),this.bottom_arrow.show().addClass(a.x)):this.top_arrow.addClass(a.x)},this.place_guider=function(a){var b,c;return a.y==="top"?c=this.target.offset().top+this.target.height()+this.block.children(".arrow").height():c=this.target.offset().top-this.block.height()-this.block.children(".arrow").height(),a.x==="left"?b=this.target.offset().left+this.target.width()/2-this.block.children(".arrow").width():b=this.target.offset().left-this.block.width()-this.block.children(".arrow").width()+this.target.width()/2,this.block.css({top:c}),this.block.css({left:b})},this.set_cookie=function(){if(this.block.hasClass("show_once")&&this.block.attr("id"))return a.cookie("UIGuider_"+this.block.attr("id"),"1",{expires:3560})},this.target_location=function(){var b,c;return this.target_location_cached?this.target_location_cached:(a(document).width()/2-this.target.offset().left<0?b="right":b="left",a(document).height()/2-this.target.offset().top<0?c="bottom":c="top",this.target_location_cached={x:b,y:c})}}return b.prototype.show=function(){var b,d,e;for(d=0,e=c.length;d<e;d++)b=c[d],b.hide();if(a.cookie("UIGuider_"+this.block.attr("id")))return;return this.place_arrow(this.target_location()),this.place_guider(this.target_location()),this.set_cookie(),this.block.fadeIn(500),this.state="visible"},b.prototype.hide=function(){return this.block.hide(),this.state="hidden"},b}(),c=[],a(".uiGuider").each(function(){var d;d=new b(a(this)),c.push(d),d.block.hasClass("autoshow")&&setTimeout(function(){return d.show()},1e3),d.block.hasClass("autohide")&&d.target.bind("mouseout",function(){return d.hide()});if(d.block.attr("data-event-name").length>0)return d.target.bind(d.block.attr("data-event-name"),function(){if(d.state!=="visible")return d.show()}),d.block.find(".close").click(function(){return d.hide()})})})
