//-- copyright
// Copyright (C) 2012-2014 the OpenProject Foundation (OPF)
// OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:
// Copyright (C) 2006-2013 Jean-Philippe Lang
// Copyright (C) 2010-2013 the ChiliProject Team
// See doc/COPYRIGHT.rdoc for more details.
!function(e){e.fn.nextElementInDom=function(t,n){return e(this).findElementInDom(t,e.extend(n,{direction:"front"}))},e.fn.previousElementInDom=function(t,n){return e(this).findElementInDom(t,e.extend(n,{direction:"back"}))},e.fn.findElementInDom=function(t,n){var i,s,o,r,a;return i={stopAt:"body",direction:"front"},n=e.extend(i,n),s=e(this).parent(),o="front"===n.direction?":gt":":lt",a=s.children(o+"("+e(this).index()+")"),a="front"===n.direction?a:a.reverse(),r=s.children(o+"("+e(this).index()+")").find(t).filter(":first"),r.length>0?r:0===s.length||s.is(n.stopAt)?e([]):s.findElementInDom(t,n)}}(jQuery);