/*
	Copyright (c) 2004-2016, The JS Foundation All Rights Reserved.
	Available via Academic Free License >= 2.1 OR the modified BSD license.
	see: http://dojotoolkit.org/license for details
*/

//>>built
define("dojo/back","./_base/config ./_base/lang ./sniff ./dom ./dom-construct ./_base/window require".split(" "),function(q,F,l,G,H,I,z){function h(){var a=c.pop();if(a){var b=c[c.length-1];b||0!=c.length||(b=m);b&&(b.kwArgs.back?b.kwArgs.back():b.kwArgs.backButton?b.kwArgs.backButton():b.kwArgs.handle&&b.kwArgs.handle("back"));f.push(a)}}function r(){var a=f.pop();a&&(a.kwArgs.forward?a.kwArgs.forward():a.kwArgs.forwardButton?a.kwArgs.forwardButton():a.kwArgs.handle&&a.kwArgs.handle("forward"),c.push(a))}
function n(a,b,d){return{url:a,kwArgs:b,urlHash:d}}function t(a){a=a.split("?");return 2>a.length?null:a[1]}function A(){var a=(q.dojoIframeHistoryUrl||z.toUrl("./resources/iframe_history.html"))+"?"+(new Date).getTime();u=!0;k&&(l("webkit")?k.location=a:window.frames[k.name].location=a);return a}function J(){if(!v){var a=c.length,b=p();b!==B&&window.location.href!=C||1!=a?0<f.length&&f[f.length-1].urlHash===b?r():2<=a&&c[a-2]&&c[a-2].urlHash===b&&h():h()}}var e={};F.setObject("dojo.back",e);var p=
e.getHash=function(){var a=window.location.hash;"#"==a.charAt(0)&&(a=a.substring(1));return l("mozilla")?a:decodeURIComponent(a)},w=e.setHash=function(a){a||(a="");window.location.hash=encodeURIComponent(a)},C="undefined"!==typeof window?window.location.href:"",B="undefined"!==typeof window?p():"",m=null,D=null,x=null,k=null,f=[],c=[],u=!1,v=!1;e.goBack=h;e.goForward=r;e.init=function(){if(!G.byId("dj_history")){var a=q.dojoIframeHistoryUrl||z.toUrl("./resources/iframe_history.html");q.afterOnLoad||
document.write('\x3ciframe style\x3d"border:0;width:1px;height:1px;position:absolute;visibility:hidden;bottom:0;right:0;" name\x3d"dj_history" id\x3d"dj_history" src\x3d"'+a+'"\x3e\x3c/iframe\x3e')}};e.setInitialState=function(a){m=n(C,a,B)};e.addToHistory=function(a){f=[];var b=null,d=null;k||(k=window.frames.dj_history);x||(x=H.create("a",{style:{display:"none"}},I.body()));if(a.changeUrl){b=""+(!0!==a.changeUrl?a.changeUrl:(new Date).getTime());if(0==c.length&&m.urlHash==b){m=n(d,a,b);return}if(0<
c.length&&c[c.length-1].urlHash==b){c[c.length-1]=n(d,a,b);return}v=!0;setTimeout(function(){w(b);v=!1},1);x.href=b;if(l("ie")){d=A();var K=a.back||a.backButton||a.handle,g=function(y){""!=p()&&setTimeout(function(){w(b)},1);K.apply(this,[y])};a.back?a.back=g:a.backButton?a.backButton=g:a.handle&&(a.handle=g);var E=a.forward||a.forwardButton||a.handle;g=function(y){""!=p()&&w(b);E&&E.apply(this,[y])};a.forward?a.forward=g:a.forwardButton?a.forwardButton=g:a.handle&&(a.handle=g)}else l("ie")||D||(D=
setInterval(J,200))}else d=A();c.push(n(d,a,b))};e._iframeLoaded=function(a,b){var d=t(b.href);null==d?1==c.length&&h():u?u=!1:2<=c.length&&d==t(c[c.length-2].url)?h():0<f.length&&d==t(f[f.length-1].url)&&r()};return e});