(function(n){function t(n,t,i){if(t=="show")switch(i){case"fade":n.fadeIn();break;case"slide":n.slideDown();break;default:n.fadeIn()}else switch(i){case"fade":n.fadeOut();break;case"slide":n.slideUp();break;default:n.fadeOut()}}n.goup=function(i){var r=n.extend({location:"right",locationOffset:20,bottomOffset:10,containerSize:40,containerRadius:10,containerClass:"goup-container",arrowClass:"goup-arrow",alwaysVisible:!1,trigger:500,entryAnimation:"fade",goupSpeed:"slow",hideUnderWidth:500,containerColor:"#F7941D",arrowColor:"#fff",title:"",titleAsText:!1,titleAsTextClass:"goup-text"},i),f,a,c,o,u,v,l,s,e,h;n("body").append('<div style="display:none" class="'+r.containerClass+'"><\/div>');f=n("."+r.containerClass);n(f).html('<div class="'+r.arrowClass+'"><\/div>');a=n("."+r.arrowClass);r.location!="right"&&r.location!="left"&&(r.location="right");r.locationOffset<0&&(r.locationOffset=0);r.bottomOffset<0&&(r.bottomOffset=0);r.containerSize<20&&(r.containerSize=20);r.containerRadius<0&&(r.containerRadius=0);r.trigger<0&&(r.trigger=0);r.hideUnderWidth<0&&(r.hideUnderWidth=0);c=/(^#[0-9A-F]{6}$)|(^#[0-9A-F]{3}$)/i;c.test(r.containerColor)||(r.containerColor="#F7941D");c.test(r.arrowColor)||(r.arrowColor="#fff");r.title===""&&(r.titleAsText=!1);o={};o={position:"fixed",width:r.containerSize,height:r.containerSize,background:r.containerColor,cursor:"pointer"};o.bottom=r.bottomOffset;o[r.location]=r.locationOffset;o["border-radius"]=r.containerRadius;n(f).css(o);r.titleAsText?(n("body").append('<div class="'+r.titleAsTextClass+'">'+r.title+"<\/div>"),u=n("."+r.titleAsTextClass),n(u).attr("style",n(f).attr("style")),n(u).css("background","transparent").css("width",r.containerSize+40).css("height","auto").css("text-align","center").css(r.location,r.locationOffset-20),v=n(u).height()+10,n(f).css("bottom","+="+v+"px")):n(f).attr("title",r.title);l={};s=.25*r.containerSize;l={width:0,height:0,margin:"0 auto","padding-top":Math.ceil(.325*r.containerSize),"border-style":"solid","border-width":"0 "+s+"px "+s+"px "+s+"px","border-color":"transparent transparent "+r.arrowColor+" transparent"};n(a).css(l);e=!1;n(window).resize(function(){n(window).outerWidth()<=r.hideUnderWidth?(e=!0,t(n(f),"hide",r.entryAnimation),u&&t(n(u),"hide",r.entryAnimation)):(e=!1,n(window).trigger("scroll"))});n(window).outerWidth()<=r.hideUnderWidth&&(e=!0,n(f).hide(),u&&n(u).hide());r.alwaysVisible?(t(n(f),"show",r.entryAnimation),u&&t(n(u),"show",r.entryAnimation)):n(window).scroll(function(){n(window).scrollTop()>=r.trigger&&!e&&(t(n(f),"show",r.entryAnimation),u&&t(n(u),"show",r.entryAnimation));n(window).scrollTop()<r.trigger&&!e&&(t(n(f),"hide",r.entryAnimation),u&&t(n(u),"hide",r.entryAnimation))});n(window).scrollTop()>=r.trigger&&!e&&(t(n(f),"show",r.entryAnimation),u&&t(n(u),"show",r.entryAnimation));h=!0;n(f).add(u).on("click",function(){return h&&(h=!1,n("html,body").animate({scrollTop:0},r.goupSpeed,function(){h=!0})),!1})}})(jQuery)