﻿//IE doesn't expose any W3C interfaces
//expose Node interface here for the *_NODE constants
//note: this doesn't expose the Node prototype,
//	so new methods/properties can't be added
if (!window.Node) {
	var Node = {
		ELEMENT_NODE: 1,
		ATTRIBUTE_NODE: 2,
		TEXT_NODE: 3,
		CDATA_SECTION_NODE: 4,
		ENTITY_REFERENCE_NODE: 5,
		ENTITY_NODE: 6,
		PROCESSING_INSTRUCTION_NODE: 7,
		COMMENT_NODE: 8,
		DOCUMENT_NODE: 9,
		DOCUMENT_TYPE_NODE: 10,
		DOCUMENT_FRAGMENT_NODE: 11,
		NOTATION_NODE: 12
	}
}

//fix for Gecko 1.8 bug: alert and confirm don't output spaces and tabs
//note: Gecko compiles regexp literals during initial parsing,
//	so they don't need to be manually cached
(function() {
	var m = navigator.userAgent.match(/rv:([\d\.]+).*\)\s*Gecko/i);
	if (m && parseFloat(m[1]) >= 1.8) {
		var $alert = window.alert;
		window.alert = function(str) {
			$alert(String(str).replace(/\t/g, '\xA0\xA0\xA0\xA0').replace(/ /g, '\xA0'));
		}
		var $confirm = window.confirm;
		window.confirm = function(str) {
			return $confirm(String(str).replace(/\t/g, '\xA0\xA0\xA0\xA0').replace(/ /g, '\xA0'));
		}
	}
})();
