!function(r){r.fn.__bind__=r.fn.bind,r.fn.__unbind__=r.fn.unbind,r.fn.__find__=r.fn.find;var t={version:"0.7.8",override:/keydown|keypress|keyup/g,triggersMap:{},specialKeys:{27:"esc",9:"tab",32:"space",13:"return",8:"backspace",145:"scroll",20:"capslock",144:"numlock",19:"pause",45:"insert",36:"home",46:"del",35:"end",33:"pageup",34:"pagedown",37:"left",38:"up",39:"right",40:"down",112:"f1",113:"f2",114:"f3",115:"f4",116:"f5",117:"f6",118:"f7",119:"f8",120:"f9",121:"f10",122:"f11",123:"f12"},shiftNums:{"`":"~",1:"!",2:"@",3:"#",4:"$",5:"%",6:"^",7:"&",8:"*",9:"(",0:")","-":"_","=":"+",";":":","'":'"',",":"<",".":">","/":"?","\\":"|"},newTrigger:function(r,t,e){var i={};return i[r]={},i[r][t]={cb:e,disableInInput:!1},i}};r.browser.mozilla&&(t.specialKeys=r.extend(t.specialKeys,{96:"0",97:"1",98:"2",99:"3",100:"4",101:"5",102:"6",103:"7",104:"8",105:"9"})),r.fn.find=function(t){return this.query=t,r.fn.__find__.apply(this,arguments)},r.fn.unbind=function(e,i,n){if(r.isFunction(i)&&(n=i,i=null),i&&"string"==typeof i)for(var s=(this.prevObject&&this.prevObject.query||this[0].id&&this[0].id||this[0]).toString(),a=e.split(" "),f=0;f<a.length;f++)delete t.triggersMap[s][a[f]][i];return this.__unbind__(e,n)},r.fn.bind=function(e,i,n){var s=e.match(t.override);if(r.isFunction(i)||!s)return this.__bind__(e,i,n);var a=null,f=r.trim(e.replace(t.override,""));if(f&&(a=this.__bind__(f,i,n)),"string"==typeof i&&(i={combi:i}),i.combi)for(var o=0;o<s.length;o++){var p=s[o],d=i.combi.toLowerCase(),h=t.newTrigger(p,d,n),u=(this.prevObject&&this.prevObject.query||this[0].id&&this[0].id||this[0]).toString();h[p][d].disableInInput=i.disableInInput,t.triggersMap[u]?t.triggersMap[u][p]||(t.triggersMap[u][p]=h[p]):t.triggersMap[u]=h;var g=t.triggersMap[u][p][d];g?g.constructor!==Array?t.triggersMap[u][p][d]=[g]:t.triggersMap[u][p][d][g.length]=h[p][d]:t.triggersMap[u][p][d]=[h[p][d]],this.each(function(){var t=r(this);t.attr("hkId")&&t.attr("hkId")!==u&&(u=t.attr("hkId")+";"+u),t.attr("hkId",u)}),a=this.__bind__(s.join(" "),i,t.handler)}return a},t.findElement=function(t){if(!r(t).attr("hkId")&&(r.browser.opera||r.browser.safari))for(;!r(t).attr("hkId")&&t.parentNode;)t=t.parentNode;return t},t.handler=function(e){var i=t.findElement(e.currentTarget),n=r(i),s=n.attr("hkId");if(s){s=s.split(";");for(var a=e.which,f=e.type,o=t.specialKeys[a],p=!o&&String.fromCharCode(a).toLowerCase(),d=e.shiftKey,h=e.ctrlKey,u=e.altKey||e.originalEvent.altKey,g=null,l=0;l<s.length;l++)if(t.triggersMap[s[l]][f]){g=t.triggersMap[s[l]][f];break}if(g){var c;if(d||h||u){var _="";u&&(_+="alt+"),h&&(_+="ctrl+"),d&&(_+="shift+"),(c=g[_+o])||p&&(c=g[_+p]||g[_+t.shiftNums[p]]||"shift+"===_&&g[t.shiftNums[p]])}else c=g[o]||p&&g[p];if(c){var b=!1;for(l=0;l<c.length;l++){if(c[l].disableInInput){var v=r(e.target);if(n.is("input")||n.is("textarea")||v.is("input")||v.is("textarea"))return!0}b=b||c[l].cb.apply(this,[e])}return b}}}},window.hotkeys=t}(jQuery);