/*
YUI 3.6.0pr3 (build 1)
Copyright 2012 Yahoo! Inc. All rights reserved.
Licensed under the BSD License.
http://yuilibrary.com/license/
*/
YUI.add("pjax-base",function(e){var c=e.config.win,d=e.ClassNameManager.getClassName("pjax"),a="navigate";function b(){}b.prototype={_regexURL:/^((?:[^\/#?:]+:\/\/|\/\/)[^\/]*)?([^?#]*)(\?[^#]*)?(#.*)?$/,initializer:function(){this.publish(a,{defaultFn:this._defNavigateFn});if(this.get("html5")){this._pjaxBindUI();}},destructor:function(){this._pjaxEvents&&this._pjaxEvents.detach();},navigate:function(g,f){g=this._resolveURL(g);if(this._navigate(g,f)){return true;}if(!this._hasSameOrigin(g)){e.error("Security error: The new URL must be of the same origin as the current URL.");}return false;},_navigate:function(h,g){h=this._upgradeURL(h);if(!this.hasRoute(h)){return false;}g=e.merge(g,{url:h});var j=this._upgradeURL(this._getURL()),i,f;f=h.replace(/(#.*)$/,function(k,m,l){i=m;return k.substring(l);});if(i&&f===j.replace(/#.*$/,"")){if(!this.get("navigateOnHash")){return false;}g.hash=i;}"replace" in g||(g.replace=h===j);if(this.get("html5")||g.force){this.fire(a,g);}else{if(g.replace){c&&c.location.replace(h);}else{c&&(c.location=h);}}return true;},_pjaxBindUI:function(){if(!this._pjaxEvents){this._pjaxEvents=e.one("body").delegate("click",this._onLinkClick,this.get("linkSelector"),this);}},_defNavigateFn:function(f){this[f.replace?"replace":"save"](f.url);if(c&&this.get("scrollToTop")){setTimeout(function(){c.scroll(0,0);},1);}},_onLinkClick:function(i){var f,h,g;if(i.button!==1||i.ctrlKey||i.metaKey){return;}f=e.getLocation(),h=i.currentTarget;if(h.get("tagName").toUpperCase()!=="A"){return;}if(h.get("protocol")!==f.protocol||h.get("host")!==f.host){return;}g=i.currentTarget.get("href");g&&this._navigate(g,{originEvent:i})&&i.preventDefault();}};b.ATTRS={linkSelector:{value:"a."+d,writeOnce:"initOnly"},navigateOnHash:{value:false},scrollToTop:{value:true}};e.PjaxBase=b;},"3.6.0pr3",{requires:["classnamemanager","node-event-delegate","router"]});