try {
  document.execCommand('BackgroundImageCache', false, true);
} catch(e) {}

WindowListener.addEvent("resize");
WindowListener.addEvent("load");
WindowListener.add("load", "initHistory();");

var initDebugConsole = function() {
	if($("parser_info")) {
		$("parser_info").onclick = function() {
			if(!this.expanded) {
				this.expanded = true;
				new Effect.Opacity(this, { to : .7 });
				new Effect.Scale(this, 4000, { scaleContent : false, afterFinish : function(effect) { effect.element.style.overflow = "auto"; } });
			} else {
				this.expanded = false;
				this.style.overflow = "hidden";
				new Effect.Scale(this, 0, { scaleContent : false });
				new Effect.Opacity(this, { to : 0 });
			}
		}
		Element.setOpacity("parser_info", 0);
	}
}

var ajaxHandlers = {
	onCreate: function(){
		if(Ajax.activeRequestCount == 1) {
			Position.prepare();
			$("loading").style.top = Position.deltaY + "px";
			new Effect.Appear("loading", {duration: .2});
			//createBlockingShadow();
		}
	},
	onComplete: function() {
		if(Ajax.activeRequestCount == 0) {
			new Effect.Fade("loading", {duration: .2});
			//removeBlockingShadow();
		}
	}
};

Ajax.Responders.register(ajaxHandlers);
