(function(c){c.ui=c.ui||{};var p=/left|center|right/,q=/top|center|bottom/,r={},s=c.fn.position,t=c.fn.offset;c.fn.position=function(b){if(!b||!b.of)return s.apply(this,arguments);var b=c.extend({},b),a=c(b.of),d=a[0],l=(b.collision||"flip").split(" "),g=b.offset?b.offset.split(" "):[0,0],m,e,f;return 9===d.nodeType?(m=a.width(),e=a.height(),f={top:0,left:0}):d.setTimeout?(m=a.width(),e=a.height(),f={top:a.scrollTop(),left:a.scrollLeft()}):d.preventDefault?(b.at="left top",m=e=0,f={top:b.of.pageY,
left:b.of.pageX}):(m=a.outerWidth(),e=a.outerHeight(),f=a.offset()),c.each(["my","at"],function(){var a=(b[this]||"").split(" ");1===a.length&&(a=p.test(a[0])?a.concat(["center"]):q.test(a[0])?["center"].concat(a):["center","center"]);a[0]=p.test(a[0])?a[0]:"center";a[1]=q.test(a[1])?a[1]:"center";b[this]=a}),1===l.length&&(l[1]=l[0]),g[0]=parseInt(g[0],10)||0,1===g.length&&(g[1]=g[0]),g[1]=parseInt(g[1],10)||0,"right"===b.at[0]?f.left+=m:"center"===b.at[0]&&(f.left+=m/2),"bottom"===b.at[1]?f.top+=
e:"center"===b.at[1]&&(f.top+=e/2),f.left+=g[0],f.top+=g[1],this.each(function(){var a=c(this),d=a.outerWidth(),h=a.outerHeight(),j=parseInt(c.curCSS(this,"marginLeft",!0))||0,k=parseInt(c.curCSS(this,"marginTop",!0))||0,p=d+j+(parseInt(c.curCSS(this,"marginRight",!0))||0),q=h+k+(parseInt(c.curCSS(this,"marginBottom",!0))||0),i=c.extend({},f),n;"right"===b.my[0]?i.left-=d:"center"===b.my[0]&&(i.left-=d/2);"bottom"===b.my[1]?i.top-=h:"center"===b.my[1]&&(i.top-=h/2);r.fractions||(i.left=Math.round(i.left),
i.top=Math.round(i.top));n={left:i.left-j,top:i.top-k};c.each(["left","top"],function(a,f){c.ui.position[l[a]]&&c.ui.position[l[a]][f](i,{targetWidth:m,targetHeight:e,elemWidth:d,elemHeight:h,collisionPosition:n,collisionWidth:p,collisionHeight:q,offset:g,my:b.my,at:b.at})});c.fn.bgiframe&&a.bgiframe();a.offset(c.extend(i,{using:b.using}))})};c.ui.position={fit:{left:function(b,a){var d=c(window),d=a.collisionPosition.left+a.collisionWidth-d.width()-d.scrollLeft();b.left=0<d?b.left-d:Math.max(b.left-
a.collisionPosition.left,b.left)},top:function(b,a){var d=c(window),d=a.collisionPosition.top+a.collisionHeight-d.height()-d.scrollTop();b.top=0<d?b.top-d:Math.max(b.top-a.collisionPosition.top,b.top)}},flip:{left:function(b,a){if("center"!==a.at[0]){var d=c(window),d=a.collisionPosition.left+a.collisionWidth-d.width()-d.scrollLeft(),l="left"===a.my[0]?-a.elemWidth:"right"===a.my[0]?a.elemWidth:0,g="left"===a.at[0]?a.targetWidth:-a.targetWidth,e=-2*a.offset[0];b.left+=0>a.collisionPosition.left?l+
g+e:0<d?l+g+e:0}},top:function(b,a){if("center"!==a.at[1]){var d=c(window),d=a.collisionPosition.top+a.collisionHeight-d.height()-d.scrollTop(),e="top"===a.my[1]?-a.elemHeight:"bottom"===a.my[1]?a.elemHeight:0,g="top"===a.at[1]?a.targetHeight:-a.targetHeight,h=-2*a.offset[1];b.top+=0>a.collisionPosition.top?e+g+h:0<d?e+g+h:0}}}};c.offset.setOffset||(c.offset.setOffset=function(b,a){/static/.test(c.curCSS(b,"position"))&&(b.style.position="relative");var d=c(b),e=d.offset(),g=parseInt(c.curCSS(b,"top",
!0),10)||0,h=parseInt(c.curCSS(b,"left",!0),10)||0,e={top:a.top-e.top+g,left:a.left-e.left+h};"using"in a?a.using.call(b,e):d.css(e)},c.fn.offset=function(b){var a=this[0];return!a||!a.ownerDocument?null:b?c.isFunction(b)?this.each(function(a){c(this).offset(b.call(this,a,c(this).offset()))}):this.each(function(){c.offset.setOffset(this,b)}):t.call(this)});c.curCSS||(c.curCSS=c.css);var h=document.getElementsByTagName("body")[0],j=document.createElement("div"),k,e;k=document.createElement(h?"div":
"body");e={visibility:"hidden",width:0,height:0,border:0,margin:0,background:"none"};h&&c.extend(e,{position:"absolute",left:"-1000px",top:"-1000px"});for(var n in e)k.style[n]=e[n];k.appendChild(j);e=h||document.documentElement;e.insertBefore(k,e.firstChild);j.style.cssText="position: absolute; left: 10.7432222px; top: 10.432325px; height: 30px; width: 201px;";j=c(j).offset(function(b,a){return a}).offset();k.innerHTML="";e.removeChild(k);h=j.top+j.left+(h?2E3:0);r.fractions=21<h&&22>h})(jQuery);