function getClasses(className)
	{
		var hasClassName = new RegExp("(?:^|\\s)" + className + "(?:$|\\s)");
		var allElements = window.getElementsByTagName("*");
		var results = [];

		var element;
		for (var i = 0; (element = allElements[i]) != null; i++) {
			var elementClass = element.className;
			if (elementClass && elementClass.indexOf(className) != -1 && hasClassName.test(elementClass))
				results.push(element);
		}

		return results;
	}

function showHide(me){
	thisclass = (me.match("spaceInfo")) ? "spaceInfo" : "";
	for (i=0;i<=lines;i++){
		thisl = thisclass + i;
		sh = (thisl==me) ? "block" : "none";
		document.getElementById(thisl).style.display=sh;
	}
	//alert (thisl+" -> "+sh+" - "+lines);
	window.self.focus();
}
function showHideSimple(me){
	doIt = (document.getElementById(me).style.display=="none") ? "block" : "none";
	document.getElementById(me).style.display=doIt;
	window.self.focus();
}
function showHideOne(div,show){
	document.getElementById(div).style.display=show;
	window.self.focus();
}

function fillIn(sn,n){
	alert (sn+" "+n);
}



function makeRequest(url,thisdiv) {
	var http_request = false;

	if (window.XMLHttpRequest) { // Mozilla, Safari, ...
		http_request = new XMLHttpRequest();
		if (http_request.overrideMimeType) {
			http_request.overrideMimeType('text/xml');
			// See note below about this line
		}
	} else if (window.ActiveXObject) { // IE
		try {
			http_request = new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e) {
			try {
				http_request = new ActiveXObject("Microsoft.XMLHTTP");
			} catch (e) {}
		}
	}

	if (!http_request) {
		alert('Giving up :( Cannot create an XMLHTTP instance');
		return false;
	}
	//http_request.onreadystatechange = function() { alertContents(http_request); };
	http_request.onreadystatechange = function() { echoContents(http_request,thisdiv); };
	http_request.open('GET', url, true);
	http_request.send(null);
}

function echoContents(http_request,thisdiv) {

	if (http_request.readyState == 4) {
		if (http_request.status == 200) {
			document.getElementById(thisdiv).innerHTML = http_request.responseText;
		} else {
			alert('There was a problem with the request.');
		}
	}
}


//from http://sujithcjose.blogspot.com/2007/10/zero-padding-in-java-script-to-add.html
function zeroPad(num,count) { 
	var numZeropad = num + '';
	while(numZeropad.length < count) {
	numZeropad = "0" + numZeropad; 
	}
	return numZeropad;
}


function deleteAccount(code) {
	var conftext='WARNING!\n\nPLEASE READ CAREFULLY FIRST: By clicking \'OK\' you will be suspending your Park On My Drive account. This means that you will not be able to log in to your My Page; also, any spaces you have created will no longer appear in any searches, and can no longer be booked by other users. You will have to contact us directly if you want your user identity re-activated, for which there may be an admin charge.\n\nAre you sure you want to suspend your account?';
if (confirm(conftext)) {
	delUrl = 'login.php?del=' + code;
    document.location = delUrl;
  }
}