jQuery.fn.extend({everyTime:function(B,C,D,E,A){return this.each(function(){jQuery.timer.add(this,B,C,D,E,A)})},oneTime:function(A,B,C){return this.each(function(){jQuery.timer.add(this,A,B,C,1)})},stopTime:function(A,B){return this.each(function(){jQuery.timer.remove(this,A,B)})}});jQuery.extend({timer:{guid:1,global:{},regex:/^([0-9]+)\s*(.*s)?$/,powers:{ms:1,cs:10,ds:100,s:1000,das:10000,hs:100000,ks:1000000},timeParse:function(C){if(C==undefined||C==null){return null}var A=this.regex.exec(jQuery.trim(C.toString()));if(A[2]){var B=parseInt(A[1],10);var D=this.powers[A[2]]||1;return B*D}else{return C}},add:function(E,C,D,G,H,B){var A=0;if(jQuery.isFunction(D)){if(!H){H=G}G=D;D=C}C=jQuery.timer.timeParse(C);if(typeof C!="number"||isNaN(C)||C<=0){return }if(H&&H.constructor!=Number){B=!!H;H=0}H=H||0;B=B||false;if(!E.$timers){E.$timers={}}if(!E.$timers[D]){E.$timers[D]={}}G.$timerID=G.$timerID||this.guid++;var F=function(){if(B&&this.inProgress){return }this.inProgress=true;if((++A>H&&H!==0)||G.call(E,A)===false){jQuery.timer.remove(E,D,G)}this.inProgress=false};F.$timerID=G.$timerID;if(!E.$timers[D][G.$timerID]){E.$timers[D][G.$timerID]=window.setInterval(F,C)}if(!this.global[D]){this.global[D]=[]}this.global[D].push(E)},remove:function(C,B,D){var E=C.$timers,A;if(E){if(!B){for(B in E){this.remove(C,B,D)}}else{if(E[B]){if(D){if(D.$timerID){window.clearInterval(E[B][D.$timerID]);delete E[B][D.$timerID]}}else{for(var D in E[B]){window.clearInterval(E[B][D]);delete E[B][D]}}for(A in E[B]){break}if(!A){A=null;delete E[B]}}}for(A in E){break}if(!A){C.$timers=null}}}}});if(jQuery.browser.msie){jQuery(window).one("unload",function(){var D=jQuery.timer.global;for(var A in D){var C=D[A],B=C.length;while(--B){jQuery.timer.remove(C[B],A)}}})}(function(D){D.listen=function(G,F,J,I){if(D.listen.illegal(G)){throw'jQuery.Listen > "'+G+"\" can't be handled because it doesn't bubble"}if(typeof F!="object"){I=J,J=F,F=document}var H=jQuery.data(F,"indexer-"+G)||jQuery.data(F,"indexer-"+G,new A(G,F));switch(J){case undefined:case false:H.stop();break;default:H.append(J,I);case true:H.start();break}};D.fn.listen=function(G,F,H){return this.each(function(){D.listen(G,this,F,H)})};D.extend(D.listen,{strict:true,bubbles:{},illegal:function(F){return this.strict&&!this.bubbles[F]}});D.each(("click,dblclick,mousedown,mouseup,mousemove,mouseover,mouseout,keydown,keypress,keyup").split(","),function(F,G){D.listen.bubbles[G]=true});function A(G,F){this.ids={};this.names={};this.listener=F;this.event=G;A.instances.push(this)}A.instances=[];A.prototype={constructor:A,handler:function(G){var F=G.data;G.data=null;F.parse.apply(F,arguments)},running:false,start:function(){if(this.running){return }D.event.add(this.listener,this.event,this.handler,this);this.running=true},stop:function(){if(!this.running){return }D.event.remove(this.listener,this.event,this.handler);this.running=false},parse:function(G){var H=G.target,F=[];if(H.id&&this.ids[H.id]){B(F,this.ids[H.id])}C([H.nodeName,"*"],function(I){var J=this.names[I];if(J){C(B(H.className.split(" "),["*"]),function(K){if(J[K]){B(F,J[K])}})}},this);this.execute(H,F,arguments);H=F=G=null},append:function(G,F){var I=new E(G);if(I.id){(this.ids[I.id]||(this.ids[I.id]=[])).push(F)}else{if(I.nodeName){var H=this.names[I.nodeName]||(this.names[I.nodeName]={});(H[I.className]||(H[I.className]=[])).push(F)}else{throw'jQuery.Listen > "'+G+'" was not recognized as a valid selector.'}}},execute:function(F,H,G){if(H.length){C(H,function(I){I.apply(F,G)})}}};function E(G){var F=E.regex.exec(G)||[];if(F[1]){this.id=F[1]}else{if(F[2]||F[3]){this.nodeName=F[2]?F[2].toUpperCase():"*";this.className=F[3]?F[3].substring(1):"*"}}}E.regex=/#([\w\d_-]+)$|(\w*)(\.[\w_]+)?$/;function C(H,F,J){for(var I=0,G=H.length;I<G;I++){F.call(J,H[I],I)}}function B(G,F){Array.prototype.push.apply(G,F);return G}D.event.add(window,"unload",function(){if(A){D.each(A.instances,function(G,F){F.stop();F.listener=null})}})})(jQuery);jQuery.cookie=function(B,I,L){if(typeof I!="undefined"){L=L||{};if(I===null){I="";L.expires=-1}var E="";if(L.expires&&(typeof L.expires=="number"||L.expires.toUTCString)){var F;if(typeof L.expires=="number"){F=new Date();F.setTime(F.getTime()+(L.expires*24*60*60*1000))}else{F=L.expires}E="; expires="+F.toUTCString()}var K=L.path?"; path="+(L.path):"";var G=L.domain?"; domain="+(L.domain):"";var A=L.secure?"; secure":"";document.cookie=[B,"=",encodeURIComponent(I),E,K,G,A].join("")}else{var D=null;if(document.cookie&&document.cookie!=""){var J=document.cookie.split(";");for(var H=0;H<J.length;H++){var C=jQuery.trim(J[H]);if(C.substring(0,B.length+1)==(B+"=")){D=decodeURIComponent(C.substring(B.length+1));break}}}return D}};function prettyDate(D){var B=new Date((D||"").replace(/-/g,"/").replace(/[TZ]/g," ")),C=(((new Date()).getTime()-B.getTime())/1000),A=Math.floor(C/86400);if(isNaN(A)||A<0||A>=31){return }return A==0&&(C<60&&"just now"||C<120&&"1 minute ago"||C<3600&&Math.floor(C/60)+" minutes ago"||C<7200&&"1 hour ago"||C<86400&&Math.floor(C/3600)+" hours ago")||A==1&&"Yesterday"||A<7&&A+" days ago"||A<31&&Math.ceil(A/7)+" weeks ago"}if(typeof jQuery!="undefined"){jQuery.fn.prettyDate=function(){return this.each(function(){var A=prettyDate(this.title);if(A){jQuery(this).text(A)}})}}(function(A){A.ajaxHistory=new function(){var K="historyReset";var C=location.hash;var J=null;var H;this.update=function(){};var G=function(){A(".remote-output").empty()};A(document).bind(K,G);if(A.browser.msie){var I,D=false;A(function(){I=A('<iframe style="display: none;"></iframe>').appendTo(document.body).get(0);var M=I.contentWindow.document;M.open();M.close();if(C&&C!="#"){M.location.hash=C.replace("#","")}});this.update=function(N){C=N;var M=I.contentWindow.document;M.open();M.close();M.location.hash=N.replace("#","")};H=function(){var N=I.contentWindow.document;var M=N.location.hash;if(M!=C){C=M;if(M&&M!="#"){A('a[@href$="'+M+'"]').click();location.hash=M}else{if(D){location.hash="";A(document).trigger(K)}}}D=true}}else{if(A.browser.mozilla||A.browser.opera){this.update=function(M){C=M};H=function(){if(location.hash){if(C!=location.hash){C=location.hash;A('a[@href$="'+C+'"]').click()}}else{if(C){C="";A(document).trigger(K)}}}}else{if(A.browser.safari){var L,B,F;A(function(){L=[];L.length=history.length;B=[]});var E=false,D=false;F=function(M){L.push(M);B.length=0;E=false};this.update=function(M){C=M;F(C)};H=function(){var M=history.length-L.length;if(M){E=false;if(M<0){for(var N=0;N<Math.abs(M);N++){B.unshift(L.pop())}}else{for(var N=0;N<M;N++){L.push(B.shift())}}var O=L[L.length-1];A('a[@href$="'+O+'"]').click();C=location.hash}else{if(L[L.length-1]==undefined&&!E){if(document.URL.indexOf("#")>=0){A('a[@href$="#'+document.URL.split("#")[1]+'"]').click()}else{if(D){A(document).trigger(K)}}E=true}}D=true}}}}this.initialize=function(M){if(typeof M=="function"){A(document).unbind(K,G).bind(K,M)}if(location.hash&&typeof F=="undefined"){A('a[@href$="'+location.hash+'"]').trigger("click")}if(H&&J==null){J=setInterval(H,200)}}};A.fn.remote=function(B,C,E){E=E||function(){};if(typeof C=="function"){E=C}C=A.extend({hashPrefix:"remote-"},C||{});var D=A(B).size()&&A(B)||A("<div></div>").appendTo("body");D.addClass("remote-output");return this.each(function(H){var G=this.href,I="#"+(this.title&&this.title.replace(/\s/g,"_")||C.hashPrefix+(H+1)),F=this;this.href=I;A(this).click(function(J){if(!D.locked){if(J.clientX){A.ajaxHistory.update(I)}D.load(G,function(){D.locked=null;E.apply(F)})}})})};A.fn.history=function(B){return this.click(function(C){if(C.clientX){A.ajaxHistory.update(this.hash)}typeof B=="function"&&B()})}})(jQuery);