/* Copyright (c) 2010, Yahoo! Inc. All rights reserved. Code licensed under the BSD License: http://developer.yahoo.com/yui/license.html version: 3.3.0 build: 3167 */ YUI.add("history-hash",function(A){var C=A.HistoryBase,F=A.Lang,L=A.Array,J=A.Object,K=YUI.namespace("Env.HistoryHash"),B="hash",E,D,I,H=A.config.win,M=H.location,N=A.config.useHistoryHTML5;function G(){G.superclass.constructor.apply(this,arguments);}A.extend(G,C,{_init:function(O){var P=G.parseHash();O=O||{};this._initialState=O.initialState?A.merge(O.initialState,P):P;A.after("hashchange",A.bind(this._afterHashChange,this),H);G.superclass._init.apply(this,arguments);},_change:function(Q,P,O){J.each(P,function(S,R){if(F.isValue(S)){P[R]=S.toString();}});return G.superclass._change.call(this,Q,P,O);},_storeState:function(R,Q){var P=G.decode,O=G.createHash(Q);G.superclass._storeState.apply(this,arguments);if(R!==B&&P(G.getHash())!==P(O)){G[R===C.SRC_REPLACE?"replaceHash":"setHash"](O);}},_afterHashChange:function(O){this._resolveChanges(B,G.parseHash(O.newHash),{});}},{NAME:"historyHash",SRC_HASH:B,hashPrefix:"",_REGEX_HASH:/([^\?#&]+)=([^&]+)/g,createHash:function(Q){var O=G.encode,P=[];J.each(Q,function(S,R){if(F.isValue(S)){P.push(O(R)+"="+O(S));}});return P.join("&");},decode:function(O){return decodeURIComponent(O.replace(/\+/g," "));},encode:function(O){return encodeURIComponent(O).replace(/%20/g,"+");},getHash:(A.UA.gecko?function(){var P=/#(.*)$/.exec(M.href),Q=P&&P[1]||"",O=G.hashPrefix;return O&&Q.indexOf(O)===0?Q.replace(O,""):Q;}:function(){var P=M.hash.substr(1),O=G.hashPrefix;return O&&P.indexOf(O)===0?P.replace(O,""):P;}),getUrl:function(){return M.href;},parseHash:function(R){var O=G.decode,S,V,T,P,Q={},U=G.hashPrefix,W;R=F.isValue(R)?R:G.getHash();if(U){W=R.indexOf(U);if(W===0||(W===1&&R.charAt(0)==="#")){R=R.replace(U,"");}}T=R.match(G._REGEX_HASH)||[];for(S=0,V=T.length;S