/*!
 * jQuery UI Position @VERSION
 *
 * Copyright 2012, AUTHORS.txt (http://jqueryui.com/about)
 * Dual licensed under the MIT or GPL Version 2 licenses.
 * http://jquery.org/license
 *
 * http://docs.jquery.com/UI/Position
 */

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