var currentTime = new Date();
var divScroll = new Array();

function ajax(url, vars, cbFunction) {
	var xmlHttp = ((window.XMLHttpRequest)? new XMLHttpRequest(): new ActiveXObject("MSXML2.XMLHTTP.3.0"));
	xmlHttp.open("POST", url, true);
	xmlHttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); 

	xmlHttp.onreadystatechange = function() {
		if (xmlHttp.readyState == 4 && xmlHttp.status == 200) {
			if (xmlHttp.responseText) {
				if (xmlHttp.responseText == 'auth-error') {
					cAlert("You must login.");
					goto('login');
				} else {
					if (cbFunction !== null) cbFunction(xmlHttp.responseText);
				}
			}
		}
	};
	xmlHttp.send(vars);
}

function cAlert(msg) {
	alert(msg);
}

function goto(url) {
	window.location = document.getElementsByTagName('base')[0].href + url;
}

function getElementsByClassName(classname, node) {
	node = document.getElementById(node);
	a = [];
	re = new RegExp('\\b' + classname + '\\b');
	els = node.getElementsByTagName("*");
	for(i=0,j=els.length; i<j; i++)
	if(re.test(els[i].className))a.push(els[i]);
	return a;
}
