| Current Path : /home/lejardintz/www/media/kunena/js/bootstrap/ |
| Current File : /home/lejardintz/www/media/kunena/js/bootstrap/moobootstrap-min.js |
Element.implement({alert:function(a){if(this.retrieve("alert")===null){this.store("alert",new Alert(a,this));}return this.retrieve("alert");}});Alert=new Class({Implements:[Options,Events],options:{animation:true},initialize:function(b,a){this.selector=a;this.setOptions(b);this.setOptions(this.getDataOptions(a));if(!this.options.target){this.target=a.getParent(".alert");}else{this.target=this.options.target;}},close:function(a){a&&a.preventDefault();this.target.fireEvent("close",new Event.Mock(this.target,"close"));if(this.options.animation){this.target.fadeAndDestroy();}else{this.target.hide().dispose();}},getDataOptions:function(a){var c;var b;var d={};var f=a;if(typeof f.dataset!="undefined"){for(c in f.dataset){b=this.trueValue(f.dataset[c]);d[c]=b;}return d;}else{if(Browser.ie){for(c in this.options){if(f.get("data-"+c)){d[c]=this.trueValue(f.get("data-"+c));}}return d;}else{return{};}}},trueValue:function(a){if(a=="true"){return true;}else{if(a=="false"){return false;}else{if(a=="null"){return null;}else{return a;}}}}});window.addEvent("domready",function(){$(document.body).getElements(".alert").each(function(a){if(a.hasClass("fade")){var b=setTimeout(function(){a.addClass("in");},300);}});$(document.body).addEvent("click:relay([data-dismiss=alert])",function(){this.alert().close();});});Event.Mock=function(c,a){var b=window.event;a=a||"click";if(document.createEvent){b=document.createEvent("HTMLEvents");b.initEvent(a,false,true);}b=new Event(b);b.target=c;return b;};Element.implement({fadeAndDestroy:function(b){var a=this;b=b||600;this.set("tween",{duration:b}).fade("out").get("tween").chain(function(){a.dispose();});}});Element.implement({dropdown:function(){if(this.retrieve("dropdown")===null){this.store("dropdown",new Dropdown(this));}return this.retrieve("dropdown");}});Dropdown=new Class({initialize:function(a){this.element=a;this.dropdown_menu=this.element.getNext(".dropdown-menu");if(!this.dropdown_menu){this.dropdown_menu=this.element.getPrevious(".dropdown-menu");}if(!this.dropdown_menu){this.dropdown_menu=this.element.getElement(".dropdown-menu");}if(!this.dropdown_menu){return;}this.touchStart=false;$(document.body).addEvent("click",function(b){if(this.touchStart){this.touchStart=false;}else{if(this.isShown()){if(b.target!=this.element&&b.target.getParent("[data-toggle=dropdown]")!=this.element){if(b.target!=this.dropdown_menu&&b.target.getParent(".dropdown-menu")!=this.dropdown_menu){this.hide();}}if(b.target.getParent("[data-toggle=dropdown]")!=this.element&&b.target!=this.element){if(typeof b.target.href!="undefined"){this.hide();}}}}}.bind(this));a.addEvent("click",function(b){this.toggle();b.preventDefault();}.bind(this));},toggle:function(){if(this.isShown()){this.hide();}else{this.show();}},show:function(){this.touchStart=true;this.element.addClass("open active");this.dropdown_menu.show();},hide:function(){this.element.removeClass("open active");this.dropdown_menu.hide();},isShown:function(){if(this.dropdown_menu.isVisible()||this.element.hasClass("open")){return true;}else{return false;}}});window.addEvent("domready",function(){$(document.body).getElements("[data-toggle=dropdown]").each(function(a){a.dropdown();});});Element.implement({modal:function(a){if(this.retrieve("modal")===null){this.store("modal",new Modal(a,this));}return this.retrieve("modal");}});Modal=new Class({Implements:[Options,Events],options:{backdrop:true,keyboard:true,show:true,remote:false,target:false},initialize:function(c,a){this.browser_transition_end=this.browserTransitionEnd();this.selector=a;this.setOptions(c);this.setOptions(this.getDataOptions(a));if(this.selector.get("href")){var b=this.selector.get("href");if(b[0]!="#"||"."){this.options.remote=b;this.selector.set("href",null);}else{this.options.target=b;}}if(!this.options.target){return false;}else{this.element=$(document.body).getElement(this.options.target);}this.element.addEvent("click:relay([data-dismiss=modal])",function(d){this.hide(d);}.bind(this));if(this.options.remote&&this.element.getElement(".modal-body")){this.element.getElement(".modal-body").load(this.options.remote);}if(this.options.show){this.show();}},toggle:function(){if(this.isShown){this.hide();}else{this.show();}},show:function(){e=new Event.Mock(this.element,"show");this.element.fireEvent("show",e);if(this.isShown||e.isDefaultPrevented()){return;}this.isShown=true;this.escape();this.backdrop(function(){var c=this.browser_transition_end&&this.element.hasClass("fade");if(!this.element.getParent().length){this.element.inject($(document.body));}this.element.show();if(c){this.element.offsetWidth;}this.element.addClass("in").set("aria-hidden",false);this.enforceFocus();if(c){var a=function(){clearTimeout(b);this.element.removeEventListener(this.browser_transition_end,a);this.focusElement();this.element.fireEvent("shown");}.bind(this);var b=setTimeout(function(){this.element.removeEventListener(this.browser_transition_end,a);this.focusElement();this.element.fireEvent("shown");}.bind(this),500);this.element.addEventListener(this.browser_transition_end,a);}else{this.focusElement();this.element.fireEvent("shown");}}.bind(this));},focusElement:function(){if(this.isShown){this.element.setAttribute("tabIndex",1);this.element.focus();}else{this.element.setAttribute("tabIndex",-1);}},hide:function(a){a&&a.preventDefault();a=new Event.Mock(this.element,"hide");this.element.fireEvent("hide",a);if(!this.isShown||a.isDefaultPrevented()){return;}this.isShown=false;this.escape();$(document.body).removeEvent("focus:relay(.modal)");this.element.removeClass("in").set("aria-hidden",true);if(this.browser_transition_end&&this.element.hasClass("fade")){this.hideWithTransition();}else{this.hideModal();}},enforceFocus:function(){$(document.body).addEvent("focus:relay(.modal)",function(a){if(this.element!==a.target&&!this.element.contains(a.target)){this.focusElement();}}.bind(this));},escape:function(){if(this.isShown&&this.options.keyboard){this.element.addEvent("keyup",function(a){if(a.key=="esc"){this.hide();}}.bind(this));}else{if(!this.isShown){this.element.removeEvent("keyup");}}},hideWithTransition:function(){var b=function(){clearTimeout(a);this.element.removeEventListener(this.browser_transition_end,b);this.hideModal();}.bind(this);var a=setTimeout(function(){this.element.removeEventListener(this.browser_transition_end,b);this.hideModal();}.bind(this),500);this.element.addEventListener(this.browser_transition_end,b);},hideModal:function(){this.element.hide();this.element.fireEvent("hidden");this.backdrop();},removeBackdrop:function(){this.backdrop_element.dispose();this.backdrop_element=null;},backdrop:function(d){var b,c;var a=this.element.hasClass("fade")?"fade":"";doAnimate=this.browser_transition_end&&a;if(this.isShown&&this.options.backdrop){this.backdrop_element=new Element("div",{"class":"modal-backdrop "+a});$(document.body).grab(this.backdrop_element);if(this.options.backdrop=="static"){this.backdrop_element.addEvent("click",function(){this.focusElement();}.bind(this));}else{this.backdrop_element.addEvent("click",function(){this.hide();}.bind(this));}if(doAnimate){this.backdrop_element.offsetWidth;}this.backdrop_element.addClass("in");if(doAnimate){c=function(){clearTimeout(b);this.backdrop_element.removeEventListener(this.browser_transition_end,c);d();}.bind(this);b=setTimeout(function(){this.backdrop_element.removeEventListener(this.browser_transition_end,c);d();}.bind(this),500);this.backdrop_element.addEventListener(this.browser_transition_end,c);}else{d();}}else{if(d){d();}else{if(!this.isShown&&this.backdrop_element){this.backdrop_element.removeClass("in");if(doAnimate){c=function(){clearTimeout(b);this.backdrop_element.removeEventListener(this.browser_transition_end,c);this.removeBackdrop();}.bind(this);b=setTimeout(function(){this.backdrop_element.removeEventListener(this.browser_transition_end,c);this.removeBackdrop();}.bind(this),500);this.backdrop_element.addEventListener(this.browser_transition_end,c);}else{this.removeBackdrop();}}else{if(d){d();}}}}},getDataOptions:function(a){var c;var b;var d={};var f=a;if(typeof f.dataset!="undefined"){for(c in f.dataset){b=this.trueValue(f.dataset[c]);d[c]=b;}return d;}else{if(Browser.ie){for(c in this.options){if(f.get("data-"+c)){d[c]=this.trueValue(f.get("data-"+c));}}return d;}else{return{};}}},trueValue:function(a){if(a=="true"){return true;}else{if(a=="false"){return false;}else{if(a=="null"){return null;}else{return a;}}}},browserTransitionEnd:function(){var a;var b=document.createElement("fakeelement");var c={transition:"transitionEnd",OTransition:"oTransitionEnd",MSTransition:"msTransitionEnd",MozTransition:"transitionend",WebkitTransition:"webkitTransitionEnd"};for(a in c){if(b.style[a]!==undefined){return c[a];}}return false;}});Event.Mock=function(c,a){var b=window.event;a=a||"click";if(document.createEvent){b=document.createEvent("HTMLEvents");b.initEvent(a,false,true);}b=new Event(b);b.target=c;return b;};Event.implement({isDefaultPrevented:function(){return this.event.defaultPrevented;}});window.addEvent("domready",function(){$(document.body).getElements("[data-toggle=modal]").each(function(a){if(a.get("data-target")!==null||a.get("href")!==null){a.addEvent("click",function(){a.modal({show:false}).toggle();});}});});Element.implement({tooltip:function(a){if(this.retrieve("tooltip")===null){this.store("tooltip",new Tooltip(a,this));}return this.retrieve("tooltip");}});Tooltip=new Class({Implements:[Options],options:{animation:true,html:false,placement:"top",selector:false,title:"",trigger:"hover",delay:0,document_placement:false,template:'<div class="tooltip"><div class="tooltip-arrow"></div><div class="tooltip-inner"></div></div>'},initialize:function(b,c){var d,a;this.enabled=true;this.tip=false;this.hoverState=false;this.element=c;this.setOptions(b);this.setOptions(this.getDataOptions());if(!this.options.selector){this.options.selector=this.element;}else{if(!isElement(this.options.selector)){this.options.selector=$(this.options.selector);}}if(this.options.trigger=="click"){this.element.addEvent("click",this.toggle.bind(this));}else{if(this.options.trigger!="manual"){d=(this.options.trigger=="hover"?"mouseenter":"focus");a=(this.options.trigger=="hover"?"mouseleave":"blur");this.element.addEvent(d,this.enter.bind(this));this.element.addEvent(a,this.leave.bind(this));}}this.fixTitle();if(this.options.delay&&typeof this.options.delay=="number"){this.options.delay={show:this.options.delay,hide:this.options.delay};}},enter:function(){var a=this.options.delay.show;if(!a){return this.show();}clearTimeout(this.timeout);this.hoverState="in";this.timeout=setTimeout(function(){if(this.hoverState=="in"){this.show();}}.bind(this),a);},leave:function(){var a=this.options.delay.hide;if(!a){return this.hide();}clearTimeout(this.timeout);this.hoverState="out";this.timeout=setTimeout(function(){if(this.hoverState=="out"){this.hide();}}.bind(this),a);},fixTitle:function(){var a=this.element.get("title");if(!this.options.title){if(a){this.options.title=a;this.element.set("data-original-title",a);this.element.set("title",null);}}},getTitle:function(){return this.options.title;},hasContent:function(){return this.getTitle();},setContent:function(){var a=this.getTip();var b=this.getTitle();var c=this.options.html?"html":"text";a.getElement(".tooltip-inner").set(c,b);a.removeClass("fade in top bottom left right");return this;},show:function(){var d;var c=this.options.placement;var a=this.options.selector;if(this.hasContent()&&this.enabled){d=this.getTip();this.setContent();if(this.options.animation){d.addClass("fade");}d=d.dispose();d.setStyle("display","block");if(this.options.document_placement){if(this.options.document_placement===true){$(document.body).grab(d);}else{if(isElement(this.options.document_placement)){this.options.document_placement.grab(d);}else{$(this.options.document_placement).grab(d);}}}else{d.inject(a,"after");}if(typeof c=="function"){d=c(d,a);}else{d.addClass(c);var b=d.getComputedSize();var f;switch(c){case"top":f={x:-(b.totalWidth/2),y:-(b.totalHeight)};d.position({relativeTo:a,position:"centerTop",offset:f});break;case"right":f={x:0,y:-(b.totalHeight/2)};d.position({relativeTo:a,position:"centerRight",offset:f});break;case"bottom":f={x:-(b.totalWidth/2),y:0};d.position({relativeTo:a,position:"centerBottom",offset:f});break;case"left":f={x:-(b.totalWidth),y:-(b.totalHeight/2)};d.position({relativeTo:a,position:"centerLeft",offset:f});break;}}d.addClass("in");}return this;},getTip:function(){if(typeof this.tip=="undefined"||this.tip===false){this.tip=new Elements.from(this.options.template);}return this.tip[0];},hide:function(){var c=this.getTip();var b=this.options.animation;c.removeClass("in");if(b){var a=setTimeout(function(){c.dispose();clearTimeout(a);},500);}else{c.dispose();}return this;},toggle:function(){if(this.hoverState=="in"){this.hoverState="out";this.hide();}else{this.hoverState="in";this.show();}},isShown:function(){return this.isShown;},disable:function(){this.enabled=false;return this;},enable:function(){this.enabled=true;return this;},toggleEnabled:function(){this.enabled=!this.enabled;return this;},destroy:function(){this.enabled=false;this.tip.dispose();this.element.store("tooltip",null);},getDataOptions:function(){var b;var a;var c={};var d=this.element;if(typeof d.dataset!="undefined"){for(b in d.dataset){a=this.trueValue(d.dataset[b]);c[b]=a;}return c;}else{if(Browser.ie){for(b in this.options){if(d.get("data-"+b)){c[b]=this.trueValue(d.get("data-"+b));}}return c;}else{return{};}}},trueValue:function(a){if(a=="true"){return true;}else{if(a=="false"){return false;}else{if(a=="null"){return null;}else{return a;}}}}});function isElement(b){try{return b instanceof HTMLElement;}catch(a){return(typeof b==="object")&&(b.nodeType===1)&&(typeof b.style==="object")&&(typeof b.ownerDocument==="object");}}Element.implement({popover:function(a){if(this.retrieve("popover")===null){this.store("popover",new Popover(a,this));}return this.retrieve("popover");}});Popover=new Class({Extends:Tooltip,options:{animation:true,html:false,placement:"right",selector:false,trigger:"click",title:"",content:"",delay:0,template:'<div class="popover"><div class="arrow"></div><div class="popover-inner"><h3 class="popover-title"></h3><div class="popover-content"></div></div></div>'},initialize:function(a,b){this.parent(a,b);},setContent:function(){var b=this.getTip();var c=this.getTitle();var a=this.getContent();var d=this.options.html?"html":"text";b.getElement(".popover-title").set(d,c);b.getElement(".popover-content").set(d,a);b.removeClass("fade top bottom left right in");},hasContent:function(){return this.getTitle()||this.getContent();},getContent:function(){return this.options.content;}});Element.implement({tab:function(a){if(this.retrieve("tab")===null){this.store("tab",new Tab(a,this));}return this.retrieve("tab");}});Tab=new Class({Implements:[Options,Events],options:{},initialize:function(a,b){this.tab=b;this.list=b.getParent("ul:not(.dropdown-menu)");if(!this.list){return;}this.setOptions(a);this.setOptions(this.getDataOptions(this.tab));if(!this.options.target){this.selector=this.tab.get("href");this.selector=this.selector&&this.selector.replace(/.*(?=#[^\s]*$)/,"");this.selector=$(document.body).getElement(this.selector);}this.tab.addEvent("click",function(c){c.preventDefault();this.show();}.bind(this));},show:function(){if(this.tab.getParent("li").hasClass("active")){return;}previous=this.list.getElement(".active:last a");e=new Event.Mock(this.tab,{type:"show",relatedTarget:previous});this.tab.fireEvent("show",e);if(e.isDefaultPrevented()){return;}this.activate(this.tab.getParent("li"),this.list);this.activate(this.selector,this.selector.getParent(),function(){this.tab.fireEvent("shown",new Event.Mock(this.tab,{type:"shown",relatedTarget:previous}));}.bind(this));},activate:function(b,a,g){var d=a.getElement("> .active");var f=g&&this.browserTransitionEnd()&&d.hasClass("fade");function c(){d.removeClass("active");if(d.getElement("> .dropdown-menu > .active")){d.getElement("> .dropdown-menu > .active").removeClass("active");}b.addClass("active");if(f){b[0].offsetWidth;b.addClass("in");}else{b.removeClass("fade");}if(b.getParent(".dropdown-menu")){b.getElement("li.dropdown").addClass("active");}g&&g();}f?d.addEventListener(this.browser_transition_end,c):c();d.removeClass("in");},getDataOptions:function(a){var c;var b;var d={};var f=a;if(typeof f.dataset!="undefined"){for(c in f.dataset){b=this.trueValue(f.dataset[c]);d[c]=b;}return d;}else{if(Browser.ie){for(c in this.options){if(f.get("data-"+c)){d[c]=this.trueValue(f.get("data-"+c));}}return d;}else{return{};}}},trueValue:function(a){if(a=="true"){return true;}else{if(a=="false"){return false;}else{if(a=="null"){return null;}else{return a;}}}},browserTransitionEnd:function(){var a;var b=document.createElement("fakeelement");var c={transition:"transitionEnd",OTransition:"oTransitionEnd",MSTransition:"msTransitionEnd",MozTransition:"transitionend",WebkitTransition:"webkitTransitionEnd"};for(a in c){if(b.style[a]!==undefined){return c[a];}}return false;}});Event.Mock=function(c,a){var b=window.event;a=a||"click";if(document.createEvent){b=document.createEvent("HTMLEvents");b.initEvent(a,false,true);}b=new Event(b);b.target=c;return b;};Event.implement({isDefaultPrevented:function(){return this.event.defaultPrevented;}});window.addEvent("domready",function(){$(document.body).getElements("[data-toggle=tab]").each(function(a){if(a.get("data-target")!==null||a.get("href")!==null){a.tab();}});});Element.implement({toggleButtons:function(a){if(this.retrieve("toggleButtons")===null){this.store("toggleButtons",new toggleButtons(a,this));}return this.retrieve("toggleButtons");}});toggleButtons=new Class({Implements:[Options,Events],options:{size:false,enabled:"primary",enabledtext:"ON",disabled:false,disabledtext:"OFF",animation:true},initialize:function(a,b){this.element=b;this.checkbox=b.getElement("input[type=checkbox]");this.setOptions(a);this.setOptions(this.getDataOptions());this.enabled=true;if(this.checkbox.checked){this.state=true;}else{this.state=false;}this.displayButtons();this.checkbox.addEvent("change",function(){if(this.checkbox.checked){this.setOn(true);}else{this.setOff(true);}}.bind(this));},displayButtons:function(){this.checkbox.hide();this.element.addClass("toggle-buttons");this.button_container=new Element("div").addClass("btn-group");this.button_blank=new Element("button").addClass("btn");if(this.options.size){this.button_blank.addClass("btn-"+this.options.size);}this.button_left=this.button_blank.clone().set("text",this.options.enabledtext);if(this.options.enabled){this.button_left.addClass("btn-"+this.options.enabled);}this.button_right=this.button_blank.clone().set("text",this.options.disabledtext);if(this.options.disabled){this.button_right.addClass("btn-"+this.options.disabled);}this.button_container.grab(this.button_left).grab(this.button_blank).grab(this.button_right);this.button_container.inject(this.element,"bottom");this.button_container.disableSelection();var b=this.button_left.measure(function(){return this.getSize();});var d=this.button_right.measure(function(){return this.getSize();});var f=(b.x>d.x)?b.x:d.x;var a=(b.y>d.y)?b.y:d.y;var c={position:"absolute",width:f-1,height:a,"margin-left":0};if(this.checked()){this.button_left.setStyles(c).setStyle("left","0%");this.button_blank.setStyles(c).setStyle("left","50%");this.button_right.setStyles(c).setStyle("left","100%");this.button_blank.style.borderTopRightRadius="4px";this.button_blank.style.borderBottomRightRadius="4px";this.button_blank.style.borderTopLeftRadius="0px";this.button_blank.style.borderBottomLeftRadius="0px";}else{this.button_left.setStyles(c).setStyle("left","-50%");this.button_blank.setStyles(c).setStyle("left","0%");this.button_right.setStyles(c).setStyle("left","50%");this.button_blank.style.borderTopRightRadius="0px";this.button_blank.style.borderBottomRightRadius="0px";this.button_blank.style.borderTopLeftRadius="4px";this.button_blank.style.borderBottomLeftRadius="4px";}if(this.options.animation){this.button_left.style.transition="left 0.2s";this.button_blank.style.transition="left 0.2s";this.button_right.style.transition="left 0.2s";this.button_left.style.WebkitTransition="left 0.2s";this.button_blank.style.WebkitTransition="left 0.2s";this.button_right.style.WebkitTransition="left 0.2s";this.button_left.style.MozTransition="left 0.2s";this.button_blank.style.MozTransition="left 0.2s";this.button_right.style.MozTransition="left 0.2s";}this.button_container.setStyles({overflow:"hidden",width:(f*2)-2,height:a});this.button_container.style.borderRadius="4px";this.button_container.style.MozBorderRadius="4px";this.button_left.addEvent("click",function(g){g.stop();this.toggleState();}.bind(this));this.button_right.addEvent("click",function(g){g.stop();this.toggleState();}.bind(this));this.button_blank.addEvent("click",function(g){g.stop();this.toggleState();}.bind(this));},deleteButtons:function(){this.enabled=false;this.checkbox.show();this.element.removeClass("btn-group");this.button_container.dispose();},toggleState:function(){if(this.state){this.setOff();}else{this.setOn();}},setOn:function(a){if(typeof a=="undefined"||a===false){e=new Event.Mock(this.element,"setoff");this.element.fireEvent("seton",e);if(!this.enabled||e.isDefaultPrevented()){return;}e=new Event.Mock(this.checkbox,"change");this.checkbox.fireEvent("change",e);this.checkbox.checked=true;}this.state=true;this.button_left.setStyle("left","0%");this.button_blank.setStyle("left","50%");this.button_right.setStyle("left","100%");this.button_blank.style.borderTopRightRadius="4px";this.button_blank.style.borderBottomRightRadius="4px";this.button_blank.style.borderTopLeftRadius="0px";this.button_blank.style.borderBottomLeftRadius="0px";},setOff:function(a){if(typeof a=="undefined"||a===false){e=new Event.Mock(this.element,"setoff");this.element.fireEvent("setoff",e);if(!this.enabled||e.isDefaultPrevented()){return;}e=new Event.Mock(this.checkbox,"change");this.checkbox.fireEvent("change",e);this.checkbox.checked=false;}this.state=false;this.button_left.setStyle("left","-50%");this.button_blank.setStyle("left","0%");this.button_right.setStyle("left","50%");this.button_blank.style.borderTopRightRadius="0px";this.button_blank.style.borderBottomRightRadius="0px";this.button_blank.style.borderTopLeftRadius="4px";this.button_blank.style.borderBottomLeftRadius="4px";},checked:function(){return this.state;},enable:function(){this.enabled=true;this.button_left.removeClass("disabled");this.button_right.removeClass("disabled");return this;},disable:function(){this.enabled=false;this.button_left.addClass("disabled");this.button_right.addClass("disabled");return this;},getDataOptions:function(){var b;var a;var c={};var d=this.element;if(typeof d.dataset!="undefined"){for(b in d.dataset){a=this.trueValue(d.dataset[b]);c[b]=a;}return c;}else{if(Browser.ie){for(b in this.options){if(d.get("data-"+b)){c[b]=this.trueValue(d.get("data-"+b));}}return c;}else{return{};}}},trueValue:function(a){if(a=="true"){return true;}else{if(a=="false"){return false;}else{if(a=="null"){return null;}else{return a;}}}}});Event.Mock=function(c,a){var b=window.event;a=a||"click";if(document.createEvent){b=document.createEvent("HTMLEvents");b.initEvent(a,false,true);}b=new Event(b);b.target=c;return b;};Event.implement({isDefaultPrevented:function(){return this.event.defaultPrevented;}});Element.implement({disableSelection:function(){if(typeof this.onselectstart!="undefined"){this.onselectstart=function(){return false;};}else{if(typeof this.style.MozUserSelect!="undefined"){this.style.MozUserSelect="none";}else{this.onmousedown=function(){return false;};}}this.style.cursor="default";return this;}});window.addEvent("domready",function(){$(document.body).getElements("[data-toggle=toggleButtons]").each(function(a){a.toggleButtons();});});var Transition=function(){var a=(function(){var d=document.createElement("bootstrap");var c={WebkitTransition:"webkitTransitionEnd",MozTransition:"transitionend",OTransition:"oTransitionEnd",msTransition:"MSTransitionEnd",transition:"transitionend"};var b;for(b in c){if(d.style[b]!==undefined){return c[b];}}}());return a&&{end:a};};Element.implement({typeahead:function(a){if(this.retrieve("Typeahead")===null){this.store("Typeahead",new Typeahead(a,this));}return this.retrieve("Typeahead");}});Typeahead=new Class({Implements:[Options,Events],options:{source:[],items:8,minLength:1,matcher:{},sorter:{},updater:{},highlighter:{},menu:'<ul class="typeahead dropdown-menu"></ul>',item:'<li><a href="#"></a></li>'},initialize:function(a,b){this.element=b;this.setOptions(a);this.menu=new Elements.from(this.options.menu)[0];this.item=new Elements.from(this.options.item)[0];this.listen();},select:function(){var a=this.menu.getElement(".active");var b=a.get("data-value");this.element.set("value",this.updater(b)).fireEvent("change",new Event.Mock(this.element,"change"));return this.hide();},updater:function(a){return a;},show:function(){var a=Object.merge({},this.element.getCoordinates(),{height:this.element.offsetHeight});this.menu.inject(this.element,"after").setStyles({top:a.top+a.height,left:a.left}).show();this.shown=true;return this;},hide:function(){this.menu.hide();this.shown=false;return this;},lookup:function(b){var a;this.query=this.element.get("value");if(!this.query||this.query.length<this.options.minLength){return this.shown?this.hide():this;}a=typeof this.options.source=="function"?this.options.source(this.query,this.process.bind(this)):this.options.source;return a?this.process(a):this;},process:function(a){a=a.filter(function(b){return this.matcher(b);}.bind(this));a=this.sorter(a);if(!a.length){return this.shown?this.hide():this;}return this.render(a.slice(0,this.options.items)).show();},matcher:function(a){return ~a.toLowerCase().indexOf(this.query.toLowerCase());},sorter:function(c){var d=[];var b=[];var a=[];var f;while(f=c.shift()){if(!f.toLowerCase().indexOf(this.query.toLowerCase())){d.push(f);}else{if(~f.indexOf(this.query)){b.push(f);}else{a.push(f);}}}return d.concat(b,a);},highlighter:function(a){var b=this.query.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&");return a.replace(new RegExp("("+b+")","ig"),function(c,d){return"<strong>"+d+"</strong>";});},render:function(a){a=a.map(function(c,b){b=this.item.clone();b.set("data-value",c);b.getElement("a").set("html",this.highlighter(c));return b;}.bind(this));this.menu.set("html",null);a.each(function(b){b.inject(this.menu);}.bind(this));this.menu.getFirst("li").addClass("active");return this;},next:function(b){var c=this.menu.getElement(".active").removeClass("active");var a=c.getNext();if(a===null){a=this.menu.getElement("li");}a.addClass("active");},prev:function(b){var c=this.menu.getElement(".active").removeClass("active");var a=c.getPrevious();if(a===null){a=this.menu.getLast("li");}a.addClass("active");},listen:function(){this.element.addEvents({blur:function(a){this.blur(a);}.bind(this),keypress:function(a){this.keypress(a);}.bind(this),keyup:function(a){this.keyup(a);}.bind(this)});if(this.eventSupported("keydown")){this.element.addEvent("keydown",function(a){this.keydown(a);}.bind(this));}this.menu.addEvents({"click:relay(li)":function(a){this.click(a);}.bind(this),"mouseenter:relay(li)":function(a){this.mouseenter(a);}.bind(this)});},eventSupported:function(a){var b=typeof this.element["on"+a]!="undefined";if(!b){this.element.set("on"+a,"return;");b=typeof this.element["on"+a]==="function";}return b;},move:function(a){if(!this.shown){return;}switch(a.code){case 9:case 13:case 27:a.preventDefault();break;case 38:a.preventDefault();this.prev();break;case 40:a.preventDefault();this.next();break;}a.stopPropagation();},keydown:function(a){this.suppressKeyPressRepeat=~[40,38,9,13,27].indexOf(a.code);this.move(a);},keypress:function(a){if(this.suppressKeyPressRepeat){return;}this.move(a);},keyup:function(a){switch(a.code){case 40:case 38:case 16:case 17:case 18:break;case 9:case 13:if(!this.shown){return;}this.select();break;case 27:if(!this.shown){return;}this.hide();break;default:this.lookup();}a.stopPropagation();a.preventDefault();},blur:function(a){setTimeout(function(){this.hide();}.bind(this),150);},click:function(a){a.stopPropagation();a.preventDefault();this.select();},mouseenter:function(b){var a=b.target.get("data-value")===null?b.target.getParent("li"):b.target;this.menu.getElements(".active").removeClass("active");a.addClass("active");}});Event.Mock=function(c,a){var b=window.event;a=a||"click";if(document.createEvent){b=document.createEvent("HTMLEvents");b.initEvent(a,false,true);}b=new Event(b);b.target=c;return b;};Event.implement({isDefaultPrevented:function(){return this.event.defaultPrevented;}});window.addEvent("domready",function(){$(document.body).getElements("[data-provide=typeahead]").each(function(a){a.typeahead();});});