//performs an asynchronous XML load//url - String, the url of the xml document//callback - Function, a function to call once the xml is loaded, is passed a handle to the loaded xml or null if load was unsuccessful//callbackContext - Object, defaults to window, an object to run the callback function in the context of//type - String, "GET" or "POST"//postData - String, &name=value pairs to post if a "POST" is being usedfunction loadXMLRequest(url, callback,callbackContext, type, postData){	if(!type)type="GET";	if(!postData)postData = "";	if(callbackContext==null)callbackContext = window;	var request = null;	var ok = false;	try{		if(window['XMLHttpRequest']){			var request = new XMLHttpRequest();			ok = true;		}else{			var request = new ActiveXObject("Microsoft.XMLHTTP");			ok = true;		}	}catch(e){		request = null;	}	if(request){		request.onreadystatechange = function(){			if(request.readyState==4){				var xml = (request.status==200) ? request.responseXML : null;//				alert(request.responseText);				callback.call(callbackContext,xml);			}		};		request.open(type,url,true);		request.send(postData);	}else{		callback.call(callbackContext,null);	}}/*******function turns an xml document into a js object********xmlDoc - Object, a handle to a dom node whose child tree is parsedgetAttributes - Boolean, defaults to false, specify true if dom elements should have their attributes parsed into an _attributes objecttoLowerCase - Boolean, defaults to false, specify true if element and attribute names should be forced to lower case/*******example:<xml>	<feed>		<title>My Feed</title>		<item>Item One</item>		<item>Item Two</item>	</feed></xml>var o = xmlToObject(xmlDoc);alert(o.xml[0].feed[0].title[0]._text); //alerts 'My Feed'alert(o.xml[0].feed[0].item[1]._text); //alerts 'Item Two'****************/function xmlToObject(xmlDoc,getAttributes,toLowerCase){	var recurser = new Object();	recurser.getAttributes = getAttributes;	recurser.toLowerCase = toLowerCase;	recurser.process = function(o,nodes){		for(var i = 0 ; i < nodes.length ; i++){			if(nodes[i].nodeType==3){				o._text += nodes[i].nodeValue;			}else if(nodes[i].nodeType==1){				var n = (this.toLowerCase) ? nodes[i].nodeName.toLowerCase() : nodes[i].nodeName;				if(o[n]){					o[n].push(new Object());				}else{					o[n] = new Array(new Object());				}				o[n][o[n].length-1]._text = "";				o[n][o[n].length-1]._cdata = "";				if(this.getAttributes){					o[n][o[n].length-1]._attributes = new Object();					for(var x = 0 ; x < nodes[i].attributes.length ; x++){						var attName = (this.toLowerCase) ? nodes[i].attributes[x].nodeName.toLowerCase() : nodes[i].attributes[x].nodeName;						o[n][o[n].length-1]._attributes[attName] = nodes[i].attributes[x].nodeValue;					}				}				 if(nodes[i].childNodes.length>0){					this.process(o[n][o[n].length-1], nodes[i].childNodes);				}			}else if(nodes[i].nodeType==4){				o._cdata += nodes[i].nodeValue;			}		}	};	var o = new Object();	recurser.process(o,xmlDoc.childNodes);	return o;}//use this function to trim characters from the start and/or end of a string//PARAMETERS://c - optional, the character to trim, defaults to whitespace//t - optional, the type of trim: "LEADING", "TRAILING", or "LEADINGTRAILING", defaults to "LEADINGTRAILING"//RETURNS:// the trimmed stringString.prototype.trim = function(c,t){	var s = this.toString(), b = true;	c = (c == null || c.length != 1) ? " " : c;	t = (t == null) ? "LEADINGTRAILING" : t ;	if(t.indexOf("LEADING") != -1){		while(b && s.length > 0){			if(s.charAt(0) == c) s = s.substring(1,s.length);			else b = false;		}	}	if(t.indexOf("TRAILING") != -1){			b = true;		while(b && s.length > 0){			if(s.charAt(s.length - 1) == c) s = s.substring(0,s.length-1);			else b = false;		}	}	return s;};//use this function to get all the characters in a string to the left of a given substring// (string is searched from left to right for substring)//OR get the first n characters of a string//PARAMETERS://v - a substring to get all the characters to the left of OR a number of characters to get//RETURNS://the substring resultString.prototype.left = function(v){	if(typeof v=="string"){		var x = this.indexOf(v);		return (x==-1) ? "" : this.substring(0,x);	}else if(typeof v=="number"){		return this.substring(0,v);	}	return "";};//use this function to get all the characters in a string to the left of a given substring//the string is searched from right to left for the substring//PARAMETERS://v - a substring to get all the characters to the left of//RETURNS://the substring resultString.prototype.leftBack = function(s){	if(typeof s=="string"){		var x = this.lastIndexOf(s);		return (x==-1) ? "" : this.substring(0,x);	}	return "";};//use this function to get all the characters in a string to the right of a given substring// (string is searched from left to right for substring)//OR get the last n characters of a string//PARAMETERS://v - a substring to get all the characters to the right of OR a number of characters to get//RETURNS://the substring resultString.prototype.right = function(v){	if(typeof v=="string"){		var x = this.indexOf(v);		return (x==-1) ? "" : this.substring(x+v.length,this.length);	}else if(typeof v=="number"){		return this.substring(Math.max(0,this.length-v),this.length);	}	return "";};//use this function to get all the characters in a string to the right of a given substring//the string is searched from right to left for the substring//PARAMETERS://v - a substring to get all the characters to the right of//RETURNS://the substring resultString.prototype.rightBack = function(s){	if(typeof s=="string"){		var x = this.lastIndexOf(s);		return (x==-1) ? "" : this.substring(x+s.length,this.length);	}	return "";};//use this function to determine if an array contains a given value//PARAMETERS://v - the value to search the array for//RETURNS://true if the array contains the value, false otherwiseArray.prototype.contains = function(v){	if(v == null) return false;	for (var i = 0 ; i < this.length ; i++ )	if(this[i] == v) return true;	return false;};function isNotANumber(v){	return(isNaN(v) || v==="" || v.indexOf(" ") !=-1);}// insertAdjacentHTML(), insertAdjacentText() and insertAdjacentElement()// for Netscape 6/Mozilla by Thor Larholm me@jscript.dk// Usage: include this code segment at the beginning of your document// before any other Javascript contents.if(typeof HTMLElement!="undefined" && !HTMLElement.prototype.insertAdjacentElement){	HTMLElement.prototype.insertAdjacentElement = function(where,parsedNode)	{		switch (where){		case 'beforeBegin':			this.parentNode.insertBefore(parsedNode,this)			break;		case 'afterBegin':			this.insertBefore(parsedNode,this.firstChild);			break;		case 'beforeEnd':			this.appendChild(parsedNode);			break;		case 'afterEnd':			if (this.nextSibling) 				this.parentNode.insertBefore(parsedNode,this.nextSibling);			else				this.parentNode.appendChild(parsedNode);			break;		}	}	HTMLElement.prototype.insertAdjacentHTML = function(where,htmlStr)	{		var r = this.ownerDocument.createRange();		r.setStartBefore(this);		var parsedHTML = r.createContextualFragment(htmlStr);		this.insertAdjacentElement(where,parsedHTML)	}	HTMLElement.prototype.insertAdjacentText = function(where,txtStr)	{		var parsedText = document.createTextNode(txtStr)		this.insertAdjacentElement(where,parsedText)	}}// Call sleep() to cause the client to sleep for a period of time, giving up it's time slice....sleep = function(secs, agenturlbase) {	var request = null;	var ok = false;		if ('undefined' == typeof(agenturlbase))		agenturlbase = ''	else	     if (agenturlbase.right(1) != '/')	     	agenturlbase = agenturlbase + '/';	     		try{		if(window['XMLHttpRequest']){			var request = new XMLHttpRequest();			ok = true;		}else{			var request = new ActiveXObject("Microsoft.XMLHTTP");			ok = true;		}	}catch(e){		request = null;	}		if(request){		request.onreadystatechange = function(){				// We don't need to do anything on the event since we're sync		};		var url = agenturlbase + 'sleep?OpenAgent&sleep=' + secs + 'cache=' + Math.random();		request.open("GET", url, false);		request.send(null);	}};Date.prototype.adjust = function(yr,mn,dy,hr,mi,se) {    var m,t;    this.setYear(this.getFullYear() + yr);    m = this.getMonth() + mn;    if(m != 0) this.setYear(this.getFullYear() + Math.floor(m/12));    if(m < 0) {        this.setMonth(12 + (m%12));        } else if(m > 0) {        this.setMonth(m%12);    }    t = this.getTime();    t += (dy * 86400000);    t += (hr * 3600000);    t += (mi * 60000);    t += (se * 1000);    this.setTime(t);}