/*
 * jQuery BBQ: Back Button & Query Library - v1.3pre - 8/20/2010
 * http://benalman.com/projects/jquery-bbq-plugin/
 * 
 * Copyright (c) 2010 "Cowboy" Ben Alman
 * Dual licensed under the MIT and GPL licenses.
 * http://benalman.com/about/license/
 */
(function($,q){var i,n=Array.prototype.slice,s=decodeURIComponent,a=$.param,j,c,m,w,b=$.bbq=$.bbq||{},r,v,k,e=$.event.special,d="hashchange",B="querystring",E="fragment",z="elemUrlAttr",g="location",l="href",u="src",y=/^.*\?|#.*$/g,x=/^.*\#/,h,D={};function F(G){return typeof G==="string"}function C(H){var G=n.call(arguments,1);return function(){return H.apply(this,G.concat(n.call(arguments)))}}function o(G){return G.replace(/^[^#]*#?(.*)$/,"$1")}function p(G){return G.replace(/(?:^[^?#]*\?([^#]*).*$)?.*/,"$1")}function f(I,N,G,J,H){var P,M,L,O,K;if(J!==i){L=G.match(I?/^([^#]*)\#?(.*)$/:/^([^#?]*)\??([^#]*)(#?.*)/);K=L[3]||"";if(H===2&&F(J)){M=J.replace(I?x:y,"")}else{O=m(L[2]);J=F(J)?m[I?E:B](J):J;M=H===2?J:H===1?$.extend({},J,O):$.extend({},O,J);M=j(M);if(I){M=M.replace(h,s)}}P=L[1]+(I?"#":M||!L[1]?"?":"")+M+K}else{P=N(G!==i?G:q[g][l])}return P}a[B]=C(f,0,p);a[E]=c=C(f,1,o);a.sorted=j=function(H,I){var G=[],J={};$.each(a(H,I).split("&"),function(N,K){var M=K.replace(/(?:%5B|=).*$/,""),L=J[M];if(!L){L=J[M]=[];G.push(M)}L.push(K)});return $.map(G.sort(),function(K){return J[K]}).join("&")};c.noEscape=function(H){H=H||"";var G=$.map(H.split(""),encodeURIComponent);h=new RegExp(G.join("|"),"g")};c.noEscape(",/");$.deparam=m=function(J,G){var I={},H={"true":!0,"false":!1,"null":null};$.each(J.replace(/\+/g," ").split("&"),function(M,R){var L=R.split("="),Q=s(L[0]),K,P=I,N=0,S=Q.split("]["),O=S.length-1;if(/\[/.test(S[0])&&/\]$/.test(S[O])){S[O]=S[O].replace(/\]$/,"");S=S.shift().split("[").concat(S);O=S.length-1}else{O=0}if(L.length===2){K=s(L[1]);if(G){K=K&&!isNaN(K)?+K:K==="undefined"?i:H[K]!==i?H[K]:K}if(O){for(;N<=O;N++){Q=S[N]===""?P.length:S[N];P=P[Q]=N<O?P[Q]||(S[N+1]&&isNaN(S[N+1])?{}:[]):K}}else{if($.isArray(I[Q])){I[Q].push(K)}else{if(I[Q]!==i){I[Q]=[I[Q],K]}else{I[Q]=K}}}}else{if(Q){I[Q]=G?i:""}}});return I};function A(I,G,H){if(G===i||typeof G==="boolean"){H=G;G=a[I?E:B]()}else{G=F(G)?G.replace(I?x:y,""):G}return m(G,H)}m[B]=C(A,0);m[E]=w=C(A,1);$[z]||($[z]=function(G){return $.extend(D,G)})({a:l,base:l,iframe:u,img:u,input:u,form:"action",link:l,script:u});k=$[z];function t(J,H,I,G){if(!F(I)&&typeof I!=="object"){G=I;I=H;H=i}return this.each(function(){var M=$(this),K=H||k()[(this.nodeName||"").toLowerCase()]||"",L=K&&M.attr(K)||"";M.attr(K,a[J](L,I,G))})}$.fn[B]=C(t,B);$.fn[E]=C(t,E);b.pushState=r=function(J,G){if(F(J)&&/^#/.test(J)&&G===i){G=2}var I=J!==i,H=c(q[g][l],I?J:{},I?G:2);q[g][l]=H+(/#/.test(H)?"":"#")};b.getState=v=function(G,H){return G===i||typeof G==="boolean"?w(G):w(H)[G]};b.removeState=function(G){var H={};if(G!==i){H=v();$.each($.isArray(G)?G:arguments,function(J,I){delete H[I]})}r(H,2)};e[d]=$.extend(e[d],{add:function(G){var I;function H(K){var J=K[E]=c();K.getState=function(L,M){return L===i||typeof L==="boolean"?m(J,L):m(J,M)[L]};I.apply(this,arguments)}if($.isFunction(G)){I=G;return H}else{I=G.handler;G.handler=H}}})})(jQuery,this);
/*
 * jQuery hashchange event - v1.3 - 7/21/2010
 * http://benalman.com/projects/jquery-hashchange-plugin/
 * 
 * Copyright (c) 2010 "Cowboy" Ben Alman
 * Dual licensed under the MIT and GPL licenses.
 * http://benalman.com/about/license/
 */
(function($,e,b){var c="hashchange",h=document,f,g=$.event.special,i=h.documentMode,d="on"+c in e&&(i===b||i>7);function a(j){j=j||location.href;return"#"+j.replace(/^[^#]*#?(.*)$/,"$1")}$.fn[c]=function(j){return j?this.bind(c,j):this.trigger(c)};$.fn[c].delay=50;g[c]=$.extend(g[c],{setup:function(){if(d){return false}$(f.start)},teardown:function(){if(d){return false}$(f.stop)}});f=(function(){var j={},p,m=a(),k=function(q){return q},l=k,o=k;j.start=function(){p||n()};j.stop=function(){p&&clearTimeout(p);p=b};function n(){var r=a(),q=o(m);if(r!==m){l(m=r,q);$(e).trigger(c)}else{if(q!==m){location.href=location.href.replace(/#.*/,"")+q}}p=setTimeout(n,$.fn[c].delay)}$.browser.msie&&!d&&(function(){var q,r;j.start=function(){if(!q){r=$.fn[c].src;r=r&&r+a();q=$('<iframe tabindex="-1" title="empty"/>').hide().one("load",function(){r||l(a());n()}).attr("src",r||"javascript:0").insertAfter("body")[0].contentWindow;h.onpropertychange=function(){try{if(event.propertyName==="title"){q.document.title=h.title}}catch(s){}}}};j.stop=k;o=function(){return a(q.location.href)};l=function(v,s){var u=q.document,t=$.fn[c].domain;if(v!==s){u.title=h.title;u.open();t&&u.write('<script>document.domain="'+t+'"<\/script>');u.close();q.location.hash=v}}})();return j})()})(jQuery,this);
