//AJAX Core
function HttpClient(method,async,xmlhttp,result) {
	this.requestType = method;
	this.isAsync = async;
	this.xmlhttp = xmlhttp;
	this.requestResult = result;
} //end HttpClient
HttpClient.prototype = {
	callback:false,
	onSend:false,
	onLoad:false,
	onError:function(error) {
		alert(error.message);
	}/*onError:function(error)*/,
	init:function() {
		try {
			this.xmlhttp = new XMLHttpRequest();
		} catch (e) {
			var XMLHTTP_IDS = new Array('MSXML2.XMLHTTP.5.0','MSXML2.XMLHTTP.4.0','MSXML2.XMLHTTP.3.0','MSXML2.XMLHTTP','Microsoft.XMLHTTP');
			var success = false;
			for (var i = 0; i < XMLHTTP_IDS.length && !success; i++) {
				try {
					this.xmlhttp = new ActiveXObject(XMLHTTP_IDS[i]);
					success = true;
				} catch (e) {}
			} //end var i = 0; i < XMLHTTP_IDS.length && !success; i++ FOR
			if (!success) {
				throw new Error('Unable to create XMLHttpRequest.');
			} //end !success IF
		} //end try/catch
	} /*end init:function()*/,
	makeRequest:function(url,payload) {
		if (!this.xmlhttp) {
			this.init();
		} //end !this.xmlhttp IF
		this.xmlhttp.open(this.requestType,url,this.isAsync);
		var self = this;
		if (this.callback != false) {
			this.xmlhttp.onreadystatechange = function() {self._readyStateChangeCallback();}
		} //end this.callback != false IF
		if (this.requestType == "POST") {
			this.xmlhttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded;");
		} //end this.requestType == "POST" IF
		this.xmlhttp.send(payload);
		if (!this.isAsync) {
			return this.xmlhttp.responseText;
		} //end !this.isAsync IF
	} /*end makeRequest:function(url,payload)*/,
	_readyStateChangeCallback:function() {
		switch(this.xmlhttp.readyState) {
			case 2:
				if (this.onSend != false) {
					this.onSend();
				} //end this.onSend != false IF
			break;
			case 4:
				if (this.onLoad != false) {
					this.onLoad();
				} //end this.onLoad != false IF
				if (this.xmlhttp.status == 200) {
					if (this.requestResult == 'XML') {
						this.callback(this.xmlhttp.responseXML);
					} else {
						this.callback(this.xmlhttp.responseText);
					} //end this.requestResult == 'XML' IF
				} else {
					this.onError(new Error('HTTP Error Making Request: ['+this.xmlhttp.status+'] '+this.xmlhttp.statusText));
				} //end this.xmlhttp.status == 200 IF
			break;
		} //end this.xmlhttp.readyState SWITCH
	} //end _readyStateChangeCallback:function()
} //end HttpClient.prototype

//DOM Core
function emptyElement(target) {
	while (target.hasChildNodes()) {
		target.removeChild(target.firstChild);
	} //end target.hasChildNodes() WHILE
} //end emptyElement
if (!Array.indexOf){
	Array.prototype.indexOf = function(obj) {
		for (var i = 0; i < this.length; i++) {
			if (this[i] == obj) {
				return i;
			} //end this[i] == obj IF
		} //end var i = 0; i < this.length; i++ FOR
		return -1;
	} //end Array.prototype.indexOf = function(obj)
} //end !Array.indexOf IF

//Cookies Core
var today = new Date();
var tomorrow = new Date(today.getTime() + 86400000);
function cookieExists(name) {
	var cookies = document.cookie.split("; ");
	for (i = 0; i < cookies.length; i++) {
		var pieces = cookies[i].split("=");
		if (pieces[0] == name) {
			return true;
		} //end pieces[0] == name IF
	} //end i = 0; i < cookies.length; i++ FOR
	return false;
} //end cookieExists
function getCookie(name) {
	var cookies = document.cookie.split("; ");
	for (i = 0; i < cookies.length; i++) {
		var pieces = cookies[i].split("=");
		if (pieces[0] == name) {
			return unescape(pieces[1]);
		} //end pieces[0] == name IF
	} //end i = 0; i < cookies.length; i++ FOR
	return false;
} //end getCookie
function setCookie(name,value,expires,path) {
	document.cookie = name + "=" + escape(value) + ((expires) ? "; expires=" + expires.toGMTString() : "") + ((path) ? "; path=" + path : "");
} //end setCookie
