/**
* SRAX Anchor Mix v0.9 beta (build 1)
* Mix of AJAX & Standard Anchors - MASA
* http://www.fullajax.ru
* Copyright(c) 2008-2009, Ruslan Sinitskiy.
* http://fullajax.ru/#:license
**/
(function(E){var F=E.Default;F.ANCHOR={ANIM_SCROLL:1,RECURSIVE:0,prefix:"anchor",id:"_GLOBAL_"};var G=function(H){H=E.get(H);var D=0,I=0;while(H){D+=H.offsetLeft;I+=H.offsetTop;H=H.offsetParent}return{x:D,y:I}};function B(D,L,Q,I,H){if(!(H==null?F.ANCHOR.RECURSIVE:H)){var O=G(D).y-Math.max(document.body.scrollTop,document.documentElement.scrollTop);var K=O&&(I==null?F.ANCHOR.ANIM_SCROLL:I)?10:1;O/=K;var I=setInterval(function(){scrollBy(0,O);if(!--K){clearInterval(I)}},100/K);return }if(!D||!D.parentNode){return }var M=D.parentNode;var P=G(M).y;var O=G(D).y-P+L;O-=M.scrollTop;var K=O&&(I==null?F.ANCHOR.ANIM_SCROLL:I)?10:1,J=O;O/=K;M.anim=setInterval(function(){M.scrollTop+=O;if(!--K){clearInterval(M.anim);if(M.parentNode){var N=J-M.scrollTop;B(M,N)}}},100/K)}function A(H,K,L){var J=E.get(H);if(!J){var D=document.getElementsByName(H);for(var I=0;I<D.length;I++){if(D[I].nodeName=="A"){J=D[I]}}}if(J){B(J,0,1);if(K){E.History.add(L||F.ANCHOR.id,H,F.ANCHOR.prefix)}return false}}E.Filter.on("beforewrap",function(I){var H=I.el;if(H.nodeName=="A"&&!H.anchored){var J=E.parseUri(H.href),D=J.anchor;if(D){H.onclick=function(){var N;if(H.options){N=H.options.id;var K=E.Html.thread[N],M=E.delHost(E.parseUri(H.href).path);if(K&&M==E.delHost(E.parseUri(K.history.currentUrl()).path)){}else{if(M!=E.delHost(E.parseUri(location.href).path)){return }}}else{N=I.layer==document?null:I.layer.id}var L=I.ops?!I.ops.nohistory:1;return A(D,L,N)};H.anchored=1}}});var C=function(I){var K=E.getHash(),J=E.parseAxHash(E.History.previous,F.ANCHOR.prefix);curAx=E.parseAxHash(K,F.ANCHOR.prefix);for(var L in curAx){var D=curAx[L];var H=I&&I.owner?E.parseUri(I.url).anchor:1;if(I&&I.id==L?H:J[L]!=D){A(D)}}};E.linkEqual[F.ANCHOR.prefix+":"+F.ANCHOR.id+":"]="$";E.onReady(function(){E.History.prefixListener[F.ANCHOR.prefix]=C;C({id:F.ANCHOR.id});E.Html.onall("load",C);E.History.on("beforeadd",function(H){log(H);var I=H.hash.replaceAll("#:",":");var D=E.parseUri(H.url).anchor;log(I);I=I.replace("#"+D,":"+F.ANCHOR.prefix+":"+H.id+":"+D);log(I);if(!I.startWith("#")){I="#"+I}return I})});E.scroll=function(H,I,D){B(E.get(H),0,1,I,D)}})(SRAX);