function addParameter(uri, key, value){	// See http://xkr.us/articles/javascript/encode-compare/	var separator = "?";	if (uri.indexOf("?") >= 0)		separator = "&";	return uri + separator + key + "=" + encodeURIComponent(value);}// Function below to instantiate an XMLHttpRequest object// Credits: http://jibbering.com/2002/4/httprequest.html// Credits: http://www.toutjavascript.com/savoir/xmlhttprequest.php3function newHttpRequest(){	var httpRequest = false;	if(window.XMLHttpRequest)		// Firefox, Mozilla, Safari		httpRequest = new XMLHttpRequest();	else if(window.ActiveXObject) 		// Internet Explorer		{	try {   				httpRequest = new ActiveXObject("Microsoft.XMLHTTP");			} catch (e) {  				try {   					httpRequest = new ActiveXObject("Msxml2.XMLHTTP");				} catch (E) {					httpRequest = false; 	 			}			}		}	return httpRequest;}// Functions below to rebuild the xml string of an elementfunction xmlString (element) {	var xml = "";	for ( var x = 1 ; x <= element.childNodes.length ;  x++ ) {		var node = element.childNodes[x-1];		xml += outerXmlString(node);	}	return xml;}function outerXmlString (element) {	if (!element.tagName)		return element.data;	var xml = "<" + element.tagName;	for ( var x = 1 ; x <= element.attributes.length ;  x++ ) {		var attr = element.attributes[x-1];		xml += " " + attr.name + "=" + '"' + attr.value + '"';	}	xml += ">";	for ( var x = 1 ; x <= element.childNodes.length ;  x++ ) {		var node = element.childNodes[x-1];		xml += outerXmlString(node);	}	xml += "</" + element.tagName + ">";	return xml;}// Function below to get stable equivalent of document.getElementsByTagName("*")// Credits: http://www.siteexperts.com/tips/contents/ts16/page3.aspfunction getAllElements(document){	var elements = [];	getElements(elements,document.childNodes[0])	return elements;   }// Function below to recursively and deeply collect all sub-elements of an element// Credits: http://www.siteexperts.com/tips/contents/ts16/page3.aspfunction getElements(collection, element) {	if (element == null) return;	for ( var x = 1 ; x <= element.childNodes.length ; x++ ) {		var node = element.childNodes[x-1];		if (node.nodeType == 1) {			collection[collection.length] = node[x-1];				getElements(collection,element);		}	}}// Function below to detect if the id of any parent of an element is part of an arrayfunction includes(collection, element) {	var parent = element.parentNode;	while (parent.tagName) {		var attributes = parent.attributes;		if (attributes.length > 0) {			for ( var ax = 1 ; ax <= attributes.length ; ax++ ) {				var attr = attributes[ax-1];				var attrName = attr.name;				if (attrName == "id") {					for ( var x = 1 ; x <= collection.length ; x++ ) {						if (collection[x-1] == attr.value) return true;					}				}			}		}		parent = parent.parentNode;	}	return false;}// Get the text of the body elementfunction bodyText(doc){	var elements = doc.getElementsByTagName("*");	if (elements.length == 0) {		// IE does not support the above, use an alternative hard-coded technique		elements = getAllElements(doc)	}	// Find html elements with the id= attribute	for ( var x = 1 ; x <= elements.length ; x++ ) {		var elem = elements[x-1];		if (elem.tagName == "BODY") {			var body = xmlString(elem);		}	}	return body;	}