/*
Copyright (c) 2011, Julien Wajsberg <felash@gmail.com>
All rights reserved.

Official repository: https://github.com/julienw/jquery-trap-input

Redistribution and use in source and binary forms, with or without
modification, are permitted without condition.

Although that's not an obligation, I would appreciate that you provide a
link to the official repository.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
IS" AND ANY EXPRESS OR IMPLIED WARRANTIES ARE DISCLAIMED.
*/(function(a,b){function k(){return!!this.data(c)}function j(){this.unbind("keydown",d),this.removeData(c);return this}function i(){this.keydown(d),this.data(c,!0);return this}function h(b){var c=a(b),d=[],e=0;c.find("a[href], link[href], [draggable=true], [contenteditable=true], :input:enabled, [tabindex=0]").filter(":visible").not(f).each(function(a,b){d.push({v:b,t:0,i:e++})}),c.find("[tabindex]").filter(":visible").filter(f).each(function(a,b){d.push({v:b,t:b.tabIndex,i:e++})}),d=a.map(d.sort(g),function(a){return a.v});return a(d)}function g(a,b){return a.t-b.t||a.i-b.i}function f(){return this.tabIndex>0}function e(a,b,c){var d=h(a),e=b,f,g,i,j;do{f=d.index(e),g=f+1,i=f-1,j=d.length-1;switch(f){case-1:return!1;case 0:i=j;break;case j:g=0}c&&(g=i),e=d.eq(g),e.focus()}while(b===b.ownerDocument.activeElement);return!0}function d(a){if(a.keyCode===9){var b=!!a.shiftKey;e(this,a.target,b)&&a.preventDefault()}}var c="trap.isTrapping";a.fn.extend({trap:i,untrap:j,isTrapping:k})})(jQuery)

